Hi, >From the docs:
Generates a byte array from a rectangular region of pixel data. Writes an unsigned integer (a 32-bit unmultiplied pixel value) for each pixel into the byte array. http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html The resulting byte array is a flat array, where each pixel takes 4 bytes. I think the pixels are stored in row-major order ( http://en.wikipedia.org/wiki/Row-major_order), but I'm not 100% sure. You could try it drawing a 4 px bitmap with 4 different colors y check how data is laid out with a debugger (or even just a trace). It shouldn't be too hard to acces the data directly, though I'm not sure if it's going to be faster. The best you can do is time both options and see what's faster. On the other hand if you only have to store one value per pixel and you're concerned about memory usage, you could try using a Bitset / Bitvector. Cheers Juan Pablo Califano 2009/3/17, Jiri <[email protected]>: > > Hello, > > I have a BitmapData and use the draw() method to add sprite data. Then I > get the ByteArray through the BitmapData.getPixels() method. This byteArray > is compressed and cached. > > Then when i need it, i decompress the ByteArray and use the > BitmapData.setPixels() and add all that to a new Bitmap() > > Next I use the Bitmap.getPixel(MouseX , MouseY) to check if the pixel is > white or not. White meaning I cannot 'walk' there. > > My question is, can I skip the adding of the ByteArray to the Bitmap and > directly access the value corresponding to the x and y in the ByteArray. > > This would probably save me some computation time. > > How are the bytes stored, is it a multi dimensional array and if so, what > is the colum size? > > Thank you, > > Jiri > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

