[quote=155362:@Mark Scardingo]Jim, I’m a little confused on this part. If I always use a 64x64 picture for my toolbar icon and Xojo scales it down automatically for me for non-retina displays, why do I need to check if the user is using retina?
Thank you[/quote]
Like Greg said, you only want to use a 64x64 picture if you’re on retina @2x. Otherwise your icons will be “fuzzy” on a standard res display. The way I handle it is to always do my drawing based on vectors within the available area. That way, if you have a 32x32 space or a 64x64 space it’s irrelevant to the drawing routine.
for example, instead of doing something like
g.drawoval(10,10,16,16)
you would do something like
g.drawoval(g.width*.1,g.height*.1,g.width*.7,g.height*.7)
I also like to use rect’s to represent areas in the drawing for clarity, like
dim area1 as new realbasic.rect(g.width*.1,g.height*.1,g.width*.4,g.height*.4)
g.drawrect(area1.left,area1.top,area1.width,area1.height)
It’s good to be able to scale the drawing on demand. Also, by doing this you’ll be prepared for the eventuality of 3x or higher. And this kind of drawing comes in handy if you need to print something using a different resolution graphics object.
To clarify this, Xojo doesn’t technically “Scale” the image on retina. When you draw to a 32x32 space in retina, it is actually a 64x64 pixel space (2pixels per point=32x32 points). Xojo is using system drawing routines, so the retina capability is there, you just have to be aware of it.
So, drawing a 64x64 picture to a 32x32 graphics object to a non-retina display scales the image (and interpolates the pixels). Drawing a 64x64 picture to a 32x32 graphics object in retina, you are actually drawing 64x64 pixels to 64x64 pixels, displayed in a 32x32 point space. This only applies to graphics objects received from paint events. The toolbuttons draw the icons in their own internal “paint” event.
I would expect this to change as more of the new framework moves to desktop, and we eventually see a new graphics object with a scale property… (Greg? Norman?).