I have an imageview, which uses matrix to scale/drag an image. Now I want to overlay another image. The matrix transformation should be applied to the combination of background and overlay.
I did overwrite onDraw and used
canvas.drawBitmap(overlay, matrix, null);
whereas overlay is the new overlay, matrix is the currently applied matrix. This works fine. Unfortunately I can’t specify an offset at which the overlay shall appear on top of the background. This works
canvas.drawBitmap(overlay, 50, 10, null);
but the overlay remains on that position, once I draw and scale the background again…
How can I accomplish an offset while drawing a bitmap with matrix applied?
Regards
You may need to create a new bitmap of approprite size where your overlay will be saved with the matrix transformation. Something like:
The other way perhaps better is to do canvas.translate: