art*_*emb 5 apache-flex flash graphics actionscript bitmap
Flex 3,ActionScript 3,Flash播放器9.
我在BitmapData对象中有一张图片.还有一系列要点.我需要擦除由点指定的多边形内部的图片部分.换句话说,绘制由点指定的多边形并用透明度填充它.
关于如何做到的任何想法?
art*_*emb 10
使用以下代码:
var shape:Shape = new Shape();
shape.graphics.beginFill(0x000000, 1); // solid black
shape.graphics.moveTo(points[0].x, points[0].y);
points.forEach(function (p:Point, i:int, a:Array):void {
shape.graphics.lineTo(p.x, p.y);
});
shape.graphics.endFill();
data.draw(shape, null, null, "erase");
Run Code Online (Sandbox Code Playgroud)