Thank you , i will try it tommorrow and let you know if that worked.
I am just wondering if there is no begin offset in the ByteArray. So
maybe I should not start at position=0.
Do you know something about that, anyway I will try and see tomorrow.
Jiri
Juan Pablo Califano wrote:
Have you tried something like this?
var pixelPos:int = col + row * totalCols; // or x + y * width
buffer.position = pixelPos * 4; // each pixel takes 32 bits ==> 4 bytes
var pixelValue:uint = buffer.readUnsignedInt();
Or, if the order is column-major (but I don't think it is)
var pixelPos:int = row + col * totalRows; // or y + x * height
buffer.position = pixelPos * 4; // each pixel takes 32 bits ==> 4 bytes
var pixelValue:uint = buffer.readUnsignedInt();
Cheers
Juan Pablo Califano
2009/3/17, Jiri <[email protected]>:
Seems that the encoder use the BitmapData.getPixel(). So that doesnt give
me the insight I am hoping for :(
J.
Romuald Quantin wrote:
I guess you need some kind of specification, how the bytes for a
bitmapdata are created and stored.
I have no idea if you can find that.
Basically they're doing that in the JPGEncoder andPNGEncoder?
You might want to see what they're doing to get some details about what is
stored and where.
http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/JPGEncoder.as
http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/PNGEncoder.as
Romu
Jiri wrote:
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
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders