egret学习日记2图像绘制及高级图像

来源:互联网 发布:mac地址修改器.exe 编辑:程序博客网 时间:2024/06/17 02:08

图像的绘制用到了Graphics 类

Graphics 类包含一组可用来创建矢量形状的方法。支持绘制的显示对象包括 Sprite 和 Shape 对象。这些类中的每一个类都包括 graphics 属性,该属性是一个 Graphics 对象。以下是为便于使用而提供的一些辅助函数:drawRect()、drawRoundRect()、drawCircle() 和 drawEllipse()。

 shape.graphics.clear();//清除绘制到此 Graphics 对象的图形,并重置填充和线条样式设置。
        shape.graphics.lineStyle(3, 0xff0ff0);//设置宽度,颜色
        shape.graphics.moveTo(this._startShape.x, this._startShape.y);//起点
        shape.graphics.curveTo(this._control.x, this._control.y, this._anchor.x, this._anchor.y);//使用当前线条样式和由 (controlX, controlY) 指定的控制点绘制一条从当前绘图位置开始到 (anchorX, anchorY) 结束的二次贝塞尔曲线。