Fixing Stretched Images on Stretch Mode

Is there an easy formula to fix stretched images in stretch mode?  I’m not a math guru, but I thought someone may have figure out a way to set the height and width of an image based on the ratio of screen height and width… or something along those lines.

The bottom line is, I’m using stretch and our logo is being stretched slightly in some situations and our Public Affairs team is having spasms over it.

Is there anyway to fix that?

Thanks!

John, 

Are you using the Ultimate config.lua file? If not, check out this:

http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

I think it’s probably too late in my development stage to go back and re-code for that type of config.  But perhaps - if they give me time - when I do the next revision I can take a look at doing something similar.

Hi John,

For future reference, you should not use “zoomStretch” mode… it’s far from ideal for 99% of apps, and we mostly include it for legacy purposes.

In the meantime, can you quickly confirm the values of the following on various test devices?

[lua]

display.contentHeight

display.contentWidth

[/lua]

Even in “zoomStretch” mode, these should be the same between devices. If so, you should be able to read these values…

[lua]

display.pixelWidth

display.pixelHeight

[/lua]

…and then work up a fairly simple math equation to “resize” the logo based on the ratio you determine. This way, you can continue to use the “zoomStretch” mode in this project, but the logo issue will be fixed and Public Affairs will be satisfied.

Take care,

Brent

John, 

Are you using the Ultimate config.lua file? If not, check out this:

http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

I think it’s probably too late in my development stage to go back and re-code for that type of config.  But perhaps - if they give me time - when I do the next revision I can take a look at doing something similar.

Hi John,

For future reference, you should not use “zoomStretch” mode… it’s far from ideal for 99% of apps, and we mostly include it for legacy purposes.

In the meantime, can you quickly confirm the values of the following on various test devices?

[lua]

display.contentHeight

display.contentWidth

[/lua]

Even in “zoomStretch” mode, these should be the same between devices. If so, you should be able to read these values…

[lua]

display.pixelWidth

display.pixelHeight

[/lua]

…and then work up a fairly simple math equation to “resize” the logo based on the ratio you determine. This way, you can continue to use the “zoomStretch” mode in this project, but the logo issue will be fixed and Public Affairs will be satisfied.

Take care,

Brent