AS3 でリトルエンディアン ByteArray をビッグエンディアンに変換する方法は? bitmapData をビッグエンディアンの ByteArray に変換し、Adobe Alchemy を使用してメモリにプッシュします。そして、メモリから読み取ると、リトル エンディアンの ByteArray が得られます。ビッグエンディアンを取得する方法。
このコード例を使用しますhttp://blog.debit.nl/2009/03/using-bytearrays-in-actionscript-and-alchemy/ (Actionscript で直接アクセスする C でのメモリ割り当て (FAST!!))
コード:
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;