【问题标题】:Is there any way to get the screenshot of Flare3D?有什么办法可以得到Flare3D的截图吗?
【发布时间】:2013-01-04 17:47:58
【问题描述】:

我想使用 actionscript 将 Flare3d 场景保存为 png 文件

这是我尝试过的,我可以保存文件,但图像不透明(它显示黑色背景),我想删除它

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

有没有更好的方法来获得透明图像

谢谢

【问题讨论】:

  • 其实跟flare3d没什么关系,纯as3。

标签: actionscript-3 flash-cs5 flare flare3d


【解决方案1】:

它实际上创建了透明图像

BitmapData 的最后一个属性是填充颜色,它会填充你所说的内容

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

它现在将填充白色背景

【讨论】:

    【解决方案2】:

    简单易行,只需在 scene.context.clear(0,0,0,0) 中设置零 alpha;

    当然,您已经正确地将 BitmapData 设置为透明和 0 填充颜色。

    【讨论】:

      猜你喜欢
      • 2023-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-12
      • 2014-07-01
      • 2022-01-26
      • 2012-09-26
      • 2011-11-14
      相关资源
      最近更新 更多