@@ -177,7 +177,6 @@ export class Rect implements IRect {
177177
178178 private updateCGRect ( ) {
179179 this . cgRect = createCGRect ( this . _left , this . _top , this . _right , this . _bottom ) ;
180-
181180 }
182181
183182 get left ( ) {
@@ -1107,7 +1106,6 @@ export class Paint implements IPaint {
11071106 } else {
11081107 this . alpha = 255 ;
11091108 }
1110-
11111109 }
11121110 getColor ( ) : Color {
11131111 return this . _color ;
@@ -1388,13 +1386,18 @@ export class Canvas implements ICanvas {
13881386 if ( ! image ) {
13891387 return ;
13901388 }
1391- const dst = args [ 2 ] instanceof Rect ? args [ 2 ] . cgRect : CGRectMake ( args [ 1 ] , args [ 2 ] , image . size . width , image . size . height ) ;
13921389
1393- // CGContextSaveGState(ctx);
1394- CGContextTranslateCTM ( ctx , 0 , dst . origin . y + dst . size . height ) ;
1395- CGContextScaleCTM ( ctx , 1.0 , - 1.0 ) ;
1396- CGContextDrawImage ( ctx , CGRectMake ( dst . origin . x , 0 , dst . size . width , dst . size . height ) , image . CGImage ) ;
1397- // CGContextRestoreGState(ctx);
1390+ if ( args [ 1 ] instanceof Matrix ) {
1391+ CGContextConcatCTM ( ctx , args [ 1 ] . _transform ) ;
1392+ CGContextTranslateCTM ( ctx , 0 , image . size . height ) ;
1393+ CGContextScaleCTM ( ctx , 1.0 , - 1.0 ) ;
1394+ CGContextDrawImage ( ctx , CGRectMake ( 0 , 0 , image . size . width , image . size . height ) , image . CGImage ) ;
1395+ } else {
1396+ const dst = args [ 2 ] instanceof Rect ? args [ 2 ] . cgRect : CGRectMake ( args [ 1 ] , args [ 2 ] , image . size . width , image . size . height ) ;
1397+ CGContextTranslateCTM ( ctx , 0 , dst . origin . y + dst . size . height ) ;
1398+ CGContextScaleCTM ( ctx , 1.0 , - 1.0 ) ;
1399+ CGContextDrawImage ( ctx , CGRectMake ( dst . origin . x , 0 , dst . size . width , dst . size . height ) , image . CGImage ) ;
1400+ }
13981401 }
13991402
14001403 drawPoint ( x : number , y : number , paint : Paint ) : void {
@@ -1551,11 +1554,10 @@ export class Canvas implements ICanvas {
15511554 const op = args [ 1 ] as Op ;
15521555 const ctx = this . ctx ;
15531556 if ( op !== undefined ) {
1554- const cgPath = ctx . path ;
1557+ const cgPath = ctx . path ;
15551558 let clipPath = cgPath ? UIBezierPath . bezierPathWithCGPath ( cgPath ) : UIBezierPath . bezierPathWithRect ( CGRectMake ( 0 , 0 , this . _width , this . _height ) ) ;
15561559 if ( op === Op . DIFFERENCE ) {
15571560 clipPath . appendPath ( path . getOrCreateBPath ( ) . bezierPathByReversingPath ( ) ) ;
1558-
15591561 } else if ( op === Op . REVERSE_DIFFERENCE ) {
15601562 clipPath = clipPath . bezierPathByReversingPath ( ) ;
15611563 clipPath . appendPath ( path . getOrCreateBPath ( ) ) ;
@@ -1748,12 +1750,12 @@ export class Canvas implements ICanvas {
17481750 this . _drawPath ( paint , ctx ) ;
17491751 }
17501752
1751- @paint
1752- drawImage ( x : number , y : number , w : number , h : number , image : ImageSource | UIImage ) {
1753- const ctx = this . ctx ;
1754- const theImage : UIImage = image instanceof ImageSource ? image . ios : image ;
1755- CGContextDrawImage ( ctx , createCGRect ( x , y , w , h ) , theImage . CGImage ) ;
1756- }
1753+ // @paint
1754+ // drawImage(x: number, y: number, w: number, h: number, image: ImageSource | UIImage) {
1755+ // const ctx = this.ctx;
1756+ // const theImage: UIImage = image instanceof ImageSource ? image.ios : image;
1757+ // CGContextDrawImage(ctx, createCGRect(x, y, w, h), theImage.CGImage);
1758+ // }
17571759 clipRect ( ...params ) {
17581760 const ctx = this . ctx ;
17591761 const length = params . length ;
@@ -1800,12 +1802,10 @@ export class Canvas implements ICanvas {
18001802
18011803 if ( path && paint . shader ) {
18021804 if ( paint . style === Style . STROKE ) {
1803- const cgStrokedPath = CGPathCreateCopyByStrokingPath ( path , null ,
1804- paint . strokeWidth , paint . strokeCap as any , paint . strokeJoin as any , 0 ) ;
1805+ const cgStrokedPath = CGPathCreateCopyByStrokingPath ( path , null , paint . strokeWidth , paint . strokeCap as any , paint . strokeJoin as any , 0 ) ;
18051806 CGContextAddPath ( ctx , cgStrokedPath ) ;
18061807 } else {
18071808 CGContextAddPath ( ctx , path ) ;
1808-
18091809 }
18101810 paint . drawShader ( ctx ) ;
18111811 } else {
@@ -2169,8 +2169,7 @@ export class BitmapShader {
21692169 }
21702170 return this . bitmap ;
21712171 }
2172- release ( ) {
2173- }
2172+ release ( ) { }
21742173}
21752174export class PorterDuffXfermode {
21762175 constructor ( public mode ?: number ) { }
@@ -2185,7 +2184,7 @@ export class StaticLayout {
21852184 // } else if (!(text instanceof NSMutableAttributedString)) {
21862185 // text = NSMutableAttributedString.alloc().initWithStringAttributes(text, this.paint.getDrawTextAttribs());
21872186 } else {
2188- this . nsAttributedString = NSAttributedString . alloc ( ) . initWithString ( text + ' ' ) ;
2187+ this . nsAttributedString = NSAttributedString . alloc ( ) . initWithString ( text + ' ' ) ;
21892188 }
21902189 }
21912190 toDraw : NSMutableAttributedString ;
0 commit comments