Android高斯模糊部分图像

时间:2015-10-05 19:42:00

标签: android android-canvas blur gaussian renderscript

我正在尝试在应用中实现一个功能,根据用户选择/触摸模糊图像的某些部分。我已经成功应用了Android" RenderScript"然而,模糊完整图像的方法,我无法找到仅模糊图像某些部分的示例。

如果有人能指出我正确的方向,那就太棒了。

我使用了以下问题的代码来实现完整的图像模糊。 https://stackoverflow.com/a/21052060/1293053

3 个答案:

答案 0 :(得分:4)

您可以使用ScriptIntrinsicBlur的forEach(Allocation aout,Script.LaunchOptions opt)和适当的opt值来设置您想要模糊的矩形。 http://developer.android.com/reference/android/renderscript/ScriptIntrinsicBlur.html有描述。

答案 1 :(得分:1)

您可以使用画布的油漆和模糊部分。有一些链接对您有所帮助:

Blur on touch. Android application

Is it possible to blur part of image on touch in Android?

Android draw with blur

希望这有帮助。

答案 2 :(得分:0)

尝试使用此库:https://github.com/jrvansuita/GaussianBlur

//Asynchronous with scaleDown and changing radius
GaussianBlur.with(context).size(300).radius(10).put(R.mipmap.your_image, imageView);