I'm using a bitmap resource to mask another image using DST_IN
transfer mode. This is the bitmap:
(You probably can't see it because it's white and transparent.)
If I load it like this, everything works as expected:
mMaskBitmap = BitmapFactory.decodeResource(getResources(), mMaskId);
But if I load it like this, it's as though the mask image were entirely transparent:
mMaskDrawable = getResources().getDrawable(mMaskId);
mMaskBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
mMaskCanvas = new Canvas(mMaskBitmap);
mMaskDrawable.draw(mMaskCanvas);
What's the difference?
The bitmaps produced both ways are config ARGB_8888
, density 320, and 512x512. The size is strange because the resource file is 256x256, but it's the same for both.
I want to use the Drawable
approach so the resource can be a ninepatch.