@@ -121,10 +121,10 @@ function drawViewOnCanvas(canvas: android.graphics.Canvas, view: View, rect?: an
121
121
}
122
122
123
123
class ProxyClass < T > {
124
- _native : T ;
124
+ mNative : T ;
125
125
static augmentedMethods = [ ] ;
126
126
getNative ( ) {
127
- return this . _native ;
127
+ return this . mNative ;
128
128
}
129
129
constructor ( ) {
130
130
const proxy = new Proxy ( this , this ) ;
@@ -138,7 +138,7 @@ class ProxyClass<T> {
138
138
const methodName = name ;
139
139
for ( let index = 0 ; index < args . length ; index ++ ) {
140
140
const element = args [ index ] ;
141
- if ( element && element . _native ) {
141
+ if ( element && element . mNative ) {
142
142
args [ index ] = element . getNative ( ) ;
143
143
} else if ( Array . isArray ( element ) ) {
144
144
args [ index ] = arrayToNativeArray ( element ) ;
@@ -175,7 +175,7 @@ class Canvas extends ProxyClass<android.graphics.Canvas> {
175
175
this . _shouldReleaseBitmap = true ;
176
176
this . _bitmap = this . _bitmap . copy ( android . graphics . Bitmap . Config . ARGB_8888 , true ) ;
177
177
}
178
- this . _native = new android . graphics . Canvas ( this . _bitmap ) ;
178
+ this . mNative = new android . graphics . Canvas ( this . _bitmap ) ;
179
179
}
180
180
181
181
return this ;
@@ -222,23 +222,23 @@ class Canvas extends ProxyClass<android.graphics.Canvas> {
222
222
}
223
223
224
224
export class Paint extends ProxyClass < android . graphics . Paint > {
225
- _native : android . graphics . Paint ;
226
- fontInternal : Font ;
227
- _needsFontUpdate = false ;
225
+ mNative : android . graphics . Paint ;
226
+ mFontInternal : Font ;
227
+ mNeedsFontUpdate = false ;
228
228
handlesFont = false ;
229
229
getNative ( ) {
230
- if ( ! this . handlesFont && this . _needsFontUpdate ) {
231
- this . _needsFontUpdate = false ;
230
+ if ( ! this . handlesFont && this . mNeedsFontUpdate ) {
231
+ this . mNeedsFontUpdate = false ;
232
232
const font = this . font ;
233
233
const nTypeface = font . getAndroidTypeface ( ) ;
234
- this . _native . setTypeface ( nTypeface ) ;
234
+ this . mNative . setTypeface ( nTypeface ) ;
235
235
}
236
- return this . _native ;
236
+ return this . mNative ;
237
237
}
238
238
constructor ( ) {
239
239
super ( ) ;
240
- this . _native = new android . graphics . Paint ( ) ;
241
- this . _native . setLinearText ( true ) ; // ensure we are drawing fonts correctly
240
+ this . mNative = new android . graphics . Paint ( ) ;
241
+ this . mNative . setLinearText ( true ) ; // ensure we are drawing fonts correctly
242
242
return this ;
243
243
}
244
244
handleCustomMethods ( target , native , methodName : string , args : any [ ] ) : any {
@@ -251,27 +251,27 @@ export class Paint extends ProxyClass<android.graphics.Paint> {
251
251
args [ 0 ] = createColorParam ( args [ 0 ] ) ;
252
252
} else if ( methodName === 'setTypeface' ) {
253
253
if ( args [ 0 ] instanceof Font ) {
254
- this . fontInternal = args [ 0 ] ;
254
+ this . mFontInternal = args [ 0 ] ;
255
255
} else {
256
256
this . font [ '_typeface' ] = args [ 0 ] as android . graphics . Typeface ;
257
257
}
258
- this . _needsFontUpdate = true ;
259
- return this . fontInternal ;
258
+ this . mNeedsFontUpdate = true ;
259
+ return this . mFontInternal ;
260
260
}
261
261
}
262
262
setFont ( font : Font ) {
263
- this . fontInternal = font ;
263
+ this . mFontInternal = font ;
264
264
if ( this . handlesFont ) {
265
265
return ;
266
266
}
267
- this . _native . setTextSize ( font . fontSize ) ;
268
- this . _needsFontUpdate = true ;
267
+ this . mNative . setTextSize ( font . fontSize ) ;
268
+ this . mNeedsFontUpdate = true ;
269
269
}
270
270
getFont ( ) {
271
- if ( ! this . fontInternal ) {
272
- this . fontInternal = Font . default ;
271
+ if ( ! this . mFontInternal ) {
272
+ this . mFontInternal = Font . default ;
273
273
}
274
- return this . fontInternal ;
274
+ return this . mFontInternal ;
275
275
}
276
276
get font ( ) {
277
277
return this . getFont ( ) ;
@@ -290,9 +290,9 @@ export class Paint extends ProxyClass<android.graphics.Paint> {
290
290
}
291
291
setFontFamily ( familyName : string ) {
292
292
if ( this . font . fontFamily !== familyName ) {
293
- this . fontInternal = this . font . withFontFamily ( familyName ) ;
293
+ this . mFontInternal = this . font . withFontFamily ( familyName ) ;
294
294
if ( ! this . handlesFont ) {
295
- this . _needsFontUpdate = true ;
295
+ this . mNeedsFontUpdate = true ;
296
296
}
297
297
}
298
298
}
@@ -301,9 +301,9 @@ export class Paint extends ProxyClass<android.graphics.Paint> {
301
301
}
302
302
setFontWeight ( weight : FontWeight ) {
303
303
if ( this . font . fontWeight !== weight ) {
304
- this . fontInternal = this . font . withFontWeight ( weight ) ;
304
+ this . mFontInternal = this . font . withFontWeight ( weight ) ;
305
305
if ( ! this . handlesFont ) {
306
- this . _needsFontUpdate = true ;
306
+ this . mNeedsFontUpdate = true ;
307
307
}
308
308
}
309
309
}
@@ -312,49 +312,49 @@ export class Paint extends ProxyClass<android.graphics.Paint> {
312
312
}
313
313
setFontStyle ( style : FontStyle ) {
314
314
if ( this . font . fontStyle !== style ) {
315
- this . fontInternal = this . font . withFontStyle ( style ) ;
315
+ this . mFontInternal = this . font . withFontStyle ( style ) ;
316
316
if ( ! this . handlesFont ) {
317
- this . _needsFontUpdate = true ;
317
+ this . mNeedsFontUpdate = true ;
318
318
}
319
319
}
320
320
}
321
321
set color ( color ) {
322
322
( this as any ) . setColor ( color ) ;
323
323
}
324
324
set strokeWidth ( value : number ) {
325
- this . _native . setStrokeWidth ( value ) ;
325
+ this . mNative . setStrokeWidth ( value ) ;
326
326
}
327
327
set strokeCap ( value : number ) {
328
- this . _native . setStrokeCap ( value ) ;
328
+ this . mNative . setStrokeCap ( value ) ;
329
329
}
330
330
set strokeJoin ( value : number ) {
331
- this . _native . setStrokeJoin ( value ) ;
331
+ this . mNative . setStrokeJoin ( value ) ;
332
332
}
333
333
set style ( value : number ) {
334
- this . _native . setStyle ( value ) ;
334
+ this . mNative . setStyle ( value ) ;
335
335
}
336
336
set textSize ( value : number ) {
337
- this . _native . setTextSize ( value ) ;
337
+ this . mNative . setTextSize ( value ) ;
338
338
}
339
339
get textSize ( ) {
340
340
return this . getTextSize ( ) ;
341
341
}
342
342
public getTextSize ( ) : number {
343
- return this . _native . getTextSize ( ) ;
343
+ return this . mNative . getTextSize ( ) ;
344
344
}
345
345
public setTypeface ( font : Font | android . graphics . Typeface ) : Font {
346
346
if ( font instanceof Font ) {
347
347
this . setFont ( font ) ;
348
- return this . fontInternal ;
348
+ return this . mFontInternal ;
349
349
} else if ( font ) {
350
- this . fontInternal [ '_typeface' ] = font ;
350
+ this . mFontInternal [ '_typeface' ] = font ;
351
351
} else {
352
- this . fontInternal = null ;
352
+ this . mFontInternal = null ;
353
353
}
354
354
if ( ! this . handlesFont ) {
355
- this . _needsFontUpdate = true ;
355
+ this . mNeedsFontUpdate = true ;
356
356
}
357
- return this . fontInternal ;
357
+ return this . mFontInternal ;
358
358
}
359
359
set typeface ( typeface ) {
360
360
this . setTypeface ( typeface ) ;
@@ -364,30 +364,30 @@ export class Paint extends ProxyClass<android.graphics.Paint> {
364
364
export class DashPathEffect extends ProxyClass < android . graphics . DashPathEffect > {
365
365
constructor ( intervals : number [ ] , phase : number ) {
366
366
super ( ) ;
367
- this . _native = new android . graphics . DashPathEffect ( arrayToNativeArray ( intervals ) , phase ) ;
367
+ this . mNative = new android . graphics . DashPathEffect ( arrayToNativeArray ( intervals ) , phase ) ;
368
368
return this ;
369
369
}
370
370
}
371
371
372
372
export class Path extends ProxyClass < com . akylas . canvas . CanvasPath > {
373
373
constructor ( path ?: com . akylas . canvas . CanvasPath ) {
374
374
super ( ) ;
375
- this . _native = path ? new com . akylas . canvas . CanvasPath ( path ) : new com . akylas . canvas . CanvasPath ( ) ;
375
+ this . mNative = path ? new com . akylas . canvas . CanvasPath ( path ) : new com . akylas . canvas . CanvasPath ( ) ;
376
376
return this ;
377
377
}
378
378
}
379
379
export class RadialGradient extends ProxyClass < android . graphics . RadialGradient > {
380
380
constructor ( param0 : number , param1 : number , param2 : number , param3 : any , param4 : any , param5 : any ) {
381
381
super ( ) ;
382
- this . _native = new android . graphics . RadialGradient ( param0 , param1 , param2 , createColorParam ( param3 ) , param4 instanceof Array ? param4 : createColorParam ( param4 ) , param5 ) ;
382
+ this . mNative = new android . graphics . RadialGradient ( param0 , param1 , param2 , createColorParam ( param3 ) , param4 instanceof Array ? param4 : createColorParam ( param4 ) , param5 ) ;
383
383
return this ;
384
384
}
385
385
}
386
386
387
387
export class LinearGradient extends ProxyClass < android . graphics . LinearGradient > {
388
- _native : android . graphics . LinearGradient ;
388
+ mNative : android . graphics . LinearGradient ;
389
389
getNative ( ) {
390
- return this . _native ;
390
+ return this . mNative ;
391
391
}
392
392
constructor ( param0 : number , param1 : number , param2 : number , param3 : any , param4 : any , param5 : any , param6 : any ) {
393
393
super ( ) ;
@@ -409,19 +409,19 @@ export class LinearGradient extends ProxyClass<android.graphics.LinearGradient>
409
409
param5 = createColorParam ( param5 ) ;
410
410
}
411
411
}
412
- this . _native = new android . graphics . LinearGradient ( param0 , param1 , param2 , param3 , param4 , param5 , param6 ) ;
412
+ this . mNative = new android . graphics . LinearGradient ( param0 , param1 , param2 , param3 , param4 , param5 , param6 ) ;
413
413
return this ;
414
414
}
415
415
}
416
416
417
417
export class BitmapShader extends ProxyClass < android . graphics . BitmapShader > {
418
- _native : android . graphics . BitmapShader ;
418
+ mNative : android . graphics . BitmapShader ;
419
419
constructor ( bitmap : any , tileX : any , tileY : any ) {
420
420
super ( ) ;
421
421
if ( bitmap instanceof ImageSource ) {
422
422
bitmap = bitmap . android ;
423
423
}
424
- this . _native = new android . graphics . BitmapShader ( bitmap , tileX , tileY ) ;
424
+ this . mNative = new android . graphics . BitmapShader ( bitmap , tileX , tileY ) ;
425
425
return this ;
426
426
}
427
427
}
@@ -435,7 +435,7 @@ export class StaticLayout extends ProxyClass<android.text.StaticLayout> {
435
435
// in case it is a number or a boolean
436
436
text = text + '' ;
437
437
}
438
- this . _native = com . akylas . canvas . StaticLayout . createStaticLayout ( text , paint , width , align , spacingmult , spacingadd , includepad ) ;
438
+ this . mNative = com . akylas . canvas . StaticLayout . createStaticLayout ( text , paint , width , align , spacingmult , spacingadd , includepad ) ;
439
439
440
440
return this ;
441
441
}
@@ -478,7 +478,7 @@ class CanvasView extends CanvasBase {
478
478
}
479
479
canvas . drawBitmap ( shapeCanvas . getImage ( ) as android . graphics . Bitmap , 0 , 0 , this . shapePaint ) ;
480
480
} else if ( ! this . cached ) {
481
- const shapes = this . _shapes ;
481
+ const shapes = this . mShapes ;
482
482
const width = canvas . getWidth ( ) ;
483
483
const height = canvas . getHeight ( ) ;
484
484
if ( shapes && shapes . length > 0 ) {
@@ -524,7 +524,7 @@ class CanvasView extends CanvasBase {
524
524
canvas . save ( ) ;
525
525
// canvas.setDensity(Math.round(scale * 160));
526
526
canvas . scale ( scale , scale ) ; // always scale to device density to work with dp
527
- this . augmentedCanvas . _native = canvas ;
527
+ this . augmentedCanvas . mNative = canvas ;
528
528
this . onDraw ( this . augmentedCanvas as any ) ;
529
529
if ( drawFameRate ) {
530
530
const end = Date . now ( ) ;
0 commit comments