I am trying to scale bitmaps on a canvas in Android.
What I currently am doing:
int scaleFactor = 0.01;
int size = screenWidth * screenHeight * scaleFactor;
Rect rect = new Rect(x,y, x + size, y + size);
canvas.drawBitmap(bitmap, null, rect, null);
The problem is that phones with lower density will show much smaller images than phones with higher density.
Does anyone know a tactic or solution to this?
This is how i solved it.
Instead of calculating all the pixels on the screen in total, with screenWidth * screenHeight. I calculated the diagonal, and scaled all with a factor based to the diagonal length.