GithubHelp home page GithubHelp logo

signaturepad's Introduction

Signature Pad

Build Status Build Status

SignaturePad NuGet SignaturePad Xamairn.Forms NuGet

Signature Pad makes capturing, saving, exporting, and displaying signatures extremely simple on Xamarin.iOS, Xamarin.Android and Windows.

Not only is Signature Pad available for native apps, but also available in Xamarin.Forms apps.

Screenshot


Using Signature Pad

Signature Pad can be installed from NuGet.org for native Xamarin and Windows apps:

nuget install Xamarin.Controls.SignaturePad

And also for Xamarin.Forms apps:

nuget install Xamarin.Controls.SignaturePad.Forms

Using Signature Pad on iOS

using Xamarin.Controls;

var signatureView = new SignaturePadView (View.Frame) {
	StrokeWidth = 3f,
	StrokeColor = UIColor.Black,
	BackgroundColor = UIColor.White,
};

Using Signature Pad on Android

using Xamarin.Controls;

var signatureView = new SignaturePadView (this) {
	StrokeWidth = 3f,
	StrokeColor = Color.White,
	BackgroundColor = Color.Black
};

Using Signature Pad on Windows

<!-- xmlns:controls="using:Xamarin.Controls" -->

<controls:SignaturePad
	x:Name="signatureView"
	StrokeWidth="3"
	StrokeColor="White"
	Background="Black" />

Using Signature Pad on Xamarin.Forms

<!-- xmlns:controls="clr-namespace:SignaturePad.Forms;assembly=SignaturePad.Forms" -->

<controls:SignaturePadView
	x:Name="signatureView"
	StrokeWidth="3"
	StrokeColor="BlackWhite"
	BackgroundColor="Black" />

Obtaining a Signature Image

The signature that was drawn on the canvas can be obtained as a image using the GetImage(...) method overloads. The resulting image will be in the native platform image type:

// iOS
UIImage image = signatureView.GetImage ();

// Android
Bitmap image = signatureView.GetImage ();

// Windows
WriteableBitmap bitmap = signatureView.GetImage ();

For Xamarin.Forms, there is no "native" image format, but GetImageStreamAsync can be used instead to retrieve an encoded (jpeg or png) image stream:

Stream bitmap = await signatureView.GetImageStreamAsync (SignatureImageFormat.Png);

Obtaining the Signature Points

In addition to retrieving the signature as an image, the signature can also be retrieved as as an array of points:

var strokes = signatureView.Strokes;

These strokes can be used to save and restore a signature:

// restore strokes (iOS, Android, Windows)
signatureView.LoadStrokes (newStrokes);

// restore strokes (Xamarin.Forms)
signatureView.Strokes = newStrokes;

License

The license for this repository is specified in LICENSE.

.NET Foundation

This project is part of the .NET Foundation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.