Gideros now comes with the ability to save the content of a render target to a file, either in .png or .jpg format.
First thing that comes to my mind with this new feature (beside the specific case for which I actually needed it), is that it allows to save a screen shot of your app, just a part of it, or even a not displayed compisition of sprites, to a temporary file for later upload to some website or facebook.
It can also be used for dynamic texture creation, for exemple to generate different versions of a base texture at run time, possibly through shaders. The app package will then be smaller and textures can be generated on first launch.
Exemple: to make a screenshot, you could do:
local rt=RenderTarget.new(application:getContentWidth(),application:getContentHeight())
rt:draw(stage)
rt:save("|T|screenshot.png") |
I hope you'll find it useful!
Comments
Likes: hgy29, keszegh, pie, MoKaLux
I notice a tiny drawback of the draw api of RenderTarget.
when draw a sprite, it always starts from the position(0,0),it's not possible to draw the whole device screen if the Logical Translate is not 0 on some devices.
It would be useful to add extra parameters x, y to the draw api.
Likes: totebo
Likes: totebo, pie
Now you can create a repeatable rendertarget by setting the fourth argument to true:
Likes: pie, totebo, SinisterSoft, MoKaLux
Likes: MoKaLux