According to the docs, dynamic scaling is applied using the calculation: display.pixelWidth / display.actualContentWidth
This is equivalent to the config settings @2x etc that you configure
---- see docs
In addition to dynamic scaling, Corona supports dynamic image selection. If you are developing an app for both normal and “Retina/HD” devices, you should not rely on Corona to simply scale one set of images across a wide array of screen resolutions. There are several issues related to this:
-
If you design all of your images in low resolution and allow Corona to scale them up for Retina/HD devices, the images will appear blurry or pixelated. Not only will this result in poor visual appearance, but it may cause the app to be rejected before it reaches the marketplace.
-
In contrast, if you design all of your images for Retina/HD and allow Corona to scale them down for lower resolution devices, the larger images will require the same amount of texture memory on those devices. This may adversely affect the performance of your app — or worse, those images will not appear if they exceed the maximum texture size on a device.
The solution is to create multiple versions of every image, tailored for two or three different resolutions, and name them according to the “image set” they belong to. On each device, Corona will automatically select images from the set that most closely matches the content area and scale.
Important
This feature is only supported by images displayed using display.newImageRect() or by sprites and images taken from image sheets that contain the overall sheet size parameters.
To set up dynamic image selection, you must include an imageSuffix table within the content table. Inside this table, declare at least one key-value pair consisting of an image suffix and a scale factor.
imageSuffix =
{
["-small"] = 0.375,
["@2x"] = 1.5
}
As indicated, each image suffix must be specified within brackets and quotes as in ["@2x"]. The suffix can be named whatever you want, but it should be short and logical since you must append the same suffix to all image files designed for that image set. When adding a suffix to each image file, do not include the bracket or quotes — just append the suffix itself, for example myImage-small.png or myImage@2x.png.
The second part of each declaration is the scale factor. This value specifies the scale threshold above which Corona will use images in that suffix set. The following code can help you determine the proper values:
print( display.pixelWidth / display.actualContentWidth )
Add this code to your project, access the Corona Simulator, and use Window → View As to simulate different devices. Note the output in the Terminal/console — this is the scale factor for the device. If the value on a particular device is greater than or equal to the number you specify for the scale factor, Corona will use images from that suffix set.