zoomStretch not working on HTC Droid [edit] it works

Originally we were using letterbox for our scale setting in config.lua. This works well for iOS builds, but when running on Android devices like the HTC Inspire we had issues with images appearing in the black bands on either side.

An easy way to reproduce this is to just increase the xScale on an image the is on the right side of the screen. You will see the image stick out into the black band on the right side.

To get around this I followed the content scaling suggestions in the forums and switched to zoomStretch for Droid devices. This works perfectly in the simulator if select “view as” Droid. However, when you run the app on a the HTC droid phones the content does NOT get stretched all the way to the edges of the device display. Then when I scale my image it is showing to the right of the background.

If zoomStretch is supposed to stretch full sized content to the entire display then it doesn’t appear to be working properly.

I am using Build 703 [import]uid: 16734 topic_id: 18852 reply_id: 318852[/import]

There are a lot of variables going on so you need to file a bug report with a small project demonstrating the problem.

We don’t recommend using zoomStretch because it could distorts objects (e.g., circles become oval) on some devices. If you use letterBox, you can manage image placement with display.viewablecontentWidth and Height. [import]uid: 7559 topic_id: 18852 reply_id: 72737[/import]

Tom,

I’d love to use letterbox, but there is a problem with letterbox. As I mentioned, if you have an image and scale it, it extends into the black bands of the letterbox. This is the ONLY reason we want to switch to zoomStretch.

[edit] It looks like the issue is due to system.getInfo(“model”) returning something unexpected. I (mistakenly) thought it would return Droid based on what the Ansca docs say and what the simulator returns. It returns PC36100 for model type. Guess I can use platform name instead. [import]uid: 16734 topic_id: 18852 reply_id: 72749[/import]

Tom,

None of the above resolves the original bug. Take an image that is drawn from the middle of the screen with a width of (display.contentWidth/2). It aligns nicely with the edit of my background and just before the black band on the right.

Now change the image.xScale to 2.

Guess what happens? The image is now draw into the black letter box borders!

This is a bug. This needs to be fixed or you cannot use scaling as it would draw your image outside of the display content area.

If you know of a work around I would appreciate hearing about it. [import]uid: 16734 topic_id: 18852 reply_id: 72771[/import]

Ken,

You need to understand how dynamic scaling works. If you select letterbox mode, your content will be scaled correctly when your app is loaded and everything will fix within the letterbox values. If you start scaling objects larger and they are near the edges of your letterboxed screen, they will extend into the borders. Corona gives you the freedom to scale and postion your content however you like. It also gives you APIs to determine what the viewable area is so that an be managed.

If Corona restricted your app into the letterboxed area, you would have black bands on two sides of your app (on scaled devices), which may not be what you want. The way it’s designed, you can fill those black bands with a background image to avoid that problem. [import]uid: 7559 topic_id: 18852 reply_id: 72777[/import]

Tom,

Okay, so now I understand how it works. However, since I cannot mask out those black borders how am I supposed to support a zoom mode without worrying about the zoomed image going into the borders? I was treating letterbox like a movie would; where NOTHING gets drawn outside the content area. This is my mistake and now I just need to find a solution to my original issue with scaled images.

Ideally I would just apply a mask to my zoomed image, but there appears to be a bug with masks on scaled images (which I have reported elsewhere).

As for just drawing my background into those areas, isn’t that what zoomStretch will do for me? Or are you suggesting I use display.newRect() to create my own black borders and draw those on top of my scaled image?

BTW, I really do appreciate the responses. Often it takes a while to hear anything back, but I realize the Ansca team is busy working on new features and fixing bugs.

[import]uid: 16734 topic_id: 18852 reply_id: 72822[/import]