B4A Library SignPad V0.20 - Signature Capture - incl Java source

SignPad
Version:
0.20

Android Signature Pad is an Android library for drawing smooth signatures. It uses variable width Bézier curve interpolation based on Smoother Signatures.

For those who want to play with the library or mayybe to extend
i have included the java source of this library so you can change it by yourself and then recompile the lib with SLC. Have fun


This wrapper is based on this

header.png

  • SignPad
    Events:
    • onSigned (sign As Bitmap)
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • Capture
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • clear
    • getAlbumStorageDir (albumName As String) As File
    • saveBitmapToJPG (bitmap As Bitmap, photo As File)
    Properties:
    • Left As Int
    • SignatureBitmap As Bitmap [read only]
    • Top As Int
    • TransparentSignatureBitmap As Bitmap [read only]

For those who want to extend the library i have attached the java-source of this library. FEEL FREE TO MODIFY IT
 

Attachments

  • libSignPad_0.16.zip
    9.8 KB · Views: 595
  • libSignPad_0.17.zip
    9.9 KB · Views: 613
  • LibSignPadv0.20.zip
    10.8 KB · Views: 1,044
  • SignaturePad_JAVASOURCE020.zip
    38 KB · Views: 851
  • SignPadEx.zip
    12.9 KB · Views: 1,006
Last edited:

BarryW

Active Member
Licensed User
Longtime User
Is there any way to change the background of your library or put an image to it?
Tnx...
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Hi again Manfred ,

I tried modifying source but when compiling with SLC and refreshing Libraries list I get this error :

B4X:
Error Parsing Libraries
com.github.gcacace.signaturepad.views.SignaturePad.strokewidth already exists.

I even commented strokewidth functions in original library and in wrapper but still the same error .
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
you need to add
com.github
to your b4ignore directive

If it is already empty then enter com.github
If not then add ",com.github" at the end

Thanks a lot :)
I added a function to set paint color to attached version .
 

Attachments

  • SignPad.zip
    11.4 KB · Views: 393
  • SignPadSrc.zip
    37.1 KB · Views: 361

rafaelmotaquintana

Active Member
Licensed User
I get this error when trying the sample code published

B4A version: 5.50
Parsing code. (0.00s)
Compiling code. Error
Error compiling program.
Error description: Object reference not set to an instance of an object.
Occurred on line: 39
SignaturePad.Capture(False)
Word: (
 

fixit30

Active Member
Licensed User
Longtime User
I get this error when trying the sample code published

B4A version: 5.50
Parsing code. (0.00s)
Compiling code. Error
Error compiling program.
Error description: Object reference not set to an instance of an object.
Occurred on line: 39
SignaturePad.Capture(False)
Word: (

How can we know what the problem is if you don't post your code?
 

alon

Active Member
Licensed User
Longtime User
Hi ,
Is there a way to know if the signpad is clear/empty.

Thanks
 

Rusty

Well-Known Member
Licensed User
Longtime User
Great library...
I noticed several people asking if the signature has to occur with one line (i.e. touch and not lift until finished).
However, most people lift their finger during signature. For Example: John Smith would be at LEAST two touches.
However, when you lift your finger presumably after the word "John" is complete. the signature is finished and the event "onsigned" fires and the game is over...
Is there a way to allow John to lift his finger and then sign Smith without terminating the signature without firing the event?
(or to restart the signature and combine the strokes into one image)
thanks
Rusty
 
Last edited:

netsistemas

Active Member
Licensed User
Longtime User
This is good solution and with qualty (don´t forget donate).

But,
How put a DOC / POINT in a sign?
Move point to point are ok, but if you need put a DOC over the 'i' , the library does not recognize the touch on the screen.
I can try to get this case in panel touch or similar, but i think that this is not good solution.
 

netsistemas

Active Member
Licensed User
Longtime User
I install eclipse and your source code, config and view and understand your great code and DO IT!

(I change the JAVA library source code)

Important: There are several versions, you must get the last. This last version have any adicional property:

In B4A proyect add this code:
SignaturePad.StrokeWidth=5

SignaturePad.StrokeWidth=Value

In this version you can change the line with.

The first version is more pretty (i think), because have other tecnich for get the stock with, but is not easy for me implement the DOC over 'i' letter).

Solution (for java proyect):
In signaturePad.Java i add only one code line and works.


B4X:
    @Override
    public boolean onTouchEvent(MotionEvent event){
        float eventX = event.getX();
        float eventY = event.getY();

        switch (event.getAction()){
        case MotionEvent.ACTION_DOWN:
            getParent().requestDisallowInterceptTouchEvent(true);
            mPoints.clear();
            mPath.moveTo(eventX, eventY);
            mLastTouchX = eventX;
            mLastTouchY = eventY;
            addPoint(new TimedPoint(eventX, eventY));
            //ralonso add jun 2018 - it the stockwith is 1, the doc are not visible
            // SignaturePad.StrokeWidth=5 in B4A (upper than 1)
            addPoint(new TimedPoint(eventX+1, eventY));
 

Attachments

  • TouchPadMio_library.zip
    19.6 KB · Views: 279
Last edited:

netsistemas

Active Member
Licensed User
Longtime User
I inclued:
B4X:
    @Override
    public boolean onTouchEvent(MotionEvent event){
        
        //mayo 2020
 if (this.mStrokeWidth > 1 )
 {

you, now set StokeWith to cero, for to enabled false the touch pad.
 

Attachments

  • TouchPadMio_2020May.zip
    13.9 KB · Views: 291
Top