开发者

AS3 JPGEncoder: I don't want black background

开发者 https://www.devze.com 2023-03-10 03:21 出处:网络
I have the following code to create a jpg file from a movieclip: var translateMatrix:Matrix = new Matrix();

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消