简体   繁体   中英

Is there any way to get the screenshot of Flare3D?

I want to save Flare3d scene as a png file using actionscript

this what I have tried , i am able to save file but image is not transparent(it is showing black background) which i want to remove

var bmpd:BitmapData = new BitmapData(scene.viewPort.width, scene.viewPort.height,true,0x00000000 );
scene.context.clear();
scene.render();

scene.context.drawToBitmapData( bmpd );

var ba:ByteArray = PNGEncoder.encode(bmpd);

var file:FileReference = new FileReference();
file.addEventListener(Event.COMPLETE, saveSuccessful1);

file.save(ba, "image3d.png");

使用此代码保存的图像

is there any better way to this to get transparent image

thanks

It actually created transparent image

The last property of BitmapData is fill color, which will fill with what ever you said

var bmpd:BitmapData = new BitmapData(scene.viewPort.width, scene.viewPort.height,true,0xFFFFFF );

It will fill with white background now

Easy peasy, just set zero alpha in scene.context.clear(0,0,0,0);

Of course, you already correctly set BitmapData to transparent and 0 fill color.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM