@@ -4,6 +4,12 @@ import { Color, GridLayout, ImageSource, ObservableArray, View } from '@nativesc
4
4
import { Font , FontStyle , FontStyleType , FontWeight , FontWeightType } from '@nativescript/core/ui/styling/font' ;
5
5
import Shape from './shapes/shape' ;
6
6
7
+ // Android ONLY!!!
8
+ export class ProxyClass {
9
+ getNative ( ) : any ;
10
+ setNative ( object ) ;
11
+ }
12
+
7
13
export function createRect ( x : number , y : number , w : number , h : number ) : Rect ;
8
14
export function createRectF ( x : number , y : number , w : number , h : number ) : RectF ;
9
15
export function parseCap ( value : string | number ) : Cap ;
@@ -18,7 +24,7 @@ type ColorParam = Color | number | string;
18
24
// export * from './canvas.android'
19
25
20
26
export type ColorFilter = android . graphics . ColorFilter ;
21
- export class Paint {
27
+ export class Paint extends ProxyClass {
22
28
constructor ( paint ?: Paint ) ;
23
29
color : ColorParam ;
24
30
setColor ( color : ColorParam ) ;
@@ -99,6 +105,10 @@ export class StaticLayout extends android.text.StaticLayout {
99
105
100
106
static getDesiredWidth ( text : any , paint : any ) ;
101
107
static getDesiredWidth ( text : any , start : number , end : number , paint : any ) ;
108
+
109
+ //ANDROID ONLY!!
110
+ getNative ( ) : any ;
111
+ setNative ( object ) ;
102
112
}
103
113
104
114
export class FontMetrics {
@@ -108,8 +118,10 @@ export class FontMetrics {
108
118
leading : number ;
109
119
top : number ;
110
120
}
111
- export class Canvas {
112
- constructor ( imageOrWidth : any /* ImageSource | android.graphics.Bitmap | UIImage | number */ , height ?: number ) ;
121
+ export class Canvas extends ProxyClass {
122
+ constructor ( imageOrWidth ?: any /* ImageSource | android.graphics.Bitmap | UIImage | number | android.graphics.Canvas */ , height ?: number ) ;
123
+
124
+ setContext ( context , width , height ) : any ; // IOS ONLY!
113
125
114
126
clear ( ) ; // clear the canvas by filling with transparent color
115
127
release ( ) ; // release all data (image and such). Only to be called on destroy
@@ -245,15 +257,23 @@ export class RectF {
245
257
}
246
258
export class RadialGradient extends android . graphics . RadialGradient {
247
259
constructor ( param0 : number , param1 : number , param2 : number , param3 : any , param4 : any , param5 : TileMode ) ;
260
+
261
+ //ANDROID ONLY!!
262
+ getNative ( ) : any ;
263
+ setNative ( object ) ;
248
264
}
249
265
export class LinearGradient extends android . graphics . LinearGradient {
250
266
constructor ( param0 : number , param1 : number , param2 : number , param3 : number , param4 : any , param5 : any , param6 : TileMode ) ;
267
+
268
+ //ANDROID ONLY!!
269
+ getNative ( ) : any ;
270
+ setNative ( object ) ;
251
271
}
252
272
export class BitmapShader extends android . graphics . BitmapShader {
253
273
constructor ( image : ImageSource , tileX , tileY ) ;
254
274
}
255
275
export class TileMode extends android . graphics . Shader . TileMode { }
256
- export class Path {
276
+ export class Path extends ProxyClass {
257
277
computeBounds ( rect : RectF , exact : boolean ) ;
258
278
isRect ( param0 : Rect ) : boolean ;
259
279
rMoveTo ( param0 : number , param1 : number ) : void ;
@@ -299,6 +319,10 @@ export class Path {
299
319
setLines ( points : number [ ] , offset ?: number , length ?: number , close ?: boolean ) ;
300
320
addCubicLines ( points : number [ ] , offset ?: number , length ?: number , close ?: boolean ) ;
301
321
setCubicLines ( points : number [ ] , offset ?: number , length ?: number , close ?: boolean ) ;
322
+
323
+ //ANDROID ONLY!!
324
+ getNative ( ) : any ;
325
+ setNative ( object ) ;
302
326
}
303
327
export class DrawFilter extends android . graphics . DrawFilter { }
304
328
export class Op extends android . graphics . Region . Op { }
@@ -307,10 +331,18 @@ export class FillType extends android.graphics.Path.FillType {}
307
331
export class Matrix extends android . graphics . Matrix {
308
332
mapRect ( rect : Rect ) ;
309
333
}
310
- export class ColorMatrixColorFilter extends android . graphics . ColorMatrixColorFilter { }
334
+ export class ColorMatrixColorFilter extends android . graphics . ColorMatrixColorFilter {
335
+ //ANDROID ONLY!!
336
+ getNative ( ) : any ;
337
+ setNative ( object ) ;
338
+ }
311
339
export class PathEffect extends android . graphics . PathEffect { }
312
340
export class DashPathEffect extends android . graphics . DashPathEffect {
313
341
constructor ( intervals : number [ ] , phase : number ) ;
342
+
343
+ //ANDROID ONLY!!
344
+ getNative ( ) : any ;
345
+ setNative ( object ) ;
314
346
}
315
347
// declare Paint extends get Canvas() {
316
348
// return android.graphics.Canvas;
0 commit comments