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.
7777
7878Attribute to specify the pen (stroke) width to use.
7979
80- ## Methods
80+ ## Methods
81+
8182** getDrawing()** - Promise * (returns image if successful)*
8283
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 {
3030
3131 }
3232
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 > {
3450 return new Promise ( ( resolve , reject ) => {
3551 try {
3652 if ( ! this . _android . isEmpty ( ) ) {
@@ -45,6 +61,21 @@ export class DrawingPad extends common.DrawingPad {
4561 } )
4662 }
4763
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+
4879 public clearDrawing ( ) : any {
4980 try {
5081 this . _android . clear ( ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " nativescript-drawingpad" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "main" : " drawingpad.js" ,
55 "description" : " A NativeScript plugin to provide a way to capture any drawing (signatures are a common use case) from the device screen." ,
66 "nativescript" : {
You can’t perform that action at this time.
0 commit comments