I tried RenderScript for blurring image and it works. I would like to know how RenderScript can be used to blur part of the image. I tried below code but it did not work:
Bitmap overlay = Bitmap.createBitmap(
mWidth,
mHeight,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(overlay);
canvas.drawBitmap(bitmap, -mletf,
-mTop, null);
RenderScript rs = RenderScript.create(mContext);
Allocation overlayAlloc = Allocation.createFromBitmap(
rs, overlay);
ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(
rs, overlayAlloc.getElement());
blur.setInput(overlayAlloc);
blur.setRadius(mRadius);
blur.forEach(overlayAlloc);
overlayAlloc.copyTo(overlay);
rs.destroy();
return overlay;
Variables mHeight
, mWidth
are the height and width of the part to be blurred and its mTop
, mletf
are where blur should start.