Loading trimmed sprites from ImageSheet is broken

Hi,

I’ve already raised a bug [15619], but I need a workaround now, so I thought it might be a good idea to discuss this.
What’s currently happening, is that if you want to load a trimmed image using newImageRect, the sprite will be scaled BEFORE the trimmed space is added.
You can find a simple example in here: https://www.dropbox.com/s/k5r3zij49gdpvlx/trimError.zip

I want to be able to use ImageSheets with content scaling [HD/SD] and with trimming. It seems it’s impossible at the moment. There are two ways to achieve it, and both are either broken or are missing something.
If you want to use the display.imageSuffix to load proper imagesheet definition, you have to use newImageRect to load images, and as described above, it is broken.
I’ve also tried to create a HD imagesheet with coordinates divided in half and manually resized the HD imagesheet by half. Everything is cool, however when you end up with images, which have either width or height or sourceX or sourceY or sourceWidth or sourceHeight value odd, you will end up with your image cut by 1-3 pixels. I’ve already asked author of TexturePacker to include option to always output even numbers for these values, but this might take some time.

Does anyone have any other way to easily use imagesheets with trimmed sprites?
I am unable to load the imagesheet and set the scale manually in corona, since in my game there is a lot of scaling going on and it would be a chaos if I would try to add checks everywhere if the xScale should be set to 1 or 0.5 etc.

Thanks,
Krystian [import]uid: 109453 topic_id: 28513 reply_id: 328513[/import]

Followup:
I have found a workaround: if you want trimming to work ok you will have to use newSprite instead of newImage.
Like with newImage, you have to get the frame number, so it’s just a little change to your wrapper function to something like:

return display.newSprite(imgSheet, {name="whatever", start=frame, count=1}) [import]uid: 109453 topic_id: 28513 reply_id: 115314[/import]