How to create multi-resolution (Retina-ready) NSImage programmatically at runtime?
===

I have two button images, say "myButton.png" and "myButton@2x.png" in my app's bundle resources. At run time, I load the image using [NSImage imageNamed:@"myButton"] and need to split it into three slices and create three NSImages to use in NSDrawThreePartImage() function.

The problem is that each slice NSImage needs to be multi-resolution, so that the system could pick the right resolution dynamically, as it would automatically do with the original whole image.

How do you create the automatic multi-resolution NSImage programmatically? Thanks!