I'm trying to load a photo from the web and perform a blur on it, outputting the blurred image as a separate bitmap. My code looks like this:
URL url = new URL(myUrl);
mNormalImage = BitmapFactory.decodeStream(url.openStream());
final RenderScript rs = RenderScript.create( mContext );
final Allocation input = Allocation.createFromBitmap( rs, mNormalImage, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT );
final Allocation output = Allocation.createTyped( rs, input.getType() );
final ScriptIntrinsicBlur script;
script = ScriptIntrinsicBlur.create( rs, Element.U8_4( rs ) );
script.setRadius( 3.f );
script.setInput( input );
script.forEach( output );
output.copyTo( mBlurredImage );
and I'm getting the error:
android.renderscript.RSIllegalArgumentException:
Cannot update allocation from bitmap, sizes mismatch
Why is this happening?