# GraffitiSignature
Class Inherits GraffitiWebUIControl
## About
GraffitiSignature is a class designed to make getting customer signatures using touch-enabled devices or mouse easy.Features:
## Compatibility
### Framework API Version
| 1.0 | 2.0 |
| :---: | :---: |
| True | True |
### Web
| 32-Bit | 64-Bit |
| :---: | :---: |
| True | True |
## Event Definitions
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Error | e as RuntimeException | (None) | Raised when an error is encountered. |
| Open | (None) | (None) | (None) |
| Shown | (None) | (None) | (None) |
| SignatureChanged | (None) | (None) | Fired when the user release the mouse button or raises their finger from the screen. |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Clear | (None) | (None) | Clears the canvas for a new signature. |
| ClearBackgroundImage | (None) | (None) | Clears the background image. |
| SetBackground | theImage as Picture | (None) | Sets the background image. |
| SetBackground | base64Image as String | (None) | Sets the background image. |
| SetBackground | theImage as WebPicture | (None) | Sets the background image. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| BGColor | Color | (None) | Color drawn to the background. |
| PenColor | Color | (None) | Determines the color used in the handwriting. |
| PenSizeMaximum | Double | (None) | Maximum segment drawing width. |
| PenSizeMinimum | Double | (None) | Minimum segment drawing width. |
| SignatureData | String | (None) | BASE64 data of the signature image currently being displayed. |
| SignatureImage | Picture | (None) | Signature Image currently being displayed. |
## Examples
### Converting to JPEG or other format that do not support alpha channels
GraffitiSignature returns PNG-formatted data where the actual drawing is placed in a transparent layer. Due to this, if you try to convert directly to a JPEG or other format that doesn’t support alpha channels, you’ll end up with the drawing on a black background. Unless you’ve changed the PenColor, you’ll end up with a black signature on a black background. The following code in the SignatureChanged event will create a non-transparent version of the signature:
```
var pToJPEG as new Picture( me.SignatureImage.Width, me.SignatureImage.Height )
var g as Graphics = pToJPEG.Graphics
g.DrawingColor = &cFFFFFF
g.FillRectangle( 0, 0, g.Width, g.Height )
g.DrawPicture( me.SignatureImage, 0, 0 )
var dataJPEG as String = pToJPEG.ToData(Picture.Formats.JPEG, 50)
```