File tree Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,14 @@ Attribute to specify the pen (stroke) color to use.
77
77
78
78
Attribute to specify the pen (stroke) width to use.
79
79
80
- ## Methods
80
+ ## Methods
81
+
81
82
** getDrawing()** - Promise * (returns image if successful)*
82
83
83
- ** clearDrawing()** - clears the drawing from the DrawingPad view.
84
+ ** clearDrawing()** - clears the drawing from the DrawingPad view.
85
+
86
+ #### * Android Only*
87
+
88
+ - ** getTransparentDrawing** - Promise (returns a bitmap with a transparent background)
89
+ - ** getDrawingSvg()** - Promise (returns a Scalable Vector Graphics document)
90
+
Original file line number Diff line number Diff line change @@ -30,7 +30,23 @@ export class DrawingPad extends common.DrawingPad {
30
30
31
31
}
32
32
33
- public getDrawing ( ) :Promise < any > {
33
+
34
+ public getDrawing ( ) : Promise < any > {
35
+ return new Promise ( ( resolve , reject ) => {
36
+ try {
37
+ if ( ! this . _android . isEmpty ( ) ) {
38
+ let data = this . _android . getSignatureBitmap ( ) ;
39
+ resolve ( data ) ;
40
+ } else {
41
+ reject ( "DrawingPad is empty." ) ;
42
+ }
43
+ } catch ( err ) {
44
+ reject ( err ) ;
45
+ }
46
+ } )
47
+ }
48
+
49
+ public getTransparentDrawing ( ) : Promise < any > {
34
50
return new Promise ( ( resolve , reject ) => {
35
51
try {
36
52
if ( ! this . _android . isEmpty ( ) ) {
@@ -45,6 +61,21 @@ export class DrawingPad extends common.DrawingPad {
45
61
} )
46
62
}
47
63
64
+ public getDrawingSvg ( ) : Promise < any > {
65
+ return new Promise ( ( resolve , reject ) => {
66
+ try {
67
+ if ( ! this . _android . isEmpty ( ) ) {
68
+ let data = this . _android . getSignatureSvg ( ) ;
69
+ resolve ( data ) ;
70
+ } else {
71
+ reject ( "DrawingPad is empty." ) ;
72
+ }
73
+ } catch ( err ) {
74
+ reject ( err ) ;
75
+ }
76
+ } )
77
+ }
78
+
48
79
public clearDrawing ( ) : any {
49
80
try {
50
81
this . _android . clear ( ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " nativescript-drawingpad" ,
3
- "version" : " 1.0.0 " ,
3
+ "version" : " 1.0.1 " ,
4
4
"main" : " drawingpad.js" ,
5
5
"description" : " A NativeScript plugin to provide a way to capture any drawing (signatures are a common use case) from the device screen." ,
6
6
"nativescript" : {
You can’t perform that action at this time.
0 commit comments