Feed image data into DataBuffer?

Monkey Forums/Monkey Programming/Feed image data into DataBuffer?

Lillpeter(Posted May) [#1]
Hi everyone! I've been looking for a solution to this problem but have yet to find it. What I want to do is feed the pixel data from an Image object into a DataBuffer object before writing/saving it to a file (I'm making my own file format for use within a project).

I have a simple function that use the LoadImageData command to load an image from disk directly into an int array which I can then easily feed into a DataBuffer using a For loop and PokeInt. But is there a way of doing that with an already loaded image?


Gerry Quinn(Posted May) [#2]
You can draw the image and use ReadPixels(), though that won't get you the alpha directly. Maybe drawing the image black on a white buffer would allow you read off the negative of alpha.