How to determine scale factor

It says here in http://blog.anscamobile.com/2011/01/dynamic-image-resolution-made-easy/ that

The base 320 x 480 stage size given above will be upscaled by at least a factor of 1.875 on a 7″ tablet

Anyone know how this scale factor is calculated? For Instance, my Nexus' resolution is 480 x 850 How do I calculate scale factor from this? (assuming my base resolution is 320 x 480)

The math itself is simple division however it can get a little complicated when you throw in aspect ratios. The most common resolutions and aspect ratios you will deal with are below.

320x480 = 3:2 (iPhone, iPhone 3G, iPhone 3GS)

480x800 = 16:10 (Many Android phones have this resolution including the Nexus One)

480x854 = 16:9 (Many Motorola Android phones have this resolution)

540x960 = 16:9 (A few Android phones use this resolution, mostly Motorola phones)

640x960 = 3:2 (iPhone 4, iPhone 4S)

600x1024 = 16:9 (This is primarily seen with netbooks and 7 inch tablets)

768x1024 = 4:3 (iPad, iPad 2)

720x1280 = 16:9 (Several new high end Android phones use this resolution)

800x1280 = 16:10 (Most Android 10.1 and 8.9 inch tablets use this resolution)

To determine scaling you would divide the resolution you are scaling to by your base resolution. The case you mention would be 480/320 = 1.5 and 800/480 = 1.6 (well technically it's 1.666666666666667). So the minimum scaling would be 1.5x and max scaling would be 1.6x. Whether the scaling is 1.5x or 1.6x will depend on what scaling mode you use.
Details about scaling modes can be found here - http://developer.anscamobile.com/content/configuring-projects#Runtime_Configuration:_config.lua

Another great article about dynamic image resolution can be found here - http://www.base2solutions.com/walkabout/Corona%20Tips.html

Thanks for the info.. Helped a lot!
And I have seen that base2solutions link before..
It IS pretty useful!

You can get these scales via the following properties...
- display.contentScaleX
- display.contentScaley

Please see the following API documentation...
http://developer.anscamobile.com/reference/index/displaycontentscalex

Uhm, I think you are greatly confusing aspect ratio with how dynamic image resolutions works.

views:1692 update:2011/12/28 9:26:54
corona forums © 2003-2011