<分区>
我不知道如何对图像应用不同的效果,
我看到了 EffectFactory类和 Effect效果类中的类有一种方法apply 但我不确定在 inputTexId 和 optputTexId 中传递什么,以及从哪里获得新的更新图像,如何将更新图像存储在 imageView 中,
请帮我解决这个问题。 是否有任何开源库可用于在图像上提供效果。
谢谢,
<分区>
我不知道如何对图像应用不同的效果,
我看到了 EffectFactory类和 Effect效果类中的类有一种方法apply 但我不确定在 inputTexId 和 optputTexId 中传递什么,以及从哪里获得新的更新图像,如何将更新图像存储在 imageView 中,
请帮我解决这个问题。 是否有任何开源库可用于在图像上提供效果。
谢谢,
最佳答案
我已经实现了 Jerry's Java Image Processing Library 强>。对我来说很好用。
下载 AndroidJars .
编辑
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
//Find the bitmap's width height
int width = AndroidUtils.getBitmapOfWidth(getResources(), R.drawable.ic_launcher);
int height = AndroidUtils.getBitmapOfHeight(getResources(), R.drawable.ic_launcher);
//Create a filter object.
GaussianFilter filter = new GaussianFilter();
//set???? function to specify the various settings.
filter.setRadius(8.5f);
//Change int Array into a bitmap
int[] src = AndroidUtils.bitmapToIntArray(bitmap);
//Applies a filter.
filter.filter(src, width, height);
//Change the Bitmap int Array (Supports only ARGB_8888)
Bitmap dstBitmap = Bitmap.createBitmap(src, width, height, Config.ARGB_8888);
在 Android-jhlabs 找到更多详细信息
关于android - 如何在位图上应用不同的图像效果(滤镜),如棕褐色、黑白、模糊等?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16292146/