ReadHighResBitmap
Declaration
Delphi
function ReadHighResBitmap(typeOfPic: Integer; var LenOfImage: Integer): Pointer;
C/C++
SOPAD_API LPVOID SOPAD_ReadHighResBitmap(int nTypeOfPic, int* pnLenOfImage);
ActiveX
HRESULT ReadHighResBitmap([in] long typeOfPic, [out, retval] VARIANT* Result);
Description
Function returns signature image.
naturaSign devices transmit signature image in payload bytes of data packets together with biodata. Size of one packet is 64 bytes, therefore only a small part of image can be transmitted with one packet. Image is divided into parts and only one part is transmitted in a packet. After last part is transmitted, device starts sending the image again from beginning.
If driver receives non-zero data frame (not empty, with biodata), it cannot get signature image with that stroke immeditately. Driver should wait until signature image is completely transmitted. Since biodata is encrypted, driver doesn't know coordinates of the signature stroke. To make sure the signature image is transmitted completely, driver should wait until last part of image is transmitted, and then receive full image again. If another non-zero frame is received in this waiting period, driver should start image transmission again.
If DRIVER_OPTION1_WAIT_FINAL_IMAGE is activated, the ReadHighResBitmap function waits until final image is received completely. If the option is not activated, driver returns signature image immediately, but the image may not contain all signature strokes.
Arguments
typeOfPic
type of signature image. Possible values are listed in a table.
Value | Description |
---|---|
-1 | Low-level unsmoothed bitmap. |
0 | JPEG image |
1 | Bitmap image |
2 | PNG ( Portable Network Graphic) |
LenOfImage
Size of binary representation of signature image in bytes.
Return value
Function returns pointer to binary block which contains serialized image. Application may use this block as a stream to and load an image from it.
ActiveX control returns one-dimensional array.
If the function fails, it returns nil pointer or zero-sized array.
Sample
// Save Image with ReadHighResBitmap string fileName = @"c:\temp\image.bmp"; dynamic readHighResBitmap = device.ReadHighResBitmap(1); // Read image as BMP MemoryStream mS = new MemoryStream(readHighResBitmap); Image fromStream = Image.FromStream(mS); using (var image = new Bitmap(fromStream, 320, 120)) // Size 320x120 { image.Save(fileName, ImageFormat.Bmp); // save the image in desired ImageFormat }