delphi draw directly on canvas regarding the scale


i use delphi xe7 with android. When i launch my application under samsung galaxy Note III, i have:

MyForm.width = 360
MyForm.mainpanel.GetSceneScale = 2.0;

and when i read the doc about my galaxy note III, i see that it’s have a resolution of 720px so it’s seam that the app decide by himself to divide by 2 the resolution (720 / 2 = 360) (because i don’t do such setup anywhere)

but i understand that 720px is too much, and pixel are very too little for the humain eye so i agree that the application must reduce the width by 2x.

so right now it’s mean that when i have one (logical) pixel in my mainpanel it’s use 4 (real) pixels on the screen (2 for the width and 2 for the height). right ?

now the question :

I have a bitmap of 200*200 pixel and i must draw it to the canvas of the mainpanel during the onpaint event. What is the best to do :

1/ resize the bitmap to 100*100 pixel and call canvas.DrawBitmap with the dimension of SrcRect and DstRect equal ? but if i resize the bitmap to 100*100 i will definitively and for sure loose pixels quality 🙁

2/ don’t resize the bitmap and always call canvas.DrawBitmap with the dimension of SrcRect 2x more bigger than DstRect ? but does the canvas.DrawBitmap will really use all the pixels or it’s will simply resize the bitmap to 100*100 and draw it on the canvas (so in some way like previous except here i will need to do the resize operation all the time)

3/ why Tbitmap have a property bitmapscale ? maybe i can use it ?

4/ forbid delphi to scale the mainpanel, and draw 2x more pixel on it. but how to fobid delphi to scale it ?

Comments are closed.