Hi-DPI on Mac?

Is Hi-DPI always x2?
How do I test the scaling?

Windows, Canvases, and a few other objects have a ScaleFactor as Double property. It’s not always 2x.


Edit: ScaleFactor is missing from the Canvas docs. I’ve reported that.

On macOS it’s always 2x as that comes from the OS. on Windows, I’ve seen values anywhere from 1.0 to 3.5. iOS can be 1.0, 2.0 or 3.0.

1 Like

Thank you.

It’s 2x right now but there’s no reason it couldn’t be something else in the future.


that’s what I was worried about. I think getting the scaling from the windows is a solid approach (I hope so anyway).

The best thing you can do is get it from the Paint event of the canvas. That will be the most up-to-the-minute accurate.

1 Like

And seeing that Apple only guarantees that the light/dark mode change will be accurate in a paint event, making this assumption about scalefactor is probably not a bad idea either.

Also, keep in mind that the framework tries to select the correct picture for you when drawing multi-Rez images, based on scalefactor and drawing size.

I am using this for an OpenGL issue.
I’m setting the scale factor based on the scale factor of the parent window. I’m assuming that’s ok. It’s working for now anyway.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.