List of usage examples for android.renderscript ScriptIntrinsicBlur destroy
public void destroy()
From source file:Main.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static Bitmap fastBlur(Context context, Bitmap bm, int radius) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { Bitmap bitmap = bm.copy(bm.getConfig(), true); final RenderScript rs = RenderScript.create(context); final Allocation input = Allocation.createFromBitmap(rs, bm, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); final Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(radius);/*from www. ja v a 2 s . c om*/ script.setInput(input); script.forEach(output); output.copyTo(bitmap); // clean up renderscript resources rs.destroy(); input.destroy(); output.destroy(); script.destroy(); return bitmap; } return null; }