How to create an image from array of pixel colors? (Flash, Actionscript 3)
Posted
by Ole Jak
on Stack Overflow
See other posts from Stack Overflow
or by Ole Jak
Published on 2010-04-15T13:14:56Z
Indexed on
2010/04/15
15:03 UTC
Read the original article
Hit count: 208
I have a Width and Height parametr. I have been given an array of colors in such format: [r, g, b, a, r, g, b, a, r, g, b, a... etc] Data can be acsessed by something like this
for(var y = 0; y < height; y++)
{
for(var x = 0; x < width; x++)
{
r = data[y*width + x + 0]
g = data[y*width + x + 1]
b = data[y*width + x + 2]
a = data[y*width + x + 3]
}
}
I want to paint that data on some sprite. How to do such thing?
BTW: I use Flash Builder for mxml+actionscript coding. So if it is easy for you you can give example using MXML (not todraw on some sprite but on some MXML component).
© Stack Overflow or respective owner