I am trying to figure out how to layer two canvases, where one has a bitmap and the second is what I will actually draw on.
So basically what I have is:
Bitmap newBitmap = Bitmap.createBitmap(img.getWidth(), img.getHeight(),
Bitmap.Config.RGB_565);
Canvas newCanvas = new Canvas();
newCanvas.setBitmap(newBitmap);
if (img != null) {
newCanvas.drawBitmap(img, 0, 0, null);
}
mBitmap = newBitmap;
imageCanvas = newCanvas;
mCanvas = new Canvas();
drawBitmap = Bitmap.createBitmap(img.getWidth(), img.getHeight(),
Bitmap.Config.RGB_565);
mCanvas.setBitmap(drawBitmap);
where mCanvas
is what the user will draw on, and imageCanvas
is where the bitmap is drawn.
The image is black and white, and I want the black lines to always show through, so I want it as the top of the stack.
It seems I will need to ensure that the white parts of the image need to be transparent, which I may need to do when I load the image, as expecting it to be like this is too much to expect.
So, how do I stack these two canvases in the same view and have where the drawLine
shows up on the bottom canvas?
I did look at this question, but I don't think it is similar: