Drawing text or a gesture on an image saved on an SD card

So far in my application, I scale the image and draw it on the screen according to the size of the screen. after that, the user can draw text or any thing on it with his finger. and after that I convert the view to Bitmap and I resize the bitmap and make it the same height and width as the real image. Now the problem of resizing the image is getting worse, so I need to change the real image. So now can someone tell me how I can draw two canvases that overlap each other, or I can draw an image on an ImageView, and in the canvas I draw only the Path that the user draws using his palm? and the biggest problem is how can I combine the two images that the user has, which entered lines or curves,and one is a real image?

+5
source share
1 answer

Download the bitmap to its original resolution. Then use 2 phases:

1) If the user displays (draws) on the screen, draw a bitmap on the Canvas screen using the scale matrix to fit the screen. And draw a finger paint on top of it.

2) When saving, create a new canvas, set its target as your bitmap and draw over it the finger paint. Use the matrix again, but invert, because now you originally scaled the Bitmap and want to draw on top of it something that was previously drawn on a scaled bitmap. Now your bitmap has additional graphics, and you can save it in a file.

+2

All Articles