Pixel/Bitmap Manipulation

Monkey Forums/Monkey Programming/Pixel/Bitmap Manipulation

AdamRedwoods(Posted 2012) [#1]
Bitmap manipulation can be done with a little mojo hacking. On screen pixel manipulation, not as easy for cross-targets, so I won't focus on that.

A few ideas I had floating around was to make DataBuffers available for all targets, not just opengl.

LoadImageData() Or GrabImage() would be key to manipulating data. Overload this function to accept another databuffer and I think this would work cleanly.

Problems arise from Html5 & Flash where data can be loaded asynchronously. How to handle this?
Preloading loops, possible.
I wonder if OnLoading() could be utilized to help preload image data: say, only use LoadImageData in OnLoading() so it can do a preloader check for async targets?

Any other thoughts?


Skn3(Posted 2012) [#2]
Why not just make it so your image manipulation functions/api only work when the passed in data buffer is flagged "loaded"?

Doesn't html5/flash targets go into the on loading loop anyways?


impixi(Posted 2012) [#3]

Why not just make it so your image manipulation functions/api only work when the passed in data buffer is flagged "loaded"?



That's all I do. I have a JavaScript 'MutableImage' class with a 'status' property. It's set to either MI_STATUS_NOTREADY, MI_STATUS_LOADING, MI_STATUS_READY, MI_STATUS_ERROR and I check it before rendering/processing.


AdamRedwoods(Posted 2012) [#4]
Why not just make it so your image manipulation functions/api only work when the passed in data buffer is flagged "loaded"?

I'm not sure what you mean? I know monkey's implementation is to use a callback for glBindTexture(), but i'd have to do that for pokefloat/peekfloat, etc. And since most image manipulation is done in a loop, I don't think this would work.

On the other hand-- if you mean to have the image manip function error out if not loaded, then that means it is up to the programmer to implement their own preload routine, and to realize that Peek/Poke will fail if the image isn't loaded on certain targets.

My thought was if we need to wait for images & such to load anyways, why not create a preloader? Monkey does not tap into HTML5's async loading, so it'd have to be native, which is why i think there should be a default preloader for all targets.


Skn3(Posted 2012) [#5]
I have not been actively using monkey for a while (in blitzmax land ATM) but I thought monkey had a OnLoading method in app?

Btw I think a monkey preloader would be good :D!


Paul - Taiphoz(Posted 2012) [#6]
Skn3 is that cos your working on your sprite animation thing ?


Skn3(Posted 2012) [#7]
Taiphoz,

Yeah hard at work on objecty! Massive grind at the moment! code code code codeeeee!