I have blurred a bitmap with Androids Rederscript
private Bitmap createBitmap_ScriptIntrinsicBlur(Bitmap src, float r) {
//Radius range (0 < r <= 25)
if(r <= 0){
r = 0.1f;
}else if(r > 25){
r = 25.0f;
}
Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(),Bitmap.Config.ARGB_8888);
RenderScript renderScript = RenderScript.create(getActivity());
Allocation blurInput = Allocation.createFromBitmap(renderScript, src);
Allocation blurOutput = Allocation.createFromBitmap(renderScript, bitmap);
ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(renderScript,Element.U8_4(renderScript));
blur.setInput(blurInput);
blur.setRadius(r);
blur.forEach(blurOutput);
blurOutput.copyTo(bitmap);
renderScript.destroy();
return bitmap;
}
But the image isn't blurred enough.
Are there any possibilities to blur the image with a radius over 25.
And when I call the blur function multiple times the image stays as blurred as a single function call.So that doesn't work either.
Thank you for your help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With