以下是代码片段:
AS 方面:(img 是对<Image>实例的引用)
        bitmapData = Bitmap(img.content).bitmapData;
        var pixels:ByteArray = bitmapData.getPixels(bitmapData.rect);
        pixels.position = 0;
        var output:ByteArray = new ByteArray();
        img_width = bitmapData.width;
        img_height = bitmapData.height;
        ////invoke C code by alchemy
        lomoEncoder.encode(pixels, output, img_width, img_height);
        var newImage:Image = new Image();
        //can't show the image
        newImage.source = output;
C代码:
AS3_Val dest;
AS3_Val source;
unsigned char* pixels = (unsigned char *)malloc(Size);
AS3_ByteArray_readBytes(pixels, source, Size);
pixels = darkCornerLomoEffect((unsigned char*)pixels, image_width, image_height);
AS3_ByteArray_writeBytes(dest, (char*) pixels, length);
在 AS 端,当dest从 C 中获取时,loader.load(dest) 抛出一个错误:Unhandled IOErrorEvent:。文本=错误 #2124。那么如何处理 byteArray 格式,以便 AS 端可以重组并用作Image源属性呢?