Cannot DrawPicture in HiRes Retina in Canvas Paint

I created an image set with 1x and 2x ping of a 25x10 image, ie, mypic_25x10 and mypic_25x10@2. I’m trying to draw in the canvas paint event using, g.drawpicture mypic_25x10,0,0 but I keep getting the lower resolution picture. The canvas is sized 50w x 20h. I don’t have this problem anywhere else. What am I doing wrong?

mypic_25x10@2 needs the size 50x20 (width, height).

1 Like

Yes, it is.

For it to work would the canvas not need to be 25x10 with scale factor 2 against it during paint? Otherwise you are upscaling.

I got around this by specifiying the draw size in drawpicture. It seems to work, but I’m still confused as to why I didn’t have to do this anywhere else in my project.

g.drawpicture mypic_25x10, 0, 0, 50, 20, 0, 0, mypic_25x10.width, mypic_25x10.height

Just tested image sets and they work correctly when moving the window between non and retina screens.

g.DrawPicture(myPic_25x10,0,0) will render the image in the top left quarter of your 50x20 sized canvas. Getting it to fill a 50x20 canvas would require a myPic_50x20.png and a myPic_50x20_2x.png image (100x40). Then it would only use the 2x image when you’re on a retina / hidpi screen.

Passing in the source x,y,w,h appears to work but only on non retina screens. Moving to retina it will be upscaled.

If you are not working if retina / hidpi then don’t use image sets 2X just create the image at the 50x20 size you want.

Thank you for clearing that up for me, Graham. I completely understand now.