flash Graphics与GraphicsPath的区别——填充方式的改变!

本文介绍了使用ActionScript 3.0进行图形绘制的方法,包括如何创建矩形和自定义形状,并通过实例展示了不同绘图命令的效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

废话不多说

var my:Sprite = new Sprite(); addChild(my); my.graphics.beginFill(0xff0000,.8); my.graphics.drawRect(100,100,100,100); my.graphics.endFill(); my.graphics.beginFill(0xff0000,.8); my.graphics.drawRect(150,150,100,100); my.graphics.endFill();

效果:overlaped

var my:Sprite = new Sprite(); addChild(my); my.graphics.beginFill(0xff0000,.8); my.graphics.drawRect(100,100,100,100); my.graphics.drawRect(150,150,100,100); my.graphics.endFill();

subtraction

var my:Sprite = new Sprite(); addChild(my); my.graphics.beginFill(0xff0000,.8); var commandsPath:Vector.<int> = new Vector.<int>(10); commandsPath[0] = GraphicsPathCommand.MOVE_TO; commandsPath[1] = GraphicsPathCommand.LINE_TO; commandsPath[2] = GraphicsPathCommand.LINE_TO; commandsPath[3] = GraphicsPathCommand.LINE_TO; commandsPath[4] = GraphicsPathCommand.LINE_TO; commandsPath[5] = GraphicsPathCommand.MOVE_TO; commandsPath[6] = GraphicsPathCommand.LINE_TO; commandsPath[7] = GraphicsPathCommand.LINE_TO; commandsPath[8] = GraphicsPathCommand.LINE_TO; commandsPath[9] = GraphicsPathCommand.LINE_TO; var dataPath:Vector.<Number> = new Vector.<Number>(20); dataPath[0]=100; dataPath[1]=100; dataPath[2]=200; dataPath[3]=100; dataPath[4]=200; dataPath[5]=200; dataPath[6]=100; dataPath[7]=200; dataPath[8]=100; dataPath[9]=100; dataPath[10]=150; dataPath[11]=150; dataPath[12]=250; dataPath[13]=150; dataPath[14]=250; dataPath[15]=250; dataPath[16]=150; dataPath[17]=250; dataPath[18]=150; dataPath[19]=150; my.graphics.drawPath(commandsPath,dataPath,GraphicsPathWinding.NON_ZERO); my.graphics.endFill();

NON_ZERO

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值