How to convert Little-endian ByteArray to Big-endian in AS3? I convert bitmapData to Big-endian ByteArray and then push it into memory with Adobe Alchemy. And then when i read it from memory i get Little-endian ByteArray. How to get Big-endian.
I use this example code http://blog.debit.nl/2009/03/using-bytearrays-in-actionscript-and-alchemy/ (Memory allocation in C with direct access in Actionscript (FAST!!))
Code:
var ba:ByteArray = currentBitmapData.getPixels( currentBitmapData.rect );
ba.position = 0;
var ns:Namespace = new Namespace("cmodule.al_exam");
var data:ByteArray = (ns::gstate).ds; //point to memory
_dataPosition = lib.initByteArray(ba.length); //This is the position of the data in memory
lib.writeData(ba); //example function to write data in C
data.position = _dataPosition; //reset position
// get noise, not image
bmd.setPixels(currentBitmapData.rect,data);
myBitmap.bitmapData = bmd;