My Retina Kit does not work for some reason.
As documented I’ve put my graphics “add_user-25.png” and “firstname.lastname@example.org” inside /Resource folder, added the folder with HiDPI and HiDPIPicture Classes into my project and also added the Retina Build-Scripts for copying and changing plist Item.
In my App I’ve added in the Windows.Open Event this lines:
dim p as HIDPIPicture = HIDPIPicture.imageNamed("add_user-25")
BUTTON_ContactAdd.Backdrop = p.pictureValue
and thought it would display a nice crisp Retina Image. But it won’t. Something I’ve missed… could anybody please tell me what? Sam are you here around us? Maybe you can help?
It should work if you put p.setSize(50,50) if I remember correctly.
Negative, the canvas has width & height of 25 pixels so I used p.setSize(25,25). If I use p.setSize(50,50) as suggested the picture is cropped and doesn’t fit anymore (only showing upperleft quarter-square).
Instead of using the Backdrop property, have you tried to use the Paint event?
Dim ContactAddButton As HIDPIPicture
Dim ContactAddButtonIcon As Picture
//Picture size: w = 19 and h = 17
ContactAddButton = HIDPIPicture.imageNamed( "ContactAddIcon" )
#if TargetCocoa then
ContactAddButtonIcon = ContactAddButton.pictureValue
g.DrawPicture ContactAddButtonIcon, 0,0, 19, 17, 0, 0, ContactAddButtonIcon.width, ContactAddButtonIcon.height
You’ll have to use the paint event to paint the HIDPIPicture.
Canvas backdrop uses a Xojo picture which isn’t sutibpe for Retina.
When drawing a HIDPIPicture you don’t have to convert it to a Xojo picture first (unless you’re drawing to a listbox).
The HIDPIPICTURE has the same drawing function a regular picture.
[quote=131794:@Sam Rowlands]When drawing a HIDPIPicture you don’t have to convert it to a Xojo picture first (unless you’re drawing to a listbox).
The HIDPIPICTURE has the same drawing function a regular picture.[/quote]
My example was coming from a listbox.
Basically, Xojo’s picture objects are not Retina ready and neither is the Xojo background property of a window or canvas. The listbox does some magic whereby the pixel alignment of NSImage images (which is what the Retina Kit uses) don’t work, so for Listboxes you have to create an image at twice the resolution and draw down. I’m working on a Retina Kit update to fix that, but it won’t be ready for a while.
Thank you Sam for your quick assistance, I will check this out today.