Page 1 of 1
Creating Image(s) on the fly
Posted: Thu Jun 30, 2011 12:12 am
by chrism
Is it possible to create Image objects on the fly and draw/blt on them? I could be missing something obvious here; I see there is love.image.newImageData, but it's unclear to me how you can draw or blit onto that image. Thanks.
Re: Creating Image(s) on the fly
Posted: Thu Jun 30, 2011 1:32 am
by Kadoba
Sort of.
Framebuffers would be best suited for what you're describing. Although framebuffers tend to break older hardware.
Alternatively if you really, really want to use images you can save the image data when you load it and then just paste what you want into a screen-sized image data and then turn it into an image and draw it. That is probably a bit slow though depending on your screen scaling and resolution.
Re: Creating Image(s) on the fly
Posted: Thu Jun 30, 2011 4:38 am
by BlackBulletIV
There are two ways to draw to ImageData objects. You can play with individual pixels, in which case
ImageData:setPixel,
ImageData:mapPixel, and
ImageData:getPixel are your friends. You can also paste other ImageData objects into an ImageData object using
ImageData:paste.
Re: Creating Image(s) on the fly
Posted: Thu Jun 30, 2011 6:53 pm
by chrism
This might be good enough for my current purposes. Thanks. It would be great if the "draw" functions in love.graphics were replicated for images as well...
Re: Creating Image(s) on the fly
Posted: Thu Jun 30, 2011 9:14 pm
by bartbes
Framebuffers exist for this very reason.