How to make sure of HiDPI graphics

After reading the thread https://forum.xojo.com/32808-high-dpi-images where it appears ideas about HiDPI and graphics are kind of foggy, I decided to provide a tool to actually see if your app really shows pictures at 144dpi or not with Graphics.DrawPicture().

Retina1x2x.zip

This archive contains two pictures, each 1x1 inch.

  • 72dpi.png
  • 144dpi.png

In 72 dpi mode, 144dpi.png appears as uniformly grey. In Retina 2x mode, it shows vertical stripes.

If you draw 144dpi.png in points on a 72x72 canvas, it will show uniform grey. When correctly using Graphics.ScaleX and ScaleY, it will show the stripes.

It’s important to keep in mind that if you place these two pictures into the 1x and 2x slots of an Image object, the framework will select the approriate one for the scalefactor of the screen it is being drawn on without having to manipulate ScaleX and ScaleY.

I’d like to see what parameters you’re using for drawpicture because if 144.png truly is 144ppi, you shouldn’t need to muck with ScaleX and ScaleY either. Using:

g.DrawPicture pic,0, 0

Should work just fine.

The pictures are absolutely 72 dpi and 144dpi, drawn pixel by pixel.

I just verified, it indeed works fine in Retina 2x mode. Thanks.

As I was working with the picture, I found better to rename them

  • dpi72.png
  • dpi144.png

So they keep their name when dragged into the project. The download link remains the same.