I'm trying to develop a drawing app and it has a function to let user crop and share the drawing. mBitmap
is what I used to create my Canvas
.
mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
I managed to save what user draws, but I can't figure out how to crop the background as well. So I created a new Canvas
and
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(mBitmap, 0, 0, null);
crop = Bitmap.createBitmap(bitmap,
mRect.left,
mRect.top,
mRect.width(),
mRect.height());
saveCropScreenShot(crop));
the above saves my drawing with the crop area but background is missing. My app lets user to change background so it makes more sense to save both drawing and background together. Can anyone help? Thanks!!