Feature request .ReadPixels

Monkey Forums/Monkey Bug Reports/Feature request .ReadPixels

Markus(Posted 2013) [#1]
CLASS Image have
WritePixels : Void ( pixels:Int[], x:Int, y:Int, width:Int, height:Int, arrayOffset:Int=0, arrayPitch:Int=0 )

i need the counterpart (not GrabImage)

pixels:Int[]=img.ReadPixels:Int[]( x:Int, y:Int, width:Int, height:Int, arrayOffset:Int=0, arrayPitch:Int=0 )

also im confused why ReadPixels can read the backbuffer but
WritePixels can't.

(i using 73b)


Gerry Quinn(Posted 2013) [#2]
I'm guessing it's because image format and memory space may be different on different platforms.

As for WritePixels, having to read the backbuffer into an int array has the advantage that you can then process the array and use WritePixels to feed the results into an image anytime.

Also, it may be that in some targets the backbuffer has no transparency. In this case ReadPixels is limited compared to WritePixels as ReadPixels cannot provide an alpha channel.

What you might want to consider is writing/finding code to directly read one of the simpler image formats (or a very simple home-made one) from a file into an int array.


Markus(Posted 2013) [#3]
@Gerry Quinn
i think the same, but then the returned pixel data can be the same
as used or maybe with a simulated alpha chanel.

i just want malipulate the image pixels on the fly in a tool.

i want convert the black image pixels automatically to dark grey because
my bmp export use black i need as "transparent" color later in other app.

my loaded pics are all .pngs, SaveImage (as png) i missing also,
its not there because its not part of the google game kit i believe.

this my tool i am working on:
https://docs.google.com/file/d/0B942ivL2fTGcYlVxNkd5OWg1YlE/edit?usp=sharing

i do not die if i don't get this feature but it would be nice to have it generally :)


dragon(Posted 2013) [#4]
yes, i need also readpixels...

i want to "de-scramble" my protected image after it is loaded

my images are big 1024x1024
so it is possible that backbuffer is smaler than my image.

And alpha must work.


Gerry Quinn(Posted 2013) [#5]
You can always render the images to the backbuffer in pieces. You can also convert the alpha channel into a separate image, or part of the same image (indeed, if you are scrambling it, why not just separate the channels as a stage in the scrambling?)


samowitsch(Posted 2013) [#6]
@Markus
i am confused too. i also want img.ReadPixels() ;o)

other posts with the same topic:
http://www.monkeycoder.co.nz/Community/posts.php?topic=3848
http://www.monkeycoder.co.nz/Community/posts.php?topic=4165


Samah(Posted 2013) [#7]
@dragon: i want to "de-scramble" my protected image after it is loaded

If someone wants your image, they'll get it.


Gerry Quinn(Posted 2013) [#8]
If someone wants to steal my stuff, they'll get it. I still have a door key.

I wouldn't spend much effort on protection but if a little makes you feel better, why not go for it? At a small cost to you it puts obstacles in the way of people who would copy your assets, and also they can't pretend they didn't know the assets were not public domain.


computercoder(Posted 2013) [#9]
Both side to the arguement are true, but I tend to lean towards the side of at least trying to secure my stuff. I sleep better knowing I tried to protect myself vs just leaving the door open for anyone to waltz in and grab what they like. Locks are made to keep honest people honest, and make the dishonest have something at least a little challenging to overcome before they get whats there.