My App have a feature that let's the user capture photo and add drawing on that photo.
All the photo's are re-sized to exactly 900 x 900
.
To allow the user add drawing to the image. I keep a transparent image
over the original image
and do the drawing on the transparent image. Drawing is done using canvas
.
But when drawing in a device that has 720 x 480
(height x width). If i create a 900 x 900
transparent image and draw a line from 0,0
to 900,900
, canvas only draws line from 0,0
to 480,480
.
Below is the respective portion of the code:
Preparing Canvas:
holder = getHolder();
if (holder.getSurface().isValid()) {
Canvas canvas = holder.lockCanvas();
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
/* original image is 900 x 900 */
overlayBitmap = Bitmap.createBitmap(originalImage.getWidth(), originalImage.getHeight(), originalImage.getConfig());
canvas.setBitmap(overlayBitmap);
}
Drawing Line:
canvas.drawLine(0, 0, 900, 900, paint);
I have no idea why i am having this issue. It is because of using canvas
?? Is there any work around? Any help is highly appreciated :-)