2015年5月1日 星期五

GPUImage is a good friend!

Building image filtering feature is easy with GPUImage for Android.
Here's the github repo https://github.com/CyberAgent/android-gpuimage

You simple have to do this in xml:
 <jp.co.cyberagent.android.gpuimage.GPUImageView  
     android:id="@+id/iv_filter_thumb"  
     android:layout_width="80dp"  
     android:layout_height="80dp"  
     android:layout_above="@+id/tv_filter_name" />  

And in code
 GPUImageView img = (GPUImageView) view.findViewById(R.id.iv_filter_thumb);  

if you want to apply a filter,  like a contrast filter.
 giv.setFilter(new GPUImageContrastFilter(1.75f));  

Although it's herriated from FrameLayout, you can still setScaleType like a ImageView
 img.setScaleType(GPUImage.ScaleType.CENTER_CROP);  

Pretty cool and easy to use, right?

沒有留言:

張貼留言