LCDImageEx, LCDImageExR
Declaration
Delphi
function LCDImageExR(ImageKind, x, y: Word; Image: HBITMAP): Integer;
procedure LCDImageEx(ImageKind, x, y: Word; Image: HBITMAP);Â
C/C++
SOPAD_API int SOPAD_LCDImageExR(int ImageKind, int x, int y, HBITMAP hImage);
SOPAD_API void SOPAD_LCDImageEx(int ImageKind, int x, int y, HBITMAP hImage);
ActiveX
HRESULT LCDImageExR([in] long ImageKind, [in] long x, [in] long y, [in] OLE_HANDLE Image, [out, retval] long* Result);
HRESULT LCDImageEx([in] long ImageKind, [in] long x, [in] long y, [in] OLE_HANDLE Image);Â
Description
Function displays image on LCD or stores image for further processing.
The only difference between LCDImageEx and LCDImageExR is that LCDImageExR function returns value.
NOTE: This function only works with signature pads with colour display. For B/W Pads please see SetSignImage or SetSignImageEx
Arguments
ImageKind
Type of image
Value | Description | Return value | extentions |
---|---|---|---|
1 | Branding: after sign logo (+Pad V2 and similar) | 0 | |
2 | View document on LCD | 0: success | x and y is the position of image. |
3 | View document on LCD, display sign button | x and y is the position of image. | |
4 | Store sign page | x and y is the position of image. | |
5 | Clear sign page, store foreground image | ||
6 | reserved for i don't know | ||
7 | continuous scrolling mode | the parameters represents x : ActualPageNumber y : MaxTileNumber | |
8 | page requested | the parameter represents x : actual page number, starting with 1 for the first page in PDF, requested by OnDeviceButton(Ex) with message type HID_CMD_BUTTON_JUMP_PAGE y : page count in PDF |
x and y
Position of image.
Image
Bitmap handle.
Return value
Return value depends on ImageKind, see above
Sample
// Don't download BG image, don't do alpha-blending for ColourPad default SignMode const int DRIVER_OPTION1_DISABLE_CP_BACKGROUND_IMAGE = 0x00001000; SigDev.SetDriverLong(0, SigDev.GetDriverLong(0) | DRIVER_OPTION1_DISABLE_CP_BACKGROUND_IMAGE); // Read Size of Display int w = SigDev.GetDriverLong(20); int h = SigDev.GetDriverLong(21); // Create a image, of course you can also load an existing one Bitmap bmp = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); Graphics gr = Graphics.FromImage(bmp); // Add some text to the Image gr.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 0, w, h)); gr.DrawString("Hello, World,", new Font("Arial", 16), Brushes.Black, new PointF(10, 10)); gr.DrawString("This is a Test", new Font("Arial", 16), Brushes.Black, new PointF(10, 50)); // Set as Default-SignMode Background Image SigDev.LCDImageExR(5, 0, 0, (int)bmp.GetHbitmap()); // Start signing Capturing = SigDev.startCapture("", true, true, true, true, ref padsetting);
// In case you want to Show Document Content as Background or you want to Change the hole Screen Bitmap bmp = new Bitmap(640, 470, System.Drawing.Imaging.PixelFormat.Format24bppRgb); // Set as SignInDoc Background SigDev.LCDImageExR(4, 0, 0, (int)bmp.GetHbitmap()); // Define a Signature Rectangle (for example with Size of 380x190 and place the signing area in the bottom center) SigDev.CreateSignatureRectangle(130, 280, 380, 190, 0); // Start signing Capturing = SigDev.startCapture("", true, true, true, true, ref padsetting);
Private Const DRIVER_OPTION1_DISABLE_CP_BACKGROUND_IMAGE As Integer = &H1000 Â ' Checking for Device Typ to use the correct way to load the Signing-Background on it Dim devicetyp As String = AxStepOverSignatureDevice1.GetDriverString(DRIVER_STRING_DEVICE_NAME) Â if devicetyp = "StepOver naturaSign Pad Colour" then ' Pad Typ StepOver naturaSign Colour, only the SignInfo Area can be changed with API, ' the Input area can be change with Imageloader ' load a image which will used as background Bitmap bmp = new Bitmap(@"TEST1.bmp"); Dim gr As Graphics = Graphics.FromImage(bmp) ' put some Text on the Image gr.DrawString("Hello, World,", new Font("Arial Bold", 32), Brushes.Green, new PointF(30, 40)) gr.DrawString("This is a Test", new Font("Arial Bold", 32), Brushes.Green, new PointF(30, 140)) ' Set Background Image AxStepOverSignatureDevice1.LCDImageExR(5, 0, 0, bmp.GetHbitmap()) else if (devicetyp = "StepOver naturaSign Pad Comfort" or devicetyp = "StepOver naturaSign Pad Flawless") then ' Comfort and Flawless works simelar than the colourpad, only that the hole screen is 1 image ' Read Size of Display Dim w As Integer = AxStepOverSignatureDevice1.GetDriverLong(DRIVER_LCD_WIDTH) Dim h As Integer = AxStepOverSignatureDevice1.GetDriverLong(DRIVER_LCD_HEIGHT) ' Create a image, of course you can also load an existing one it must have the size of 480x272 Bitmap bmp = new Bitmap(@"TEST2.bmp"); Dim gr As Graphics = Graphics.FromImage(bmp) ' Add some text to the Image gr.DrawString("Hello, World,", new Font("Arial", 16), Brushes.Green, new PointF(10, 60)) gr.DrawString("This is a Test", new Font("Arial", 16), Brushes.Green, new PointF(10, 90)) ' Set Background Image AxStepOverSignatureDevice1.LCDImageExR(5, 0, 0, bmp.GetHbitmap()) Â Dim padsettings As String = "" Capturing = AxStepOverSignatureDevice1.startCapture("", True, True, True, True, padsetting)
// Pad Typ StepOver naturaSign Colour, only the SignInfo Area can be changed with API, // the Input area can be change with Imageloader // Comfort and Flawless works simelar than the colourpad, only that the hole screen is 1 image // Don't download BG image, don't do alpha-blending for ColourPad default SignMode DRIVER_OPTION1 = 0; DRIVER_OPTION1_DISABLE_CP_BACKGROUND_IMAGE= $00001000; SigDev.SetDriverLong(DRIVER_OPTION1, SigDev.GetDriverLong(DRIVER_OPTION1) or DRIVER_OPTION1_DISABLE_CP_BACKGROUND_IMAGE); // load a image which will used as background // Bitmap bmp = new Bitmap(@"TEST1.bmp"); HBITMAP hbitmap = ::LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_COLOURPAD_DEFAULT_BG)); BITMAP bm; GetObject( hbitmap, sizeof(BITMAP), &bm ); long w = bm.bmWidth; long h = bm.bmHeight; //prepare the bitmap attributes BITMAPINFO bmInfo; memset(&bmInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER)); bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmInfo.bmiHeader.biWidth = w; bmInfo.bmiHeader.biHeight = h; bmInfo.bmiHeader.biPlanes = 1; bmInfo.bmiHeader.biBitCount = 24; //create a temporary dc in memory. HDC pDC = ::GetDC(0); HDC TmpDC = CreateCompatibleDC(pDC); //create a new bitmap and select it in the memory dc BYTE *pbase; HBITMAP TmpBmp = CreateDIBSection(pDC,&bmInfo,DIB_RGB_COLORS,(void**)&pbase,0,0); HGDIOBJ TmpObj = SelectObject(TmpDC,TmpBmp); //draw the background HDC dcBmp = CreateCompatibleDC(TmpDC); HGDIOBJ TmpObj2 = SelectObject(dcBmp,hbitmap); BitBlt(TmpDC,0,0,w,h,dcBmp,0,0,SRCCOPY); //choose the font CFont m_Font; LOGFONT *m_pLF; m_pLF = (LOGFONT*) calloc(1,sizeof(LOGFONT)); wcsncpy_s(m_pLF->lfFaceName,32,_T("Arial Bold"),11); m_pLF->lfHeight = 32; m_pLF->lfWeight = 0; m_pLF->lfItalic = 0; m_pLF->lfUnderline = 0; HFONT hfont = CreateFontIndirect(m_pLF); HGDIOBJ pOldFont; if (hfont) pOldFont = SelectObject(TmpDC,hfont); else pOldFont = SelectObject(TmpDC,GetStockObject(DEFAULT_GUI_FONT)); //draw the text SetBkMode(TmpDC,TRANSPARENT); SetTextColor(TmpDC,RGB(0,150,0)); TextOut(TmpDC,30,40,_T("Hello, World,") ,13); TextOut(TmpDC,30,140,_T("This is a Test"),14); // cleanup SelectObject(TmpDC,pOldFont); m_Font.DeleteObject(); free(m_pLF); SelectObject(TmpDC,TmpObj2); DeleteDC(dcBmp); DeleteObject(hbitmap); hbitmap = TmpBmp; // Set Background Image SigDev.LCDImageExR(5, 0, 0, (long) hbitmap); //final cleanup SelectObject(TmpDC,TmpObj); DeleteDC(TmpDC); DeleteObject(hbitmap); Â
// Pad Typ StepOver naturaSign Colour, only the SignInfo Area can be changed with API, // the Input area can be change with Imageloader // Create a new Image bmp := TBitmap.Create; bmp.LoadFromResourceName(HInstance, 'IDB_ColourPadDefaultBG'); // load a Image with the correct size (use GetDriverLong with 20 and 21 to read the display size) // Add some text to the Image bmp.Canvas.Brush.Style := bsClear; bmp.Canvas.Font.Name := 'Arial'; bmp.Canvas.Font.Height := 32; bmp.Canvas.Font.Color := clGreen; bmp.Canvas.Font.Style := [fsBold]; bmp.Canvas.TextOut(30,40, 'Hello World'); bmp.Canvas.TextOut(30,140,'This is a Test'); Â // Don't download BG image, don't do alpha-blending for ColourPad default SignMode (for faster Transfer) DRIVER_OPTION1_DISABLE_CP_BACKGROUND_IMAGE = $00001000; StepOverSignatureDevice1.SetDriverLong(0, StepOverSignatureDevice1.GetDriverLong(0) or DRIVER_OPTION1_DISABLE_CP_BACKGROUND_IMAGE ); // Set Background Image SigDev.LCDImageExR(5, 0, 0, bmp.Handle);