import { Component } from "../../core/Component" ; import { Graphics , Point } from "pixi.js" ; export class Canvas extends Component { private mGraphics ! : Graphics ; draw ( ) { if ( ! this . mGraphics ) { this . mGraphics = new Graphics ( ) ; this . addChild ( this . mGraphics ) ; } } getDisplayComponent ( ) { return this . mGraphics ; } /**
     * 清除绘制内容
     */ clear ( ) { this . mGraphics . clear ( ) ; } /**
     * 对自上一次调用beginFill（）方法以来添加的线条和形状应用填充。
     */ endFill ( ) { this . mGraphics . endFill ( ) ; } closePath ( ) { this . mGraphics . closePath ( ) ; } param width param color param alpha param alignment param native lineStyle ( width ? , color ? , alpha ? , alignment ? , native ? ) { this . mGraphics . lineStyle ( width , color , alpha , alignment , native ) ; } param x param y lineTo ( x , y ) { this . mGraphics . lineTo ( x , y ) ; } param x param y moveTo ( x , y ) { this . mGraphics . moveTo ( x , y ) ; } param cx param cy param radius param startAngle param endAngle param anticlockwise arc ( cx , cy , radius , startAngle , endAngle , anticlockwise ? ) { startAngle = ( Math . PI * 2 ) * ( startAngle / 360 ) ; endAngle = ( Math . PI * 2 ) * ( endAngle / 360 ) ; this . mGraphics . arc ( cx , cy , radius , startAngle , endAngle , anticlockwise ) ; } param x1 param y1 param x2 param y2 param radius arcTo ( x1 , y1 , x2 , y2 , radius ) { this . mGraphics . arcTo ( x1 , y1 , x2 , y2 , radius ) ; } param color param alpha beginFill ( color ? , alpha ? ) { this . mGraphics . beginFill ( color , alpha ) ; } param cpX param cpY param cpX2 param cpY2 param toX param toY bezierCurveTo ( cpX , cpY , cpX2 , cpY2 , toX , toY ) { this . mGraphics . bezierCurveTo ( cpX , cpY , cpX2 , cpY2 , toX , toY ) ; } param x param y param radius drawCircle ( x , y , radius ) { this . mGraphics . drawCircle ( x , y , radius ) ; } param x param y param width param height drawEllipse ( x , y , width , height ) { this . mGraphics . drawEllipse ( x , y , width , height ) ; } param x param y param width param height drawRect ( x , y , width , height ) { this . mGraphics . drawRect ( x , y , width , height ) ; } param x param y param width param height param radius drawRoundedRect ( x , y , width , height , radius ) { this . mGraphics . drawRoundedRect ( x , y , width , height , radius ) ; } param x param y param points param radius param innerRadius param rotation drawStar ( x , y , points , radius , innerRadius ? , rotation ? ) { if ( rotation != undefined ) { rotation = ( Math . PI * 2 ) * ( rotation / 360 ) ; } this . mGraphics . drawStar ( x , y , points , radius , innerRadius , rotation ) ; } param path drawPolygon ( ... path ) { this . mGraphics . drawPolygon ( path ) ; } }