Why is zoomStretch discouraged?

I think it may be the only solution to my problem. I have a client that wants to port an iOS app to Android. I convinced them to use Corona.

Since it was developed originally for the iPhone 3Gs, most of their app screen images are full 480x320 backgrounds with buttons burnt in. Now they need to support multiple devices, so I can scale the background to content width and height, but will still end up with with black bars if I use letterbox or zoomEven.

I don’t think zoomStretch looks that bad between the various devices. What am I missing? It’s the only option that fills the screen on every device. [import]uid: 58455 topic_id: 24444 reply_id: 324444[/import]

Hey there,

Basically zoomStretch is discouraged because on some devices with different aspect ratio.

For example if you put a circle on the screen on a screen that is (purely random examples) 300x500 it will look like an oval on a screen that is 400x900.

Does that make sense? [import]uid: 52491 topic_id: 24444 reply_id: 98957[/import]

I get that, but in my case, everything needs to appear on the screen because the buttons are part of the background image.

I think I have two options with my client if they don’t want to see the black bars: 1) use zoomStretch so we’re guaranteed to have everything show up on every device, even if a bit distorted, and 2) have them re-do their graphics, creating all buttons as separate images.

Also, am I missing something with autoscaling? If I load my background image with display.newImage(imagenm), it doesn’t scale to fit the display, I have to do that manually by setting xScale and yScale. I thought it would autoscale unless I called newImage(imagenm, true). [import]uid: 58455 topic_id: 24444 reply_id: 98971[/import]

You asked why it was discouraged and that is why. We aren’t telling you not to use it, only explaining why in many cases we’d encourage alternatives for the best results :slight_smile:

I would think your background image should scale if loaded using newImageRect and zoomEven, is this not the case? [import]uid: 52491 topic_id: 24444 reply_id: 99065[/import]

I hear you and agree with you, I just have to convince my client to re-do their images.

Re: autoscaling, I was referring to display.newImage. My 570x360 image doesn’t scale down whether I use letterbox, zoomEven, or zoomStretch. Rolled back to build 704a, same behavior.

http://developer.anscamobile.com/content/display-objects#Image_Autoscaling [import]uid: 58455 topic_id: 24444 reply_id: 99073[/import]

Your client may not like this solution. However, I have found the best way to handle it, to look (dimensionally) correct on all devices, is to use letterbox. Then extending the background by filling the black bars in. Usually with rects matching my background color. This can be done on the fly at startup. For a more complex background you can use additional images that match the design.

In the long run letterbox will also probably save you grief if the buttons are burnt into the background. Calculating where the buttons may end up if they get stretched would seem like an impossibility. With letterbox, everything is the same code wise, Corona handles the scaling. A button will always be in the same x/y range.

Not knowing what the background actually is for your client’s app, it may not be as easy as creating a color filled rect. However even having images to extend it could be less work/time/money than creating the entire background over and over for several different device sizes.

No matter what you do, if your dealing with Android your going to run into sizes that don’t fit your background size. There is no standard across the board for Android. Motorola likes making phones with extended heights. Tablets range all over the place.

In the end, show the client what zoomstretch would look like on a device or two. If they are ok with it, theres your answer. Some people don’t notice things, others are very observant. I can only speak for myself. Even if I can’t say why something like this looks odd, I would probably think, something is not right.

Hopefully my 2 cents plus an addition 2 cents are useful. :slight_smile: [import]uid: 56820 topic_id: 24444 reply_id: 99078[/import]

Thanks, anderoth! That’s exactly what I did - sent the screenshots of zoomStretch with squished buttons, and letterbox with the black bars. I can’t easily fill the black bars with rects because the images are patterned.

Just a few minutes ago, I sent them screenshots of a demo using this method:

http://developer.anscamobile.com/forum/2012/03/12/understanding-letterbox-scalling

No black bars, no distorted buttons, spacing remains the same relative to each other on every device. The only drawback for them is it may be harder to create the artwork, but when one of the requirements is “must look the same on all devices”, this is their only choice.

[import]uid: 58455 topic_id: 24444 reply_id: 99089[/import]

Yep that’s more or less how I handle iOS devices. However they are predictable sizes.

Android I just am not sure will be so easy. I havn’t given it a lot of thought lately. Six months or so ago I was moving an app from iOS to Android and found a bigger background itself didn’t solve every issue. Still needed some patch work here and there. Way too many cheapo Android devices out there with odd dimensions.

If the client’s main targets are Kindle Fire and Nook, then you are back to predictable dimensions. [import]uid: 56820 topic_id: 24444 reply_id: 99095[/import]