How to draw bitmap larger than canvas in android

I am developing an application where the camera preview is always displayed. When the user wants, he takes a picture using takePicture () and saves it in a bitmap to draw later.

The problem is that the canvas is constantly showing the preview, and when you draw a bitmap of a previously taken image, the canvas does not draw it correctly. I think this is because the bitmap has a higher resolution than the canvas, because the bitmap is in camera resolution and not canvas.

How can I fix this? I need to draw the bitmap in the canvas correctly.

thank

+3


source to share


1 answer


Since you already have a bitmap, you need to draw the bitmap onto the canvas, but before doing this, scale the canvas so that the complete bitmap is small in comparison. It will still display correctly, but it will be smaller than the full size image.



0


source







All Articles