AS3 JPGEncoder: I don't want black background
I have the following code to create a jpg file from a movieclip:
var translateMatrix:Matrix = new Matrix();
translateMatrix.scale(1, 1); // (0.746, 0.746);
translateMatrix.translate(100, 150);
var myBitmap:BitmapD开发者_Python百科ata = new BitmapData(500, 500, false, 0x00000000);
myBitmap.draw(muneca, translateMatrix, null, "normal", null, true);
var encoder:JPGEncoder = new JPGEncoder(80);
var byteArray:ByteArray = encoder.encode(myBitmap);
var file:FileReference = new FileReference();
file.save(byteArray, "photo.jpg");
However, the transparent parts of the movieclip (background) are black in the final jpg. How can I transform those black parts into white?
Thank you very much
Initialize BitmapData with white :
var myBitmap:BitmapData = new BitmapData(500, 500, false, 0xFFFFFFFF);
精彩评论