I am loading a bitmap from a resource like so:
Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image);
What I want to do
Instad of yours:
Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image);
Use:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inMutable = true;
Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image, options);
You'd better use RapidDecoder.
import rapid.decoder.BitmapDecoder;
Bitmap mBackground = BitmapDecoder.from(res, R.drawable.image)
.mutable().decode();
Works for API level 8.
in case you need to handle all API levels, check out this post:
https://stackoverflow.com/a/16314940/878126
There are several ways to create a copy of it. This thread might help you: http://www.anddev.org/how_to_modify_the_image_file-t513.html
Use decodeResource(Resources res, int id, BitmapFactory.Options opts)
and specify inMutable
in the options.
http://developer.android.com/reference/android/graphics/BitmapFactory.html