Retina pic naming convention

For images stored internally in a Xojo project, is there an advantage to having the pics named:

MyPic.png
MyPic@2x.png

as opposed to

MyPic_LoRes.png
MyPic_HiRes.png

MyPic_HiRes.png looks correct on Retina displays (I reference the one I need based on an isRetina test), but a lot of posts I read here list them as …@2x.png. Is that just for the sake of getting the meaning across in the conversation, or is there some technical reason for using the same name and adding the @2x to the double sized pics? As always, thanks for the help here.

On OS X if the name of two images is foo.png and foo@2x.png then the correct one can be selected by the OS without you doing anything. You literally just say “get me the image named foo”

This is one thing we need to do to the framework to enable retina in end user projects.

NSImage on OS X will do this automatically
iOS is similar

OK, I’ll rename them and look up the details for NSImage here on the forum. Thanks, Norman!

I’ve not looked into it but Sams retina kit might deal with this on OS X
And MacOSLIb also has code for using NSImage on OS X

Its on our to do list to do this sort of thing as well as part of making it easy for people to make hi res aware apps (not just on OS X)

I would whole heartily recommend doing Retina as closely to Apple’s guidelines as possible, including the naming convention. NSImage is your friend here as it will handle the correct representation when it’s required. My Retina Kit will help with almost everything, and when you purchase you get the full source code. The Retina Kit also includes fall back code for Windows & Linux (although doesn’t provide HIDPI support on Windows or Linux).

However if you already own the MBS plugin, it also includes functions or lastly you can use the MacOSLib.

Be aware that there could also be another level of Retina in the near future, so if you use the Retina Kit or NSImage, all you need to do is to add the artwork.

I like the @2x naming convention because if you’re quickly glancing at file names you can immediately know which is the high resolution, where naming it FileName_HighRez.png and FileName_LowRez.png you have to read the whole filename to see it.

Also a +1 for RetinaKit. I used it for an older version of ModTools (the newest version no longer uses separate windows) and it was super easy to figure out.

+1 for @2x & @3x naming convention, I totally agree with Tim here.

and it extends to device specific versions for iOS as well

Is NSImage a Declare?

Thanks, Sam. What does the Retina kit do? I’ve got the correct images displaying when I need, but really I feel totally lost as to what could pop up and be a problem for me down the road, or even something now that I am not taking care of properly).

[quote=152053:@Merv Pate]Is NSImage a Declare?

Thanks, Sam. What does the Retina kit do? I’ve got the correct images displaying when I need, but really I feel totally lost as to what could pop up and be a problem for me down the road, or even something now that I am not taking care of properly).[/quote]

Yes, using NSImages in Xojo is a whole bunch of declares, quite a lot for the various different elements. The Retina Kit basically uses the same functionality as a Obj-C/Swift application, so once you’re using this, the OS will automatically load and display the correct representations when required. By getting the OS to handle to handle it, there’s a lot less that you as the developer need to worry about.

You can find more information in the Retina Kit web page, as well as a trial version which you can download and poke at.
http://www.ohanaware.com/retinakit/

NSImage is a class - in OS X
The simplest ways to get at it are it via MacOSLib, or MBS, RetinaKit
It handles the whole business of grabbing the right version of the image at the right resolution (1x, 2x, 3x) for you
So you just say “display foo” instead of having to worry about “Is my app on a 1x screen display foo.png. Oh I’m on a retina display show foo@2x.png. Whoops they made a 3x better go change my code again”
You just include the right images with the same “base name” - in the example I just gave “foo” as png’s and then the couple extra for different display densities (@2x, @3x) and dont have to touch your code to have it just work

[quote=152053:@Merv Pate]Is NSImage a Declare?

Thanks, Sam. What does the Retina kit do? I’ve got the correct images displaying when I need, but really I feel totally lost as to what could pop up and be a problem for me down the road, or even something now that I am not taking care of properly).[/quote]

Yes, using NSImages in Xojo is a whole bunch of declares, quite a lot for the various different elements. The Retina Kit basically uses the same functionality as a Obj-C/Swift application, so once you’re using this, the OS will automatically load and display the correct representations when required. By getting the OS to handle to handle it, there’s a lot less that you as the developer need to worry about.

You can find more information in the Retina Kit web page, as well as a trial version which you can download and poke at.
http://www.ohanaware.com/retinakit/

You can also download any of recent applications to see it in use in real world apps.
http://www.ohanaware.com/appwrapper/
https://itunes.apple.com/gb/app/backup-to-go-protect-your/id882272017?mt=12
https://itunes.apple.com/gb/app/shine-illuminate-photos/id504464061?mt=12

We have one more that’s awaiting review at Apple…

Thanks Sam and Norman, I’ll check it out.