简体   繁体   English

从Shape中提取位图(或bitmapdata)

[英]Extract bitmap (or bitmapdata) from Shape

I got an swf that has SimpleButtons in the stage, and I need to get the bitmap or bitmapdata information from the button states. 我在舞台上有一个包含SimpleButtons的swf,我需要从按钮状态获取位图或位图数据信息。

When I load the symbol, it seems that no matter what composes the button states, they are all shapes, at least that's what I get in the expression panel. 当我加载符号时,似乎无论组成按钮状态的是什么,它们都是形状,至少这是我在表达式面板中得到的。

So, how can I get the bitmap or bmpdata from a Shape?. 那么,我如何从Shape获取位图或bmpdata?

Thanks. 谢谢。

You can use BitmapData#draw() to get BitmapData from any DisplayObject . 您可以使用BitmapData#draw()从任何DisplayObject获取BitmapData BitmapData is raster, so be aware you will lose features of the vector Shape BitmapData是栅格的,因此请注意,您将丢失矢量Shape

var bd:BitmapData = new BitmapData( shape.width, shape.height );
bd.draw( shape );

如果你的目标是FP 11.6,我会使用这里解释的方法graphics.readGraphicsData http://www.bytearray.org/?paged=6

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

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