In brief:
- landscape mode using zoomEven
- specifically for tablets
- have display object smaller than screen where user draws a picture
- saving to drive, reloading image, and placing it on a ‘desktop’ as an icon
I’m using the new captureBounds feature to grab that section where this display object containing the drawing resized (reason to not save display group: when being drawn on, can change width or height dynamically if someone draws to close to the edge and needs to be cropped before saving to keep all images the same size)
This all works, BUT, the image is somehow getting stretched during save. It looks fine on the screen, saves out, gets pulled back in fine, but the bottom is cropped off a bit and it’s a tad taller than it should be. If I pull it up and edit it again, and save it again, it stretches a little more. Here’s the save function:
local contentBounds = {xMin = 10,yMin = 10,xMax = display.contentWidth-offsetWidth,yMax = display.contentHeight-offsetHeight}
local capture = display.captureBounds(contentBounds, false)
display.save(capture, fileName, system.DocumentsDirectory)
Like I said, it works and I can tell by the pulled in image that the crop is the right size. Why oh why is my display object stretching out under this crop as it’s being saved??? The display object is just like any display object… nothing unusual about it – just has some vectors in the group.
Also, I came up with a hack for something lacking in Corona. If you’re using storyboard, and saving images that needs to be refreshed in the UI. Make a separate storyboard scene to go to from the screen you need to refresh. On save, send the scene you want to return to as a var like storyboard.returnScene = “scenename” and use it in the goto in the dummy scene. It will go there, pause, then come back ( I have a delay as that seemed to work best). This forces the texture memory to dump, apparently. Anyway, it’s working for me so far. If someone has a better way I would bow before you in worship!
By the way, I was having stretch issues before I discovered this storyboard trick. I’ve never NOT had stretch issues.
Thanks for looking. [import]uid: 169520 topic_id: 30199 reply_id: 330199[/import]