Xojo Listbox Retina

Hi everyone,

I know there are limitations for doing retina enabled images in the listbox as I read many previous posts. I have tried using my retinakit2 the way Sam had recommended and my images are not retina compared to the other retina images in my app.

Has anyone succeeded achieving retina images in the celltextpaint?

Thank you
Mike

Looking at my app-under-development: I am definitely seeing Retina images using CellTextPaint by simply creating an image that’s 2x the size of the graphics to be drawn into. I’m not seeing it using CellBackgroundPaint but that may simply be a coding error on my end.

Michael are you using RetinaKit or declares?

thanks!

Declares.

Declare Function BackingScaleFactor lib "AppKit" Selector "backingScaleFactor" (target As WindowPtr) As Double

and then setting “NSHighResolutionCapable” to True in the plist.

you then use the backingScaleFactor to make sure you are preparing your images at the 1x or 2x size as needed. You also have to make sure when you are drawing a picture, you don’t just use “graphics.drawPicture p,x,y” but rather the version with all the size parameters to stretch the 2x image down to the 1x canvas, e.g. “graphics.drawPicture p,x,y,w,h,0,0,p.width,p.height”

Yes, works fine for me as well. For a 16x16 image this is what it would look like. I hard-coded the numbers so that you can see it easily, but in my code it is calculated:

#If IsRetina then
    g.DrawPicture(MyPic2X, 0, 0, 16, 16, 0, 0, 32, 32)
#Else
    g.DrawPicture(MyPic, 0, 0, 16, 16)
#Endif

FYI, I was doing this in the CellBackgroundPaint event, but I works in the CellTextPaint event as well.

on the RKPicture object, there is a property called “drawingMode”

When drawing Retina images in a listbox, you need to set the following code.

image.drawingMode = image.kDrawingModeXojo

Then the retina image should draw correctly in a listbox.

Sam,

I apologize, but I never did replace my RetinaKit 1 w/ 2 since I originally had some MacOSLib conflicts I didn’t want to deal with at the time :slight_smile:

I just implemented RetinaKit2 and fixed the MacOSLib conflicts and with your above code this works flawlessly under a listbox.

    Dim ciscologo_retina as RKPicture = retinaKit.imageNamed( "ciscoLogo" )
    ciscologo_retina.drawingMode = ciscologo_retina.kDrawingModeXojo
    g.DrawPicture(ciscologo_retina,0,2,ciscologo_retina.width,ciscologo_retina.height)

Thank you again Sam and once again Retinakit2 is worth its weight in gold for me.

Your welcome, and I appreciate the compliment… Except that the RetinaKit being digital weighs so little, that it wouldn’t have any value in gold… :wink:

Everyone is talking images when it comes to retina displays. But what about the text? My text looks really blurry, even when I use retinizer or project10606 “Enable retina”. How to make use of the crisp fonts?