How to determine if on retina


#1

Hi, is there a definitive way of doing this? Having trouble covering all bases.

For instance, on my monitor, for the main display I get the following:
Scale: 1, Width: 3840

So this is fine.
For a client, we get:
Scale: 2, Width: 1280, on a retina display
So I assume here, I can multiple 1280*2 = 2560, so that’s retina

However, if I scale my monitor to be 1920x1080 then I get:
Scale: 2, Width: 1920 - so if I did the multiplication again here, that would come to 3840 which would register as retina even though it’s not.

So, is there a better way to determine if I’m on a retina screen or not?

thx


#2

In the demoRunner/systemInfoDemo the DPI info ?


#3

Client gets 144 dpi on his monitor - so do I, for both 1920 and 2560 resolution (funnily enough when running at 3840 is goes down to 72)


#4

Ok, I understand, you can get the retina mode active but it seems you need to have the materiel info to know if you are on a retina display hardware.


#5

What are you using this information for?
“Retina” is an Apple marketing term, you’ll have to think in terms of resolution and scale factor to cover all bases and what this means.


#6

I have 2 sets of assets - I want to use the hi-res assets if on a “retina” screen, i.e. an apple screen with 2560 or higher horizontal res.


#7

I think for that you need to use the bounds of your Component and the scale factor of the Graphics context passed to paint to figure out what the appropriate asset is.

Remember, on desktop your app can move between windows so the resolution and scale will change and you’ll need to react to this.


#8

thanks for the suggestion - will give it a go


#9

Not sure how to do this…?


#10

g.getInternalContext().getPhysicalPixelScaleFactor()