Retina Kit 2 and Canvas?


Does anyone know how to use Retina KIt 2 to load either a standard or retina image into a canvas - I have tried numerous variations and cannot get it to work :frowning:

I have now started a completely new, blank project, and have placed a canvas (Canvas1) in the window .
I have also dragged in 2 images “TxtTemplate” and “TxtTemplate@2x” into the navigator.

What do I need to do now, in order to get the images to show in the canvas???

Thank you all in advance.

In the canvas paint event, you can write these 3 lines of code.

Sub Paint(g As Graphics, areas() As REALbasic.Rect) static myImage as RKPicture if myImage = nil then myImage = retinaKit.imageNamed( "TxtTemplate" ) g.drawpicture myImage, 0, 0, myImage.width, myImage.height End Sub

Thanks Sam - that worked :slight_smile: