How to copy a TImage?

BlitzMax Forums/BlitzMax Beginners Area/How to copy a TImage?

jondecker76(Posted 2010) [#1]
Does anyone know of an efficient way to copy a TImage?

Right now, i'm using:
local imageCopy:TImage = loadimage(lockimage(originalImage))


..which diesn't seem very efficient!

thanks


Czar Flavius(Posted 2010) [#2]
You could load the image file into a pixmap, and then loadimage twice from that pixmap.


ImaginaryHuman(Posted 2010) [#3]
DrawImage
GrabImage


jondecker76(Posted 2010) [#4]
i ended up sticking with the method I posted above.. I got to testing it, and even though I'm doing it at full framerate, it hasn't slowed my application down at all, and I'm still maxed at my monitor refresh rate!


Jesse(Posted 2010) [#5]
if all of your images are of format rgba and of the same size it can be as simple as
MemCopy(DestPixmap.pixels,sourcePixmap.pixels,sourcePixmap.width*sourcePixmap.height*4)

edited corrected


Oddball(Posted 2010) [#6]
Local imageCopy:TImage = LoadImage(originalImage.pixmaps[frame])
That's about as efficient as you can get.


Czar Flavius(Posted 2010) [#7]
Are you modifying these copies? Why not just display the original?