import { TNSPath2DBase } from './canvas-plugin.common' ; import { TNSDOMMatrix } from './TNSDOMMatrix' ; declare let CanvasPath2D ; export class TNSPath2D extends TNSPath2DBase { constructor ( instance ? ) { let nativeInstance ; if ( typeof instance === 'string' ) { nativeInstance = CanvasPath2D . alloc ( ) . initWithData ( instance ) ; } else if ( instance instanceof TNSPath2D ) { nativeInstance = CanvasPath2D . alloc ( ) . initWithPath ( instance . native ) ; } else if ( instance instanceof CanvasPath2D ) { nativeInstance = CanvasPath2D . alloc ( ) . initWithPath ( instance ) ; } else { nativeInstance = CanvasPath2D . new ( ) ; } super ( nativeInstance ) ; } addPath ( path , transform ? ) { if ( transform ) { this . nativeInstance . addPathWithPathTransform ( path . nativeInstance , transform . native ) ; } else { this . nativeInstance . addPathWithPath ( path . nativeInstance ) ; } } arc ( x , y , radius , startAngle , endAngle , anticlockwise = false ) { this . nativeInstance . arcWithXYRadiusStartAngleEndAngleAnticlockwise ( x , y , radius , startAngle , endAngle , anticlockwise ) ; } arcTo ( x1 , y1 , x2 , y2 , radius ) { this . nativeInstance . arcToX1Y1X2Y2Radius ( x1 , y1 , x2 , y2 , radius ) ; } bezierCurveTo ( cp1x , cp1y , cp2x , cp2y , x , y ) { this . nativeInstance . bezierCurveToCp1xCp1yCp2xCp2yXY ( cp1x , cp1y , cp2x , cp2y , x , y ) ; } closePath ( ) { this . nativeInstance . closePath ( ) ; } ellipse ( x , y , radiusX , radiusY , rotation , startAngle , endAngle , anticlockwise = false ) { this . nativeInstance . ellipseWithXYRadiusXRadiusYRotationStartAngleEndAngleAnticlockwise ( x , y , radiusX , radiusY , rotation , startAngle , endAngle , anticlockwise ) ; } lineTo ( x , y ) { this . nativeInstance . lineToXY ( x , y ) ; } moveTo ( x , y ) { this . nativeInstance . moveToXY ( x , y ) ; } quadraticCurveTo ( cpx , cpy , x , y ) { this . nativeInstance . quadraticCurveToCpxCpyXY ( cpx , cpy , x , y ) ; } rect ( x , y , width , height ) { this . nativeInstance . rectWithXYWidthHeight ( x , y , width , height ) ; } }