Android:ScriptIntrinsicBlur错误
我想要模糊到Android:ScriptIntrinsicBlur错误,android,blur,renderscript,Android,Blur,Renderscript,我想要模糊到ImageView 此代码不起作用,在ScriptIntrinsicBlurline强制关闭 模糊等级: 设置模糊代码: 和erro日志: 根据,该类是在API 17中添加的,因此在此之前不存在。您可以使用获取返回API 8的Renderscript访问权限,包括谢谢,How include support.v8?此库存在于buildtools\android-4.4W\renderscript\lib中。Gradle指令位于我使用eclipse提供的链接中。可以使用它吗?是的,但是
ImageView
此代码不起作用,在ScriptIntrinsicBlur
line强制关闭
模糊等级:
设置模糊代码:
和erro日志:
根据,该类是在API 17中添加的,因此在此之前不存在。您可以使用获取返回API 8的Renderscript访问权限,包括谢谢,How include support.v8?此库存在于
buildtools\android-4.4W\renderscript\lib
中。Gradle指令位于我使用eclipse提供的链接中。可以使用它吗?是的,但是你必须挖掘指令——Eclipse在2014年12月就已经不受支持了。
private static final float BLUR_RADIUS = 20f;
public Bitmap blur(Bitmap image) {
if (null == image)
return null;
Bitmap outputBitmap = Bitmap.createBitmap(image);
final RenderScript renderScript = RenderScript.create(this);
Allocation tmpIn = Allocation.createFromBitmap(renderScript, image);
Allocation tmpOut = Allocation.createFromBitmap(renderScript, outputBitmap);
ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript));
theIntrinsic.setRadius(BLUR_RADIUS);
theIntrinsic.setInput(tmpIn);
theIntrinsic.forEach(tmpOut);
tmpOut.copyTo(outputBitmap);
return outputBitmap;
}
bmp = BitmapFactory.decodeStream(urlImage.openConnection().getInputStream());
bmp = blur(bmp);
imgPost.setImageBitmap(bmp);