简体   繁体   English

有没有办法获取Flare3D的屏幕截图?

[英]Is there any way to get the screenshot of Flare3D?

I want to save Flare3d scene as a png file using actionscript 我想使用ActionScript将Flare3d场景另存为png文件

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 BitmapData的最后一个属性是填充颜色,它将填充您所说的内容

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); 简单,只需在scene.context.clear(0,0,0,0);中设置零alpha

Of course, you already correctly set BitmapData to transparent and 0 fill color. 当然,您已经正确地将BitmapData设置为透明和0填充颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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