Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.graphics.Bitmap; import android.renderscript.Element; import android.renderscript.Allocation; import android.renderscript.ScriptIntrinsicBlur; import android.renderscript.RenderScript; public class Main { private static final float BLUR_RADIUS = 20f; public static Bitmap blur(final Context context, final Bitmap image) { if (null == image) return null; Bitmap outputBitmap = Bitmap.createBitmap(image); final RenderScript renderScript = RenderScript.create(context); Allocation tmpIn = Allocation.createFromBitmap(renderScript, image); Allocation tmpOut = Allocation.createFromBitmap(renderScript, outputBitmap); //Intrinsic Gausian blur filter ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript)); theIntrinsic.setRadius(BLUR_RADIUS); theIntrinsic.setInput(tmpIn); theIntrinsic.forEach(tmpOut); tmpOut.copyTo(outputBitmap); return outputBitmap; } }