I have some problems with the RenderScript ScriptIntrinsic Blur - on some devices it doesn't blur the whole image. I downscale the input image and make sure that the width is a multiple of 4 (because it's suggested by Roman Nurik: https://plus.google.com/+RomanNurik/posts/TLkVQC3M6jW)
@SuppressLint("NewApi")
private Bitmap blurRenderScript(Bitmap smallBitmap) {
Bitmap output = Bitmap.createBitmap(smallBitmap.getWidth(), smallBitmap.getHeight(), smallBitmap.getConfig());
RenderScript rs = RenderScript.create(getContext());
ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
Allocation inAlloc = Allocation.createFromBitmap(rs, smallBitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_GRAPHICS_TEXTURE);
Allocation outAlloc = Allocation.createFromBitmap(rs, output);
script.setRadius(BLUR_RADIUS);
script.setInput(inAlloc);
script.forEach(outAlloc);
outAlloc.copyTo(output);
rs.destroy();
MutableBitmap.delete(smallBitmap);
return output;
}
It is working on a Nexus 4:
But on a Galaxy S4 the right side has a transparent edge:
I hope you can see what I mean - if you open the picture in gimp or so you can see it better. It doesn't depend on the picture size. I Also tried it with bigger and smaller images, and the result was always the same. It also happens on a Nexus 7 2012 for example. Also, the transparent artifacts are sometimes on the bottem or left edge. Thanks in advance for your help!
Nexus 4: 4.4.2/Build Number KOT49H Galaxy S4: 4.2.2/Build Number JDQ39.I9505XXUDMGG