0% found this document useful (0 votes)
219 views69 pages

Prolin XUI Interface (V2.1.7)

The document describes the Prolin XUI interface and provides details on its macros, structures, and API functions. It includes overviews of the interface's purpose and features, programming logic, and revisions made across multiple versions. Key sections cover definitions for values, macros, structures used in the interface, and the specifications of over 30 API functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
219 views69 pages

Prolin XUI Interface (V2.1.7)

The document describes the Prolin XUI interface and provides details on its macros, structures, and API functions. It includes overviews of the interface's purpose and features, programming logic, and revisions made across multiple versions. Key sections cover definitions for values, macros, structures used in the interface, and the specifications of over 30 API functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Prolin XUI Interface

V2.1.7

PAX Computer Technology(Shenzhen)Co., Ltd.


Copyright © 2000-2019 PAX Computer Technology (Shenzhen) Co., Ltd.

All rights reserved. No part of the contents of this document may be reproduced or
transmitted in any form without the written permission of PAX Computer Technology
(Shenzhen) Co., Ltd.
The information contained in this document is subject to change without notice.
Although PAX Computer Technology (Shenzhen) Co., Ltd. has attempted to ensure
the accuracy of the contents of this document, this document may include errors or
omissions. The examples and sample programs are for illustration only and may not
be suited for your purpose. You should verify the applicability of any example or
sample program before placing the software into productive use.

I
History of Revisions

Date Version Note Author


2013-05-16 V1.0.0 Draft Xie Lihong
2013-10-18 V2.0.0 Update the document Huang Lei
1. Increase the description of
structure XuiSignPoint and
2014-01-21 V2.0.1 XuiSignData; Huang Lei
2. Add a new interface
XuiSigBoardSignData().
1. Modify the description of the
structure XuiSignPoint;
2014-03-25 V2.0.2 3. Add three new interfaces Huang Lei
XuiCreateCanvasEx(),
XuiCanvasMoveToY(),
XuiImgLoadFromMem().
1. Added the support of bmp
and mbmp in
XuiImgSaveToFile();
2. Modify the ending point of
the signature data to 0xffff in
2015-04-28 V2.0.3 Huang Lei
XuiSigBoardSignData();
3. Modify the parameter type of
maxlen from unsigned to
unsigned int in function
XuiGetHzString().
1. Added the support of
V2.0.4 combination key;
2015-09-02 Huang Lei
2. Added a function
XuiBidiStrdup().
1. Added the instruction in
XuiCreateSignatureBoard();
2. Added alpha_key and
sharp_key to the structure
XuiImeAttr and alpha_key to
the structure XuiGetStrAttr;
2016-03-01 V2.0.5 3. Added XuiShowMode, Huang Lei
XuiAnimationType,XuiGestur
eType,XuiGesture structures
in 2.2 Macro Definition;
4. Added
XuiCanvasAnimation() and
XuiGetGesture().

II
1. Added XuiSetGestureRect()
and XuiClearGesture();
2. Added
XUI_GESTURE_CLICKDO
WN and
XUI_GESTURE_CLICKUP Huang Lei
2016-03-28 V2.0.6
in XuiGestureType of 2.2
macro definition chapter;
3. Added down_x, down_y,
cur_x and cur_y four
members in XuiGesture of
2.4 structure chapter.
1. Added the soft key definition
to 2.1 definition of key
values table;
2. Added two new functions
which are XuiImgCompose() Huang Lei &
2016-04-15 V2.0.7 and Ye Sining
XuiShowSoftKeyboard();
3. The title of this document
changed from “XUI
Programming Guide” to
“Prolin XUI Interface”.
1. Updated the instruction of
XuiRootCanvas();
2. Added two new functions
which are XuiTextWidthEx()
and XuiImgResize();
3. In section 2.1 definition of Huang Lei&
2017-03-01 V2.0.8 key value table, added the Ye Sining
key values for hiding
softkeyboard and
independent key for camera;
4. Modified the default value of
input device node in
XuiOpen().
Added new function Li Xin
2017-09-05 V2.0.9
XuiImgToFrameBuffer().
1. Added functions
XuiCreateCamera(),
XuiCameraCapture(),
XuiCreateScaner(),
XuiScanerDecode() and Li Xin
2017-12-14 V2.1.0
XuiRgbaToImg();
2. Added related macro
definition of camera;
3. Added new definition for
parameter show in

III
XuiShowSoftKeyboard();
4. Added new definition for
parameter mode in
XuiGetString().
Added new function Li Xin
2018-04-10 V2.1.1
XuiCanvasDrawTextEx().
Added new function Li Xin
2018-05-14 V2.1.2
XuiFrameBufferToImg().
1. Added a new macor
XUI_CAMERA_IMG_1024_
480 in table
XuiCameraResolution;
2. Added a new macor Li Xin
2018-11-02 V2.1.3
XUI_PREVIEW_ZOOM_25
in table XuiPreviewZoom;
3. Updated the description of
parameter resolution in
XuiCreateCamera().
Updated the instruction of Li Xin
2019-01-16 V2.1.4
XuiOpen().
Added new functions
XuiImgToGray8(), Li Xin
2019-03-13 V2.1.5
XuiImgToBgr24() and
XuiCameraSetSta().
2019-06-14 V2.1.6 Added support for jepg. Li Xin
Added section
2019-11-14 V2.1.7 “XuiImgLoadFromBase64” and Li Xin
corrected some mistakes.

IV
Table of Contents

1 Introduction ........................................................................................................... 1
1.1 Purpose ...................................................................................................... 1
1.2 Function ...................................................................................................... 1
1.3 Feature ....................................................................................................... 2
1.4 XUI Programming Logic .............................................................................. 2
2 Macro and Structure ............................................................................................. 4
2.1 Definition of Key Values .............................................................................. 4
2.2 Macro Definition ........................................................................................ 12
2.3 Other Macro Definition .............................................................................. 15
2.4 Structure ................................................................................................... 16
3 XUI API ............................................................................................................... 21
3.1 XuiOpen .................................................................................................... 21
3.2 XuiIsRunning............................................................................................. 22
3.3 XuiClose ................................................................................................... 22
3.4 XuiSuspend............................................................................................... 23
3.5 XuiResume ............................................................................................... 23
3.6 XuiRootCanvas ......................................................................................... 23
3.7 XuiStatusbarCanvas ................................................................................. 24
3.8 XuiCreateFont ........................................................................................... 24
3.9 XuiDestroyFont ......................................................................................... 25
3.10 XuiCanvasDrawText .............................................................................. 25
3.11 XuiCanvasDrawTextEx .......................................................................... 26
3.12 XuiCanvasDrawImg ............................................................................... 27
3.13 XuiCanvasDrawRect .............................................................................. 28
3.14 XuiClearArea ......................................................................................... 28
3.15 XuiTextWidth ......................................................................................... 29
3.16 XuiTextWidthEx ..................................................................................... 29
3.17 XuiCreateCanvas ................................................................................... 30

V
3.18 XuiCreateCanvasEx .............................................................................. 31
3.19 XuiCanvasMoveToY .............................................................................. 31
3.20 XuiDestroyWindow ................................................................................ 32
3.21 XuiShowWindow .................................................................................... 32
3.22 XuiCanvasSetBackground ..................................................................... 32
3.23 XuiCreateButton .................................................................................... 33
3.24 XuiButtonSetStat ................................................................................... 33
3.25 XuiButtonSetKey .................................................................................... 34
3.26 XuiCreateSignatureBoard ...................................................................... 34
3.27 XuiSigBoardSetStat ............................................................................... 35
3.28 XuiSigBoardImg ..................................................................................... 35
3.29 XuiSigBoardSignData ............................................................................ 36
3.30 XuiCreateGif .......................................................................................... 36
3.31 XuiHasKey ............................................................................................. 37
3.32 XuiGetKey.............................................................................................. 37
3.33 XuiClearKey ........................................................................................... 38
3.34 XuiCaptureScreen ................................................................................. 38
3.35 XuiCaptureCanvas ................................................................................. 38
3.36 XuiImgLoadFromFile.............................................................................. 39
3.37 XuiImgLoadFromMem ........................................................................... 39
3.38 XuiImgSaveToFile ................................................................................. 40
3.39 XuiImgToRgba ....................................................................................... 40
3.40 XuiImgToGray8 ...................................................................................... 40
3.41 XuiImgToBgr24 ...................................................................................... 41
3.42 XuiImgToFrameBuffer............................................................................ 41
3.43 XuiImgTransform ................................................................................... 42
3.44 XuiImgResize ......................................................................................... 42
3.45 XuiImgCompose .................................................................................... 42
3.46 XuiImgFree ............................................................................................ 43
3.47 XuiSetStatusbarIcon .............................................................................. 43

VI
3.48 XuiGetHzString ...................................................................................... 44
3.49 XuiGetString .......................................................................................... 45
3.50 XuiBidiStrdup ......................................................................................... 46
3.51 XuiCanvasAnimation.............................................................................. 47
3.52 XuiGetGesture ....................................................................................... 48
3.53 XuiSetGestureRect ................................................................................ 48
3.54 XuiClearGesture .................................................................................... 49
3.55 XuiShowSoftKeyboard ........................................................................... 49
3.56 XuiCreateCamera .................................................................................. 50
3.57 XuiCameraSetStat ................................................................................. 51
3.58 XuiCameraCapture ................................................................................ 51
3.59 XuiCreateScaner ................................................................................... 51
3.60 XuiScanerDecode .................................................................................. 52
3.61 XuiRgbaToImg ....................................................................................... 53
3.62 XuiFrameBufferToImg............................................................................ 54
3.63 XuiImgLoadFromBase64 ....................................................................... 54
4 Note .................................................................................................................... 56

4.1 Multi-process............................................................................................. 56
4.2 XuiDestroyWindow.................................................................................... 56
5 FAQ .................................................................................................................... 58

VII
Figure & Table List

Figure 1.1 UI design plan........................................................................................... 2


Table 2.1 Definition of Key Values ............................................................................. 4
Table 2.2 XuiColor ................................................................................................... 12
Table 2.3 XuiTransform ........................................................................................... 12
Table 2.4 XuiButtonStatType ................................................................................... 12
Table 2.5 XuiBgStyle ............................................................................................... 12
Table 2.6 XuiFontSet ............................................................................................... 13
Table 2.7 XuiTextStyle............................................................................................. 13
Table 2.8 XuiSigPenFlat .......................................................................................... 13
Table 2.9 XuiWindowType ....................................................................................... 13
Table 2.10 XuiShowMode........................................................................................ 14
Table 2.11 XuiAnimationType .................................................................................. 14
Table 2.12 XuiGestureType ..................................................................................... 14
Table 2.13 XuiCameraResolution ............................................................................ 15
Table 2.14 XuiPreviewZoom.................................................................................... 15
Table 2.15 Structure XuiWindow ............................................................................. 16
Table 2.16 Structure XuiImg .................................................................................... 16
Table 2.17 Structure XuiButtonStat ......................................................................... 16
Table 2.18 Structure XuiSigBoardStat ..................................................................... 17
Table 2.19 Structure XuiCameraStat ....................................................................... 18
Table 2.20 Structure XuiImeAttr .............................................................................. 18
Table 2.21 Structure XuiGetStrAttr .......................................................................... 19
Table 2.22 Structure XuiSignPoint ........................................................................... 19
Table 2.23 Structure XuiSignData ........................................................................... 20
Table 2.24 Structure XuiGesture ............................................................................. 20

VIII
Prolin XUI Interface

1 Introduction

1.1 Purpose

In contrast to other GUIs, XUI is relatively easy to understand and use. It adopts
imperative programming interfaces, and it is suitable for developing the wizard-style
interface for customer-oriented terminals such as POS machine, handhold terminal
and ATM etc.

XUI cannot implement a variety of special features as complicated as GUI, but in


wizard-style interface, it is simpler and more efficient.

To put it simply, XUI programming is to draw, to write and to wait for keypress.

1.2 Function

The functions of XUI are listed as follows:

 Support black-and-white screen.

 Support monochrome font and gray font.

 Support touch screen.

 Support graphical display.

 Support multi-font display.

PAX Computer Technology (Shenzhen) Co.,Ltd. 1


Prolin XUI Interface

 Support bidirectional text display.

 Support translucent. (Alpha Channel)

 Support screenshot.

 Support outputting the screenshot to printer, which means displaying interface

and printing interface are unified.


 Support multi-platform, including Linux Framebuffer, X11, SDL, Windows, Android,
iOS, platform without operating system etc.
 Support screen rotation.

1.3 Feature

 Imperative programming interface.

 Screen keys and physical buttons are unified.

1.4 XUI Programming Logic

The interface is designed as below.

Figure 1.1 UI design plan

The design only includes three elements: canvas, button and key value.

 Canvas
PAX Computer Technology (Shenzhen) Co.,Ltd. 2
Prolin XUI Interface

1. It must have a RootCanvas, and sub-canvas can be created.

2. Text, picture and buttons can be painted on the canvas.

3. It contains background image and background color, the background will not be

cleared when CLS.

 Button

1. Buttons contain two states, normal and pressed.

2. Each state includes the following parameters: border, background color, icon, text

font, text color and text content.

3. When click on the button, the parameter key takes the value of GetKey(). The key

value and physical button value are in the same queue.

 Key value

1. The key value and physical button value are in the same queue.

2. All windows have only one queue.

3. Not applicable to multithreading.

When programming, operations are mainly done on the RootCanvas. If dialog boxes

are needed, create a sub-canvas and close it after operation.

For printer, user only needs to create a hidden canvas and write on it. After that, cut

out the canvas and send it to the printer.

PAX Computer Technology (Shenzhen) Co.,Ltd. 3


Prolin XUI Interface

2 Macro and Structure

2.1 Definition of Key Values

Table 2.1 Definition of Key Values

Macro Value Description

XUI_KEY1 2 /*1*/

XUI_KEY2 3 /*2*/

XUI_KEY3 4 /*3*/

XUI_KEY4 5 /*4*/

XUI_KEY5 6 /*5*/

XUI_KEY6 7 /*6*/

XUI_KEY7 8 /*7*/

XUI_KEY8 9 /*8*/

XUI_KEY9 10 /*9*/

XUI_KEY0 11 /*0*/

XUI_KEYCANCEL 223 /*Cancel*/

XUI_KEYCLEAR 14 /*Clear*/

PAX Computer Technology (Shenzhen) Co.,Ltd. 4


Prolin XUI Interface

XUI_KEYENTER 28 /*Enter*/

XUI_KEYALPHA 63 /*Alpha*/

XUI_KEYF1 59

XUI_KEYFUNC 102

XUI_KEYUP 103

XUI_KEYDOWN 108

XUI_KEYMENU 139

/*Enter+1*/ The combination of Enter key


XUI_KEYENTER1 30
and Key1.

/*Enter+2*/ The combination of Enter key


XUI_KEYENTER2 31
and Key2.

/*Enter+3*/ The combination of Enter key


XUI_KEYENTER3 32
and Key 3.

/*Enter+4*/ The combination of Enter key


XUI_KEYENTER4 33
and Key4.

/*Enter+5*/ The combination of Enter key


XUI_KEYENTER5 34
and Key5.

/*Enter+6*/ The combination of Enter key


XUI_KEYENTER6 35
and Key6.

/*Enter+7/ The combination of Enter key


XUI_KEYENTER7 36
and Key7.

/*Enter+8/ The combination of Enter key


XUI_KEYENTER8 37
and Key8.

/*Enter+9*/ The combination of Enter key


XUI_KEYENTER9 38
and Key9.

/*Enter+0*/ The combination of Enter key


XUI_KEYENTER0 39
and Key10.

XUI_SOFTKEYBOARD_KEY
0xff+8 /* backspace key */
BACKSPACE

PAX Computer Technology (Shenzhen) Co.,Ltd. 5


Prolin XUI Interface

XUI_SOFTKEYBOARD_KEY
0xff+32 /* space key*/
SPACE

XUI_SOFTKEYBOARD_KEY
0xff+33 /* ! */
EXCLAM

XUI_SOFTKEYBOARD_KEY
0xff+34 /* " */
DOUBLEQUOTE

XUI_SOFTKEYBOARD_KEY
0xff+35 /* # */
SHARP

XUI_SOFTKEYBOARD_KEY
0xff+36 /* $ */
DOLLAR

XUI_SOFTKEYBOARD_KEY
0xff+37 /* % */
PERCENT

XUI_SOFTKEYBOARD_KEY
0xff+38 /* & */
AMPERSAND

XUI_SOFTKEYBOARD_KEY
0xff+39 /* ' */
SINGLEQUOTE

XUI_SOFTKEYBOARD_KEY
0xff+40 /* ( */
PARENLEFT

XUI_SOFTKEYBOARD_KEY
0xff+41 /* ) */
PARENRIGHT

XUI_SOFTKEYBOARD_KEY
0xff+42 /* * */
ASTERISK

XUI_SOFTKEYBOARD_KEY
0xff+43 /* + */
PLUS

XUI_SOFTKEYBOARD_KEY
0xff+44 /* , */
COMMA

XUI_SOFTKEYBOARD_KEY
0xff+45 /* - */
MINUS

XUI_SOFTKEYBOARD_KEY
0xff+46 /* . */
PERIOD

PAX Computer Technology (Shenzhen) Co.,Ltd. 6


Prolin XUI Interface

XUI_SOFTKEYBOARD_KEY
0xff+47 /* / */
SLASH

XUI_SOFTKEYBOARD_KEY0 0xff+48 /* 0 */

XUI_SOFTKEYBOARD_KEY1 0xff+49 /* 1 */

XUI_SOFTKEYBOARD_KEY2 0xff+50 /* 2 */

XUI_SOFTKEYBOARD_KEY3 0xff+51 /* 3 */

XUI_SOFTKEYBOARD_KEY4 0xff+52 /* 4 */

XUI_SOFTKEYBOARD_KEY5 0xff+53 /* 5 */

XUI_SOFTKEYBOARD_KEY6 0xff+54 /* 6 */

XUI_SOFTKEYBOARD_KEY7 0xff+55 /* 7 */

XUI_SOFTKEYBOARD_KEY8 0xff+56 /* 8 */

XUI_SOFTKEYBOARD_KEY9 0xff+57 /* 9 */

XUI_SOFTKEYBOARD_KEY
0xff+58 /* : */
COLON

XUI_SOFTKEYBOARD_KEY
0xff+59 /* ; */
SEMICOLON

XUI_SOFTKEYBOARD_KEY
0xff+60 /* < */
LESS

XUI_SOFTKEYBOARD_KEY
0xff+61 /* = */
EQUAL

XUI_SOFTKEYBOARD_KEY
0xff+62 /* > */
GREATER

XUI_SOFTKEYBOARD_KEY
0xff+63 /* ? */
QUESTION

XUI_SOFTKEYBOARD_KEY
0xff+64 /* @ */
AT

XUI_SOFTKEYBOARD_KEY
0xff+65 /* A */
A

PAX Computer Technology (Shenzhen) Co.,Ltd. 7


Prolin XUI Interface

XUI_SOFTKEYBOARD_KEY
0xff+66 /* B */
B

XUI_SOFTKEYBOARD_KEY
0xff+67 /* C */
C

XUI_SOFTKEYBOARD_KEY
0xff+68 /* D */
D

XUI_SOFTKEYBOARD_KEY
0xff+69 /* E */
E

XUI_SOFTKEYBOARD_KEY
0xff+70 /* F */
F

XUI_SOFTKEYBOARD_KEY
0xff+71 /* G */
G

XUI_SOFTKEYBOARD_KEY
0xff+72 /* H */
H

XUI_SOFTKEYBOARD_KEYI 0xff+73 /* I */

XUI_SOFTKEYBOARD_KEYJ 0xff+74 /* J */

XUI_SOFTKEYBOARD_KEY
0xff+75 /* K */
K

XUI_SOFTKEYBOARD_KEY
0xff+76 /* L */
L

XUI_SOFTKEYBOARD_KEY
0xff+77 /* M */
M

XUI_SOFTKEYBOARD_KEY
0xff+78 /* N */
N

XUI_SOFTKEYBOARD_KEY
0xff+79 /* O */
O

XUI_SOFTKEYBOARD_KEY
0xff+80 /* P */
P

XUI_SOFTKEYBOARD_KEY
0xff+81 /* Q */
Q

PAX Computer Technology (Shenzhen) Co.,Ltd. 8


Prolin XUI Interface

XUI_SOFTKEYBOARD_KEY
0xff+82 /* R */
R

XUI_SOFTKEYBOARD_KEY
0xff+83 /* S */
S

XUI_SOFTKEYBOARD_KEY
0xff+84 /* T */
T

XUI_SOFTKEYBOARD_KEY
0xff+85 /* U */
U

XUI_SOFTKEYBOARD_KEY
0xff+86 /* V */
V

XUI_SOFTKEYBOARD_KEY
0xff+87 /* W */
W

XUI_SOFTKEYBOARD_KEY
0xff+88 /* X */
X

XUI_SOFTKEYBOARD_KEY
0xff+89 /* Y */
Y

XUI_SOFTKEYBOARD_KEY
0xff+90 /* Z */
Z

XUI_SOFTKEYBOARD_KEY
0xff+91 /* [ */
BRACKETLEFT

XUI_SOFTKEYBOARD_KEY
0xff+92 /* \ */
BACKSLASH

XUI_SOFTKEYBOARD_KEY
0xff+93 /* ] */
BRACKETRIGHT

XUI_SOFTKEYBOARD_KEY
0xff+94 /* ^ */
CARET

XUI_SOFTKEYBOARD_KEY
0xff+95 /* _ */
UNDERSCORE

XUI_SOFTKEYBOARD_KEY
0xff+96 /* ` */
BACKQUOTE

PAX Computer Technology (Shenzhen) Co.,Ltd. 9


Prolin XUI Interface

XUI_SOFTKEYBOARD_KEYa 0xff+97 /* a */

XUI_SOFTKEYBOARD_KEY
0xff+98 /* b */
b

XUI_SOFTKEYBOARD_KEYc 0xff+99 /* c */

XUI_SOFTKEYBOARD_KEY
0xff+100 /* d */
d

XUI_SOFTKEYBOARD_KEYe 0xff+101 /* e */

XUI_SOFTKEYBOARD_KEYf 0xff+102 /* f */

XUI_SOFTKEYBOARD_KEY
0xff+103 /* g */
g

XUI_SOFTKEYBOARD_KEY
0xff+104 /* h */
h

XUI_SOFTKEYBOARD_KEYi 0xff+105 /* i */

XUI_SOFTKEYBOARD_KEYj 0xff+106 /* j */

XUI_SOFTKEYBOARD_KEYk 0xff+107 /* k */

XUI_SOFTKEYBOARD_KEYl 0xff+108 /* l */

XUI_SOFTKEYBOARD_KEY
0xff+109 /* m */
m

XUI_SOFTKEYBOARD_KEY
0xff+110 /* n */
n

XUI_SOFTKEYBOARD_KEY
0xff+111 /* o */
o

XUI_SOFTKEYBOARD_KEY
0xff+112 /* p */
p

XUI_SOFTKEYBOARD_KEY
0xff+113 /* q */
q

XUI_SOFTKEYBOARD_KEYr 0xff+114 /* r */

XUI_SOFTKEYBOARD_KEYs 0xff+115 /* s */

PAX Computer Technology (Shenzhen) Co.,Ltd. 10


Prolin XUI Interface

XUI_SOFTKEYBOARD_KEYt 0xff+116 /* t */

XUI_SOFTKEYBOARD_KEY
0xff+117 /* u */
u

XUI_SOFTKEYBOARD_KEYv 0xff+118 /* v */

XUI_SOFTKEYBOARD_KEY
0xff+119 /* w */
w

XUI_SOFTKEYBOARD_KEYx 0xff+120 /* x */

XUI_SOFTKEYBOARD_KEYy 0xff+121 /* y */

XUI_SOFTKEYBOARD_KEYz 0xff+122 /* z */

XUI_SOFTKEYBOARD_KEY
0xff+123 /* { */
BRACELEFT

XUI_SOFTKEYBOARD_KEY
0xff+124 /* | */
BAR

XUI_SOFTKEYBOARD_KEY
0xff+125 /* } */
BRACERIGHT

XUI_SOFTKEYBOARD_KEY
0xff+126 /* ~ */
TILDE

XUI_SOFTKEYBOARD_HIDE 0xff+255 /* hide */

XUI_KEYCAMERA 212 Independent key of camera

1. All the combination keys must be generated through “Enter”

key and digital key on the physical keypad, and virtual key

cannot generate combination keys. But if the virtual key is

bound to the value of a certain combination key, then in this

case, this virtual key can also generate this combination key

value.

2. D200 (touch-key) doesn‟t support combination key.

3. In addition, the value of soft keyboard minus 0xff will be

PAX Computer Technology (Shenzhen) Co.,Ltd. 11


Prolin XUI Interface

equal to the key value defined by ASCII.

2.2 Macro Definition

Table 2.2 XuiColor

Macro Description

b Blue channel

g Green channel

r Red channel

a ALPHA channel

Table 2.3 XuiTransform

Macro Description

XUI_ROTATE_0 No rotation

XUI_ROTATE_90 Rotate clockwise by 90 degrees

XUI_ROTATE_180 Rotate clockwise by 180 degrees

XUI_ROTATE_270 Rotate clockwise by 270 degrees

XUI_FLIP_VERT Flip vertically

XUI_FLIP_HORIZ Flip horizontally

Table 2.4 XuiButtonStatType

Macro Description

XUI_BTN_NORMAL Normal state

XUI_BTN_PRESSED Pressed State

Table 2.5 XuiBgStyle

Macro Description

PAX Computer Technology (Shenzhen) Co.,Ltd. 12


Prolin XUI Interface

Normal, display the picture from the origin


XUI_BG_NORMAL
x, y.

XUI_BG_TILE Tile

XUI_BG_CENTER Center

XUI_BG_FOUR_CORNER Stretch to four corners

Table 2.6 XuiFontSet

Macro Description

XUI_FONT_MONO Monochrome font(black and white)

XUI_FONT_GREY Grey font

Table 2.7 XuiTextStyle

Macro Description

XUI_TEXT_NORMAL Normal

XUI_BOLD Bold

XUI_ITALIC Italic

XUI_TEXT_BOLD_ITALIC Bold and italic

Table 2.8 XuiSigPenFlat

Macro Description

XUI_SIG_FLAT Signing Board with smooth processing

The normal Signing Board without smooth


XUI_SIG_NORMAL
processing

Table 2.9 XuiWindowType

Macro Description

XUI_WIN_CANVAS Canvas window

XUI_WIN_BUTTON Button window

XUI_WIN_GIF GIF window

PAX Computer Technology (Shenzhen) Co.,Ltd. 13


Prolin XUI Interface

XUI_WIN_SIGBOARD Signature Board window

Table 2.10 XuiShowMode

Macro Description

XUI_SHOW_NORMAL Display on the screen normally

XUI_SHOW_MIRROR Display on the mirror

Display on the screen and mirror at the


XUI_SHOW_ALL
same time.

Table 2.11 XuiAnimationType

Macro Description

XUI_TRANSLATION Translate right or left.

XUI_POLL Translate up or down

XUI_SCALE Scale

Table 2.12 XuiGestureType

Macro Description

XUI_GESTURE_FLINGLEFT Slid to the left

XUI_GESTURE_FLINGRIGHT Slid to the right

XUI_GESTURE_FLINGUP Slid up

XUI_GESTURE_FLINGDOWN Slid down

XUI_GESTURE_FLINGZOOMOUT Zoom out with two fingers

XUI_GESTURE_FLINGZOOMIN Zoom in with two fingers.

XUI_GESTURE_SCROLLLEFT Scroll to the left

XUI_GESTURE_SCROLLRIGHT Scroll to the right

XUI_GESTURE_SCROLLUP Scroll up

XUI_GESTURE_SCROLLDOWN Scroll down

XUI_GESTURE_SCROLLZOOMOUT Zoom out with two fingers

PAX Computer Technology (Shenzhen) Co.,Ltd. 14


Prolin XUI Interface

XUI_GESTURE_SCROLLZOOMIN Zoom in with two fingers

XUI_GESTURE_CLICKDOWN Click down finger event

XUI_GESTURE_CLICKUP Click up finger event

Table 2.13 XuiCameraResolution

Macro Description

XUI_CAMERA_IMG_640_480 Img Width is 640 and img height is 480

XUI_CAMERA_IMG_1024_480 Img Width is 1024 and img height is 480

Table 2.14 XuiPreviewZoom

Macro Description

XUI_PREVIEW_ZOOM_100 The resolution of camera preview window


is the same as output’s

XUI_PREVIEW_ZOOM_75 The resolution of camera preview window


is 75% of output’s

XUI_PREVIEW_ZOOM_50 The resolution of camera preview window


is 50% of output’s

XUI_PREVIEW_ZOOM_25 The resolution of camera preview window


is 25% of output’s

2.3 Other Macro Definition

Macro Description

XUI_RIGHT_X(_x, _width, Get text in the right-most position


_extend) within _width (text-align right)

XUI_CENTER_X(_x, _width, Get text in the middle position within


_extend) _width (text-align horizontal center)

XUI_CENTER_Y(_y, _height, Get text in the middle position within


_extend) _height (text-align vertical center)

PAX Computer Technology (Shenzhen) Co.,Ltd. 15


Prolin XUI Interface

2.4 Structure

1. Structure XuiWindow

Table 2.15 Structure XuiWindow

Structure Member Description

width Window width

height Window height

widget Window related canvas pointer

type Window type, refers to


XuiWindowType

key Window related key values

2. Structure XuiImg

Table 2.16 Structure XuiImg

Structure Member Description

width Img width

height Img height

priy Img data pointer

3. Structure XuiButtonStat

Table 2.17 Structure XuiButtonStat

Structure Member Description

rounded corner(0 means no


btn_round rounded corner, 1 means rounded
corner, and the default value is 0)

btn_bg background color

Text text

text_fg text color

PAX Computer Technology (Shenzhen) Co.,Ltd. 16


Prolin XUI Interface

text_font text font

text_x text position:x

text_y text position:y

text_height text height(font size)

Img Image

img_x Image position:x

img_y Image position:y

img_style Image type

4. Structure XuiSigBoardStat

Table 2.18 Structure XuiSigBoardStat

Structure Member Description

rounded corner (0 means has no


rounded corner, 1 means has
btn_round
rounded corner, and the default value
is 0)

Background color (Transparency is


btn_bg
not supported)

text text

text_fg text color

text_font text font

text_x Text position: x

text_y Text position: y

text_height Text height(font size)

img Image

img_x Image position: x

img_y Image position: y

img_style image type

PAX Computer Technology (Shenzhen) Co.,Ltd. 17


Prolin XUI Interface

pen_fg pen color

pen_width Pen width (ranges from 1 to 10)

pen_flat Pen with smooth processing

5. Structure XuiCameraStat

Table 2.19 Structure XuiCameraStat

Structure Member Description

text Text

text_fg Text color

text_font Text font

text_x Text position: x

text_y Text position: y

text_height Text height (font size)

img image

img_x Image position: x

img_y Image position: y

img_style image type

6. Structure XuiImeAttr

Table 2.20 Structure XuiImeAttr

Structure Member Description

parent Parent canvas (valid canvas pointer)

x IME position x (greater than 0)

y IME position y (greater than 0)

width IME width (greater than 0)

IME height (greater than 4*


height
(text_size+10))

PAX Computer Technology (Shenzhen) Co.,Ltd. 18


Prolin XUI Interface

text_font IME text font (pointer of valid font)

text_size IME text size (greater than 12)

text_fg IME text color

focus_fg Switch IME color

img IME background image

IME background color (transparency


img_bg
is not supported)

alpha_key Customize alpha key value

sharp_key Customize sharp key value

7. Structure XuiGetStrAttr

Table 2.21 Structure XuiGetStrAttr

Structure Member Description

parent Parent canvas (valid canvas pointer)

x Input position x (greater than 0)

y Input position y (greater than 0)

font Input text font (valid font pointer)

size Input text size (greater than 12)

fg Input text color

alpha_key Customize alpha key value.

8. Structure XuiSignPoint

Table 2.22 Structure XuiSignPoint

Structure Member Description

x The value of x coordinate of Signature point, the type


is unsigned short.

y The value of y coordinate of Signature point, the type


is unsigned short.

PAX Computer Technology (Shenzhen) Co.,Ltd. 19


Prolin XUI Interface

9. Structure XuiSignData

Table 2.23 Structure XuiSignData

Structure Member Description

point_array Array of XuiSignPoint structure, which


is used to save the coordinates of all
the signature track points

point_len Length of Point_array, the number of


saved signature track points

10. Structure XuiGesture

Table 2.24 Structure XuiGesture

Structure Member Description

type Gesture type, for more information ,


please refer to XuiGestureType

velocity The velocity of sliding the screen.

distance The sliding distance.

The x-coordinate of where the finger


down_x
presses down.

The y-coordinate of where the finger


down_y
presses down.

cur_x The current x-coordinate of gesture.

cur_y The current y-coordinate of gesture.

PAX Computer Technology (Shenzhen) Co.,Ltd. 20


Prolin XUI Interface

3 XUI API

3.1 XuiOpen

int XuiOpen(int argc,


Prototype
char **argv);
Function Open XUI and initialize it.
argc【Input】 Number of parameters
Parameters
argv【Input】 Parameter list
0 Succeeded
Return
<0 Failed
The supported formats for argv are as below:
FB=xxxxx. /*Device node of framebuffer, and the default is
"/dev/graphics/fb0".*/
INPUT=xxxx /*Input device nodes, multiple nodes are
allowed, and the default is "/dev/keypad" or "/dev/tp ". The input
device is loaded by default only if the application does not set
the parameter, if the application have set the parameter, only
Instruction the device node that have been set will be loaded. For example,
if this parameter is set to INPUT=/dev/tp, when XUI is
initialized, only the default touch screen input will be loaded and
the physical keyboard will not be loaded, which is equivalent to
blocking the physical key input. */
ROTATE=xxx /*Screen rotation (values can be 0,90,180, the
default value is 0, the default value will be used when the value
is invalid)*/

PAX Computer Technology (Shenzhen) Co.,Ltd. 21


Prolin XUI Interface

TSDEV=xxxx /*Device node of touch screen, the default is


"/dev/input/event2".*/
STATUSBAR=xxx /*Height of the status bar(0-64 , the
default value is 0, the default value will be used when value is
invalid) */
For example:
char *xui_argv[] = {"ROTATE=90","STATUSBAR=18"};
XuiOpen(sizeof(xui_argv)/sizeof(xui_argv[0]), xui_argv);

1. When calling XuiOpen() for multiple times, only the first time
takes effect, the later calls will not work unless XuiClose() is
called.
2. When parameter argc=0 and argv=NULL, default settings will
be enabled.
3. XUI does not support multi-process, Calling XuiOpen()
between different processes will cause screen robbery
during canvas operations.
4. Parameters in argv are independent.
5. After setting the ROTATE parameter in argv, the left upper
corner of the screen will be defined as coordinate origin in
the subsequent operations for API.
6. Xuiopen() must be called before calling other related
interfaces.

3.2 XuiIsRunning

Prototype int XuiIsRunning(void);


Function Check if the XUI is running.
Parameters None
1 Running.
Return
0 Not running.
Instruction

3.3 XuiClose

Prototype void XuiClose(void);


Function Close the XUI.
Parameters None

PAX Computer Technology (Shenzhen) Co.,Ltd. 22


Prolin XUI Interface

Return None
Instruction Call this function when the application exits.

3.4 XuiSuspend

Prototype int XuiSuspend(void);


Function Suspend the XUI.
Parameters None
0 Succeeded
Return
-1 Failed
1. When the application needs to call another process which
occupies fb and event resource. This function needs to be
Instruction called suspend the XUI; otherwise, two processes will
preempt fb and event resource at the same time.
2. After suspension, if necessary, call XuiResume() to resume
the operation.

3.5 XuiResume

Prototype int XuiResume(void);


Function Resume the running status from suspended state.
Parameters None
0 Succeeded
Return
-1 Failed
Key and touchscreen events will no longer be received after
Instruction calling XuiSuspend(), so the XUI can‟t be resumed through
those events, it can only be resumed through this function.

3.6 XuiRootCanvas

Prototype XuiWindow *XuiRootCanvas(void);


Function Get root canvas.
Parameters None
NULL Failed
Return
Others Pointer of the root canvas
Instruction 1. Call this function to do the operation on the root canvas:

PAX Computer Technology (Shenzhen) Co.,Ltd. 23


Prolin XUI Interface

For example:
XuiWindow* root;
root= XuiRootCanvas();
XuiCanvasSetBackground(root,XUI_BG_NORMAL,img_bg,col
or_bg);
2. When the height of status bar exists, the canvas height is
the same as screen height.

3.7 XuiStatusbarCanvas

Prototype XuiWindow * XuiStatusbarCanvas(void);


Function Get status bar canvas.
Parameters None
NULL Failed
Return
Others Pointer of the status bar canvas
Instruction It is similar to XuiRootCanvas().

3.8 XuiCreateFont

XuiFont *XuiCreateFont(char *fontfile,


Prototype int index,
XuiFontSet fontset);
Function Create font.
fontfile【Input】 Path of the font file.
index【Input】 Index of the font file.
Parameters Font style, it supports monochrome and grey
Fontset【Input】 modes.
Details refer to XuiFontSet.
NULL Failed
Return
Others Font pointer
Font of displaying text is created by this function.
For Example:
Instruction
XuiFont *font_simsun_0;
font_simsun_0 = XuiCreateFont("/usr/font/paxfont.ttf", 0, 0);

PAX Computer Technology (Shenzhen) Co.,Ltd. 24


Prolin XUI Interface

1. Custom font and ttc/ttf vector fonts are supported.


2. The font is matched according to parameter fontfile. Firstly,
match it with custom font by default, if it doesn‟t match, then
match it with ttf or ttc font. If it doesn‟t match with all these
three font types, NULL will be returned.
3. The parameter index is valid for ttc font; it is used to specify a
font type of ttc font. It must be 0 for custom font and ttf font
since these two only contain one type of font.
4. Users can call XuiDestroyFont() to destroy the created fonts
which are no longer needed.
5. The custom font is created by fontextract tool, which can
create highly customized bitmap fonts.

3.9 XuiDestroyFont

Prototype void XuiDestroyFont(XuiFont *font);


Function Destroy fonts.
Parameters font【Input】 Font pointer
Return None
Instruction Destroy the fonts created by XuiCreateFont().

3.10 XuiCanvasDrawText

int XuiCanvasDrawText(XuiWindow *window,


unsigned int x,
unsigned int y,
unsigned int height,
Prototype
XuiFont *font,
XuiTextStyle textstyle,
XuiColor fg,
char *text);
Function Display string on canvas window.
window 【Input】 Canvas window
x【Input】 The position x relative to canvas window.
y【Input】 The position y relative to canvas window.
Parameters
height【Input】 Text height.
font【Input】 Font, created by XuiCreateFont().
textstyle【Input】 Text style (bold, italic), details refer to the

PAX Computer Technology (Shenzhen) Co.,Ltd. 25


Prolin XUI Interface

XuiTextStyle.
fg【Input】 Font color.
text【Input】 Text (UTF-8 code).
0 Succeeded
Return
<0 Failed
1. Auto linefeed is not supported. When the displaying length
is beyond the canvas, the excess part will not be displayed.
2. Parameter text only supports UTF -8 coding; other formats
Instruction should be converted to UTF-8 code first.
3. Parameter window must be a valid canvas pointer, or it will
lead to a crash. And this warning applies to all the following
interfaces.

3.11 XuiCanvasDrawTextEx

int XuiCanvasDrawTextEx(XuiWindow *window,


unsigned int x,
unsigned int y,
unsigned int height,
Prototype XuiFont *font,
XuiTextStyle textstyle,
XuiColor fg,
char *text,
int linebreak);
Display string on canvas window, and added an auto linefeed
Function function on the basis of XuiCanvasDrawText().
window 【Input】 Canvas window
x【Input】 The position x relative to canvas window.
y【Input】 The position y relative to canvas window.
height【Input】 Text height.
font【Input】 Font, created by XuiCreateFont().
Parameters
Text style (bold, italic), details refer to the
textstyle【Input】
XuiTextStyle.
fg【Input】 Font color.
text【Input】 Text (UTF-8 code).
Whether to enable the auto linefeed
linebreak【Input】
function, 1-enable; 2-disable.

PAX Computer Technology (Shenzhen) Co.,Ltd. 26


Prolin XUI Interface

0 Succeeded
Return
<0 Failed
1. When the linebreak value is 0, this function is equivalent to
XuiCanvasDrawText(); Only when the linebreak value is 1
can the auto linefeed function be enabled. When the
displaying length is beyond the canvas, the excess part will
not be displayed.
Instruction 2. Parameter text only supports UTF -8 coding; other formats
should be converted to UTF-8 code first.
3. Parameter window must be a valid canvas pointer, or it will
lead to a crash. And this warning applies to all the following
interfaces.

3.12 XuiCanvasDrawImg

int XuiCanvasDrawImg(XuiWindow *window,


unsigned int x,
unsigned int y,
Prototype unsigned int width,
unsigned int height,
XuiBgStyle bgstyle,
XuiImg *img);
Function Display images on the canvas window.
window 【Input】 Canvas window
x【Input】 The position x relative to canvas window.
y【Input】 The position y relative to canvas window.
width【Input】 Image width.
Parameters
height【Input】 Image height.
Background style, details refer to the
bgstyle【Input】
XuiBgStyle.
img【Input】 Image pointer.
0 Succeeded
Return
<0 Failed
Parameter img must be a valid image pointer created by
Instruction XuiImgLoadFormFile(); otherwise, the image can‟t be displayed
correctly.

PAX Computer Technology (Shenzhen) Co.,Ltd. 27


Prolin XUI Interface

3.13 XuiCanvasDrawRect

int XuiCanvasDrawRect(XuiWindow *window,


unsigned int x,
unsigned int y,
unsigned int width,
Prototype
unsigned int height,
XuiColor fg,
int round,
int fill);
Function Display rectangle on the canvas window.
window 【Input】 Canvas window
x【Input】 The position x relative to canvas window.
y【Input】 The position y relative to canvas window.
width【Input】 Rectangle width.

Parameters height【Input】 Rectangle height.


Fg【Input】 Foreground color.
1: Rounded,
round【Input】
0: Rectangular.
1: Filled
fill【Input】
0: Hollowed
0 Succeeded
Return
<0 Failed
Instruction

3.14 XuiClearArea

int XuiClearArea(XuiWindow *window,


unsigned int x,
Prototype unsigned int y,
unsigned int width,
unsigned int height);
Clear the canvas area and cleared area will show the window
Function background color.
window 【Input】 Canvas window
Parameters
x【Input】 The position x relative to canvas window

PAX Computer Technology (Shenzhen) Co.,Ltd. 28


Prolin XUI Interface

y【Input】 The position y relative to canvas window


width 【Input】 Width of clearing area
height【Input】 Height of clearing area
0 Succeeded
Return
<0 Failed
When multiple canvases are overlapped, only the content
Instruction specified by parameter window will be cleared.

3.15 XuiTextWidth

int XuiTextWidth(XuiFont *font,


Prototype int size,
char *text);
Function Get the text width.
The specified font created by
font 【Input】
XuiCreateFont()
Parameters size【Input】 Font size (text height)
text【Input】 Text string
Return string width
1. Call this function when setting text alignment to center or
right.
2. Parameter font must be a valid font created by
XuiCreateFont(); otherwise, it will cause program crash.
Instruction When font is NULL, the width of returned string is 0.
3. Parameter text must be a valid string pointer. When text is
NULL, the width of returned string is 0.
4. When size <=0, the width of returned string is 0.
5. Only UTF-8 coding is supported; other formats need to be
converted to UTF-8 code first.

3.16 XuiTextWidthEx

int XuiTextWidthEx(XuiFont *font,


int size,
Prototype
XuiTextStyle textstyle,
char *text);
Get text width, this is an extended interface which can
Function accurately acquire the width of bold and italic text.

PAX Computer Technology (Shenzhen) Co.,Ltd. 29


Prolin XUI Interface

The specified font created by


font【Input】
XuiCreateFont()
size【Input】 Font size (text height)
Parameters
Text type (bold, italic), details refer to
textstyle【Input】
XuiTextStyle.
text【Input】 Text string
Return string width
1. Call this function when setting text alignment to center or
right.
2. Parameter font must be a valid font created by
XuiCreateFont(); otherwise, it will cause program crash.
Instruction When font is NULL, the width of returned string is 0.
3. Parameter text must be a valid string pointer. When text is
NULL, the width of returned string is 0.
4. When size <=0, the width of returned string is 0.
5. Only UTF-8 coding is supported; other formats need to be
converted to UTF-8 code first.

3.17 XuiCreateCanvas

XuiWindow *XuiCreateCanvas(XuiWindow *parent,


unsigned int x,
Prototype unsigned int y,
unsigned int width,
unsigned int height);
Function Create canvas.
parent【Input】 Parent canvas
x【Input】 The position x relative to canvas window

Parameters y【Input】 The position y relative to canvas window


width【Input】 Canvas width
height【Input】 Canvas height
NULL Failed
Return Others Canvas pointer
1. Parameter parent must be a valid canvas pointer, and this
rule also applies to the following interfaces.
Instruction 2. The new canvas will be displayed on the screen by calling
XuiShowWindow(), and the parent canvas will be covered.

PAX Computer Technology (Shenzhen) Co.,Ltd. 30


Prolin XUI Interface

3.18 XuiCreateCanvasEx

XuiWindow *XuiCreateCanvasEx(XuiWindow *parent,


unsigned int x,
unsigned int y,
Prototype
unsigned int width,
unsigned int height,
unsigned int vh);
Create the movable canvas window, and the canvas height can
Function
be greater than the window height.
parent【Input】 Parent canvas
The position x of canvas window relative to
x【Input】
the parent canvas
The position y of canvas window relative to
y【Input】
Parameters the parent canvas
width【Input】 width of the canvas window
height【Input】 height of the canvas window
The height of the actual operation area of the
vh【Input】
canvas
NULL Failed
Return
Others Pointer of the canvas window
1. The canvas width cannot be greater than the window width.
Instruction 2. When the parameter vh is not more than height, this
function is equivalent to the XuiCreateCanvas().

3.19 XuiCanvasMoveToY

void XuiCanvasMoveToY(XuiWindow * window,


Prototype
unsigned int my);
Function Move the canvas in the canvas window.
Parent canvas created by
parent 【Input】
XuiCreateCanvasEx().
Parameters The moving height of canvas, the height is
my【Input】 relative to the original height of canvas
window.
Return None

Instruction 1. This function takes no effect on the canvas created by


XuiCreateCanvas(). It is only valid when the canvas is

PAX Computer Technology (Shenzhen) Co.,Ltd. 31


Prolin XUI Interface

created by XuiCreateCanvasEx() and actual canvas height


is greater than the window height.
2. Canvas can only be moved within the canvas window.
3. When moving the canvas, only the contents drawn by the
function of XuiCanvasDraw() series are moveable, but
sub-windows such as button, signature board and GIF are
unmovable.

3.20 XuiDestroyWindow

Prototype void XuiDestroyWindow(XuiWindow *window);


Function Destroy the canvas windows.
Parameters window 【Input】 Canvas window
1. Destroy the canvas windows created by
XuiCreateCanvas(), XuiCreateButton(),
XuiCreateSignatureBoard() and XuiCreateGIF().
Instruction
2. When destroying the nested canvas windows, user should
follow the principle of “the former created canvas windows
should be destroyed after the latter created canvas
windows”.

3.21 XuiShowWindow

void XuiShowWindow(XuiWindow *window,


Prototype int show,
int flag);
Function Show or hide the window.
window【Input】 window
1: Show
show【Input】
Parameters 0: Hide
Reserved for future use, the default value is
flag【Input】
0.
Return None
Instruction

3.22 XuiCanvasSetBackground

void XuiCanvasSetBackground(XuiWindow *window,


Prototype XuiBgStyle bgstyle,

PAX Computer Technology (Shenzhen) Co.,Ltd. 32


Prolin XUI Interface

XuiImg *img,
XuiColor bg);
Function Set the canvas background.
window【Input】 Canvas
Background style. Details refer to the
bgstyle【Input】
Parameters XuiBgStyle.
img【Input】 Image, NULL indicates no image.
bg Background color.
Return None
1. Screen will be cleared after calling this function.
2. This interface only takes effect on the canvas specified by
Instruction window. Other canvas area will not be affected.
3. It does not support transparency in the background.

3.23 XuiCreateButton

XuiWindow *XuiCreateButton(XuiWindow *parent,


unsigned int x,
Prototype unsigned int y,
unsigned int width,
unsigned int height);
Function Create button in canvas.
parent【Input】 Parent canvas
x【Input】 The position x relative to canvas window

Parameters y【Input】 The position y relative to canvas window


width 【Input】 width
height【Input】 height
NULL Failed
Return
Others Button pointer
Instruction

3.24 XuiButtonSetStat

int XuiButtonSetStat(XuiWindow *window,


Prototype XuiButtonStatType type,
XuiButtonStat *stat);

PAX Computer Technology (Shenzhen) Co.,Ltd. 33


Prolin XUI Interface

Function Set the button state.


window 【Input】 Button
State type, details refer to macro
type 【Input】
Parameters XuiButtonStatType.
State variable, details refer to structure
stat【Input】
XuiButtonStat.
0 Succeeded
Return
<0 Failed
1. The setting takes effect immediately after calling this
function.
2. The parameter stat must be a valid state pointer; otherwise,
Instruction
it will lead to crashes. It also applies to the following
interfaces.
3. When stat‟s text_font and text are NULL, the function can
return correctly, but text will not be displayed.

3.25 XuiButtonSetKey

int XuiButtonSetKey(XuiWindow *window,


Prototype
int key);
Function Set the key value of the button.
window 【Input】 Button
Parameters
key【Input】 Key value (key>0)
0 Succeeded
Return
<0 Failed
1. After releasing the button, key values can be acquired
Instruction through XuiGetKey().
2. The key value must be greater than 0.

3.26 XuiCreateSignatureBoard

XuiWindow * XuiCreateSignatureBoard(XuiWindow
*parent, unsigned int
x,
Prototype unsigned int y,
unsigned int width,
unsigned int height);
Function Create the signature board.

PAX Computer Technology (Shenzhen) Co.,Ltd. 34


Prolin XUI Interface

parent【Input】 Parent canvas.


x【Input】 The position x relative to canvas window.

Parameters y【Input】 The position y relative to canvas window.


width 【Input】 Width.
height【Input】 Height.
NULL Failed
Return
Others Pointer of the signature board
1. When creating signature board, canvases cannot be
overlapped.
Instruction 2. Prolin-2.4 doesn‟t support multi-touch.
3. Prolin-phoenix-2.5 support multi-touch and it supports up to
3 points.

3.27 XuiSigBoardSetStat

int XuiSigBoardSetStat (XuiWindow *window,


Prototype XuiSigBoardStat *stat);
Function Set the state of signature board.
window【Input】 Signature board.
Parameters State variable, details refer to the structure
stat【Input】
XuiSigBoardStat.
0 Succeeded
Return
<0 Failed
1. The setting will take effect immediately after calling this
function.
2. When pen_flat is XUI_SIG_FLAT in parameter stat , pen
color and pen width can‟t be changed.
Instruction 3. When text_font and text are NULL in parameter stat, the
function will return correctly, but the text will not be
displayed.
4. The background of signature board does not support
semitransparency.

3.28 XuiSigBoardImg

Prototype XuiImg * XuiSigBoardImg(XuiWindow *window);


Function Get the signature image.

PAX Computer Technology (Shenzhen) Co.,Ltd. 35


Prolin XUI Interface

Parameters window【Input】 Signature board。


NULL Failed
Return
Others Image pointer
After calling this function, call XuiImgFree() to release the
Instruction image.

3.29 XuiSigBoardSignData

Prototype XuiSignData* XuiSigBoardSignData(XuiWindow *window);


Function Get the signature data.
Parameters window【Input】 Signature board
NULL Failed
Return Data pointer, details refer to structure
Others
XuiSignData.
1. Record the location of the signature point, the ending point
of signature is 0xffff.
Instruction 2. The obtained signature data pointer does not need to be
released.

3.30 XuiCreateGif

XuiWindow * XuiCreateGif(XuiWindow *parent,


unsigned int x,
unsigned int y,
Prototype
unsigned int width,
unsigned int height ,
const char* path);
Function Create the GIF animation.
parent【Input】 Parent canvas.
x【Input】 The position x relative to canvas window.
y【Input】 The position y relative to canvas window.
Parameters
width【Input】 width
height【Input】 height
path【Input】 path of GIF image
Return NULL Failed

PAX Computer Technology (Shenzhen) Co.,Ltd. 36


Prolin XUI Interface

Others Pointer of GIF window


Instruction

3.31 XuiHasKey

Prototype int XuiHasKey(void);


Function Check whether the key value exists or not.
Parameters None
1 Yes
Return
0 No
Instruction

3.32 XuiGetKey

Prototype int XuiGetKey(void);


Function Get the key.
Parameters None
Return Key value.
1. This function won‟t return until there is a key value.
2. All keypress events are triggered when lifting, except for
long keypress events.
3. The method to get long keypress: When a physical key is
pressed for more than 3 seconds, the long keypress value
XUI_KEYLONGPRESS will be got after calling this function.
Then call this function again to get the value of the pressed
physical key, but the key value will not be reported again
when the key is lifted. For example, if you press Clear key for
Instruction more than 3 seconds, XUI_KEYLONGPRESS will be
returned after calling XuiGetKey(), and XUI_KEYCLEAR
will be returned after calling XuiGetKey() again, but the
XUI_KEYCLEAR will not be reported again when lifting the
Clear key.
4. "Enter+ number" defines the combination of keys, so long
press Enter key will not trigger the long keypress value.
Cancel key is used as a power key on some models, so long
press Cancel key will not trigger the long keypress value
either.

PAX Computer Technology (Shenzhen) Co.,Ltd. 37


Prolin XUI Interface

3.33 XuiClearKey

Prototype void XuiClearKey(void);


Function Clear the key buffer.
Parameters None
Return None
Clear the key buffer queue, this buffer is a dynamic linked list
Instruction and the length is not fixed.

3.34 XuiCaptureScreen

Prototype XuiImg *XuiCaptureScreen(void);


Function Capture the screen.
Parameters None
NULL Failed
Return
Others Pointer of image
After calling this function, call XuiImgFree() to release the
Instruction screenshot.

3.35 XuiCaptureCanvas

XuiImg *XuiCaptureCanvas(XuiWindow *window,


unsigned int x,
Prototype unsigned int y,
unsigned int width,
unsigned int height);
Function Capture the canvas.
window 【Input】 canvas
The starting position x relative to canvas
x【Input】
window
Parameters y【Input】 The starting position y relative to canvas
window
width【Input】 width
height【Input】 height
Return NULL Failed

PAX Computer Technology (Shenzhen) Co.,Ltd. 38


Prolin XUI Interface

Others Pointer of image


1. After using this interface, call XuiImgFree() to release the
canvas.
2. It will not capture the button on the canvas when capturing
the canvas.
Instruction 3. It also applies to hidden canvas.
4. Compare the parameter width (height) with the width
(height) of canvas, and the smaller value will be used as the
width (height) of the captured image.

3.36 XuiImgLoadFromFile

Prototype XuiImg *XuiImgLoadFromFile(const char *file);


Function Load the image from a file.
Parameters file【Input】 The file path.
NULL Failed
Return
Others Pointer of image
Instruction Currently it only supports images in bmp, png and jpeg format.

3.37 XuiImgLoadFromMem

XuiImg *XuiImgLoadFromMem(unsigned char *address,


Prototype unsigned long length,
int type);
Function Load the image from the image data buffer.
address【Input】 Address of the image data buffer
length【Input】 Length of the image data buffer

Parameters Image data types.


0 represents bmp data,
type 【Input】
1 represents png data.
2 represents JPEG data.
NULL Failed
Return
Others Image pointer

Instruction Currently it only supports images in bmp, jpeg and png format.

PAX Computer Technology (Shenzhen) Co.,Ltd. 39


Prolin XUI Interface

3.38 XuiImgSaveToFile

int XuiImgSaveToFile(XuiImg *img,


Prototype
const char *file);
Function Save the image to a file.
img【Input】 Image pointer.
The file path of the image to be saved.
Parameters Distinguish the different file types according
file 【Input】 to suffixes. It supports suffixes of png, bmp
(24-bit true color), and mbmp
(monochrome bmp).
0 Succeeded
Return
<0 Failed
Currently it supports png, 24-bit true color bmp and
Instruction monochrome bmp, the suffix of monochrome bmp is mbmp.

3.39 XuiImgToRgba

int XuiImgToRgba(XuiImg *img,


Prototype
char *rgba);
Function Save the image to the rgba buffer.
img【Input】 Image pointer
Parameters
rgba 【Input】 rgba buffer.
0 Succeeded
Return
<0 Failed
1. It does not detect the buffer size, please allocate a buffer
with size of 4* width * height to save the image.
Instruction 2. The parameter img must be a valid XuiImg pointer; this rule
also applies to the following functions.

3.40 XuiImgToGray8

int XuiImgToGray8(XuiImg *img,


Prototype
const char *gray8);
Function Save the image to the gray8 buffer, one byte (8bit) for each pixel.
Parameters img【Input】 Image pointer

PAX Computer Technology (Shenzhen) Co.,Ltd. 40


Prolin XUI Interface

gray8【Output】 Gray8 buffer


0 Succeeded
Return
<0 Failed
1. This function does not detect the buffer size, please
Instruction allocate the buffer size of width * height;
2. The img should be a valid XuiImg pointer.

3.41 XuiImgToBgr24

int XuiImgToBgr24(XuiImg *img,


Prototype
char *bgr24);
Save the image to the bgr24 buffer, three byte (24bit) for each
Function pixel.
img【Input】 Image pointer
Parameters
bgr24【Output】 bgr24 buffer
0 Succeeded
Return
<0 Failed
1. This function does not detect the buffer size, please
allocate the buffer size of 4 * width * height;
2. The img should be a valid XuiImg pointer;
Instruction 3. Each pixel is described with 3 bytes. In every 3 bytes, the
values of b, g and r of this point are represented
respectively in byte order.

3.42 XuiImgToFrameBuffer

int XuiImgToFrameBuffer(XuiImg *img,


Prototype unsigned char* data,
unsigned int size);
Function Convert the image content to framebuffer data.
img【Input】 Image pointer

Parameters data【Output】 Framebuffer data buffer


size【Input】 The size of data buffer
>0 The length of the output framebuffer data
Return
<0 Failed
1. The size of data buffer is [img width]*[img height]*[the bit of
Instruction display screen]/8. If the screen is 16 bit (RGB565), the size
value is not less than width * height * 2; if the screen is 24
PAX Computer Technology (Shenzhen) Co.,Ltd. 41
Prolin XUI Interface

bit (RGB888), the size value is not less than width * height *
3;
2. The img should be a valid XuiImg pointer.

3.43 XuiImgTransform

int XuiImgTransform(XuiImg *img,


Prototype
XuiTransform transform);
Function Transform the image.
img【Input】 Image pointer
Parameters Transform mode.
transform【Input】
Details refer to the macro XuiTransform.
0 Succeeded
Return
<0 Failed
Instruction

3.44 XuiImgResize

int XuiImgResize(XuiImg *img,


Prototype unsigned int width,
unsigned int height);
Function Change the image size.
img【Input】 Image pointer

Parameters width【Input】 Image width after change


height【Input】 Image height after change
0 Succeeded
Return
<0 Failed
Instruction

3.45 XuiImgCompose

Prototype XuiImg*XuiImgCompose(XuiImg* img1,


XuiImg* img2,
unsigned int rate1,
unsigned int rate2,
int type);

PAX Computer Technology (Shenzhen) Co.,Ltd. 42


Prolin XUI Interface

Function Combine two XiuImg images.

img1【Input】 Pointer to the buffer of first XuiImg image

Pointer to the buffer of second XuiImg


img2【Input】
image
Parameters
rate1【Input】 The ratio of the first image width

rate2【Input】 The ratio of the second image width

Reserved for future use, the default value is


type【Input】
0.

NULL Failed

Return Pointer to the newly combined XuiImg


Others
image.

1. When the combined XuiImg image is no longer in use, call


XuiImgFree() to release the memory; otherwise, it will cause
memory leak.
2. The width and height of the img1 and img2 must be equal;
Instruction
otherwise, combination will fail and NULL will be returned.
3. The sum of rate1 and rate2 must be equal to the width of
img1 or img2; otherwise, combination will fail and NULL will
be returned.

3.46 XuiImgFree

Prototype void XuiImgFree(XuiImg *img);


Function Destroy the image.
Parameters img【Input】 Image pointer
Return None
Instruction

3.47 XuiSetStatusbarIcon

int XuiSetStatusbarIcon(int index,


Prototype
const char* path);
Function Set the icon of status bar.

PAX Computer Technology (Shenzhen) Co.,Ltd. 43


Prolin XUI Interface

The specified icon index is 0-7 from left to


index【Input】
right.
Parameters Image path.
path【Input】 When it is NULL, the icon will not be
displayed.
0 Succeeded
Return
-1 Failed
1. It takes effect after setting STATUSBAR by the parameter
argv of XuiOpen(). (that is, the height of the status bar has
Instruction been set)
2. When the path is NULL or wrong, the original icon will be
hidden.

3.48 XuiGetHzString

int XuiGetHzString (XuiImeAttr attr,


char *outstr,
Prototype
unsigned int maxlen,
unsigned int timeout);
It is a Chinese inputting interface with the mnemonic function,
Function English letter and numeric character can also be inputted.
Attributes of the input method, details refer
to the structure XuiImeAttr.
Parameter specification:
 All the pointers must be valid, such as
pointers of font and parent canvas and
attr【Input】 so on;
 x and y can‟t be negative;
 12 < text_size < 40 ;
 height must be greater than
Parameters 4*(text_size+10);
 The transparent background is not
supported.
outstr【Input】 Store the input string (ending with „\0‟)
The maximum length of the input string (the
maxlen【Input】
maximum is 1024 bytes)
Timeout value, 0 means no timeout.【unit:
timeout【Input】
second】.
0x00 Succeeded
Return
0xFE Invalid parameter.

PAX Computer Technology (Shenzhen) Co.,Ltd. 44


Prolin XUI Interface

0xFD Timeout
1. Press key 【 Alpha 】 to switch input methods among
“PinYin-Chinese”, “uppercase”, “lowercase” and
“area code”.
2. Input area code. Users can input Chinese character
according to the code in the mode of “area code” inputting.
3. Input Chinese. Press the corresponding numeric key in turn
in the mode of “PinYin-Chinese” inputting. For example,
inputting the Chinese character “中”, users should input
“1466” successively, then press 【Enter】and key 【1】 to
select the “中”.
Instruction 4. Input alphabet. Press letter in the mode of “Abc” inputting,
and it will display on the screen, turn pages by pressing
【Enter】, then select the target character. For example, if
you press key【1】twice in succession, character “Q” will be
inputted.
5. Input number. Press number in the mode of “123” inputting,
then it will display on the screen.
6. Press key【Clear】to clear the inputted characters.
7. After inputting, press【Cancel】to exit the input method, and
the inputted character can be obtained from the parameter
OutStr.

3.49 XuiGetString

int XuiGetString(XuiGetStrAttr attr,


char *outstr,
Prototype unsigned char mode,
int minlen,
int maxlen);
Input the character string and display it on the screen with the
Function specified mode, the character string can be letter, amount or
password etc.
Attributes of inputting string, details refer to
attr【Input】
structure XuiGetStrAttr.
outstr【Input】 Store the input string (ending with „‗\0‟)

Parameters  D7 1(0) reserved


 D6 1(0) Whether to beep when
mode【Input】 inputted string exceeds the maximum
length
 D5 1(0) whether to input number
 D4 1(0) whether to input letter

PAX Computer Technology (Shenzhen) Co.,Ltd. 45


Prolin XUI Interface

 D3 1(0) whether to display the


ciphertext as „*‟
 D2 1(0) left(right)-aligned input
 D1 1(0) whether the string has a
decimal point
 D0 1(0) reserved
Minlen【Input】 The minimum length of the input string.
The maximum length of the input string (the
maxlen【Input】
maximum value is 128 bytes)
0x00 Input successfully
Invalid parameter value (including the
0xFE mode value is invalid; MaxLen =0; and the
Return initial digital string is invalid.)
Input timeout (120 seconds, and this value
0xFD
can‟t be modified.)
Instruction

3.50 XuiBidiStrdup

Prototype char * XuiBidiStrdup(const char *str);


To do the string conversion for Arabic and Hebrew string
Function characters, and display the Arabic and Hebrew string
characters.
The UTF-8 coding string character that
Parameters str【Input】
needs conversion.

NULL Conversion failed, parameter str is invalid.

Return The converted UTF-8 coding string


a string
character.
When displaying Arabic and Hebrew characters, the contents
need to be converted by this interface. Call
XuiCanvasDrawText() after conversion to display the string as
follows:
char* hebrew_text=NULL;
Instruction hebrew_text = XuiBidiStrdup("‫ ;)"אותך אוהב אני‬//I love you.
XuiCanvasDrawText(XuiRootCanvas(), XUI_RIGHT_X(10,
220, XuiTextWidth(font_simsun_0, 25, hebrew_text)), 260, 25,
font_simsun_0,0, color_text, hebrew_text);

PAX Computer Technology (Shenzhen) Co.,Ltd. 46


Prolin XUI Interface

1. The Arabic and Hebrew string character will be displayed


from right to left. Macro XUI_RIGHT_X can be used to
display character in right alignment.
2. This function is similar to strdup. The return value is stored in
the memory assigned by function, and the memory needs to
be released after using it; otherwise, it will cause memory
leak.
bidistr= XuiBidiStrdup(str);
if(bidistr) free(bidistr);

3.51 XuiCanvasAnimation

int XuiCanvasAnimation(XuiWindow *front,


XuiWindow *background,
Prototype unsigned int front_rate,
unsigned int background_rate,
int type);
Function Create switching animations of two XuiWindows.

front【Input】 XuiWindow before switching

background
XuiWindow after switching
【Input】

The ratio of front window on the display


front_rate【Input】
window during the switch process.
Parameters
background_rate The ratio of background window on the
【Input】 display window during the switch process.

The animation type used during the switch


process.
type【Input】
For more information, please refer to
XuiAnimationType

0 Succeeded
Return
<0 Failed

Instruction 1. This function is used for switching the windows in the form

PAX Computer Technology (Shenzhen) Co.,Ltd. 47


Prolin XUI Interface

of animation, currently animation supports up/down/left/right


translation and scaling.
2. When switching the two windows in the form of animation,
these two windows need to be displayed on the mirror first,
that is, calling XuiShowWindow() with
XUI_SHOW_MIRROR mode.
3. This function only applies to Prolin-cygnus-2.6.

3.52 XuiGetGesture

Prototype int XuiGetGesture(XuiGesture* gesture);

Function Get gesture event.

Parameter
s gesture【Output】 Gesture type, refer to structure XuiGesture.

1 Gesture event exists in current state.


Return
<= 0 Gesture event doesn‟t exist in current state.

1. The current supported gesture event types are


Instructio up/down/left/right slide, translation and scaling.
n
2. This function only applies to Prolin-cygnus-2.6.

3.53 XuiSetGestureRect

int XuiSetGestureRect(unsigned int x,


unsigned int y,
Prototype
unsigned int width,
unsigned int height);

Function Set the corresponding area of gesture event.

x coordinate of the gesture corresponding


x【Input】
area.

Parameters y coordinate of the gesture corresponding


y【Input】
area.

width【Input】 The width of the corresponding area.

PAX Computer Technology (Shenzhen) Co.,Ltd. 48


Prolin XUI Interface

height【Input】 The height of the corresponding area.

0 Succeeded
Return
<0 Failed.

1. This function is called in combination with XuiGetGesture().


Instruction
2. This function only applies to Prolin-cygnus-2.6.

3.54 XuiClearGesture

Prototype void XuiClearGesture(void);

Function Clear gesture event.

Parameters None

Return None

Instruction This function only applies to Prolin-cygnus-2.6.

3.55 XuiShowSoftKeyboard

int XuiShowSoftKeyboard(int type,


Prototype
int show);
Function Show or hide input/password soft keyboard.
Soft keyboard type:
type【Input】 0 means input soft keyboard;
1 means password soft keyboard.

 0 represents hidden;
Parameters
 1 represents displaying;
 2 represents displaying and resident,
show【Input】
that is, soft keyboard will not hide when
users click on the “hide” button, but it can
be hidden by calling this function.

0 Succeeded
Return
<0 Failed

PAX Computer Technology (Shenzhen) Co.,Ltd. 49


Prolin XUI Interface

When showing input soft keyboard, the password soft keyboard


will be automatically hidden (if it is showing). When showing
Instruction password soft keyboard, the input soft keyboard will be hidden
too (if it is showing). This function only applies to the POS
terminal with touch screen.

3.56 XuiCreateCamera

XuiWindow *XuiCreateCamera (XuiWindow *parent,


unsigned int x,
unsigned int y,
Prototype
int index,
int resolution,
int zoom);
Function Create camera preview window on canvas for photographing.

parent【Input】 Parent canvas.

x【Input】 The position x relative to canvas window.

y【Input】 The position y relative to canvas window.

Camera index, 0 represents the rear


index【Input】
Parameters camera; 1 represents the front camera.

resolution Image resolution. For more information


【Input】 please refer to XuiCameraResolution.

The zoom ratio of the preview image on


zoom【Input】 preview window. For more information
please refer to XuiPreviewZoom.

NULL Failed
Return
Others Pointer of preview window
1. Because the taking and previewing picture function and
photographing/barcode scanning function use the same
camera device, if this function is called after OsScanOpen()
or OsCameraOpen(), NULL will be returned; if
Instruction
OsScanOpen() or OsCameraOpen() is called after this
function, ERR_DEV_BUSY will be returned.
2. This function and XuiCreateScaner() use the same camera
device, so they cannot be called at the same time.

PAX Computer Technology (Shenzhen) Co.,Ltd. 50


Prolin XUI Interface

3.57 XuiCameraSetStat

int XuiCameraSetStat(XuiWindow *window,


Prototype
XuiCameraStat *stat);
Function Set the preview window state and insert images and text.

window【Input】 The preview window


Parameters
State variable, please refer to structure
start【Input】
XuiCameraStat for more details.

0 Failed
Return
<0 Image pointer

1. This function will take effect immediately after setting;


2. when stat is NULL, illegal argument will be returned, but
when stat is not NULL, it must be a valid pointer to the
Instruction XuiCameraStat structure or the program will crash;
3. When the text_font and text in stat are NULL, the function
returns correctly, but does not display text; when img is
NULL, the function returns correctly, but does not display
the image.

3.58 XuiCameraCapture

Prototype XuiImg *XuiCameraCapture(XuiWindow *window);


Function Acquire a frame image captured by camera.

Parameters window【Input】 Camera preview window

NULL Failed
Return
Others Image pointer

Instruction XuiImgFree() must be called to release memory after calling this


function; otherwise, there will be a memory leak.

3.59 XuiCreateScaner

XuiWindow *XuiCreateScaner (XuiWindow *parent,


Prototype
unsigned int x,

PAX Computer Technology (Shenzhen) Co.,Ltd. 51


Prolin XUI Interface

unsigned int y,
int index,
int zoom);
Create camera preview window on canvas for scanning
Function
barcode.

parent【Input】 Parent canvas.

x【Input】 The position x relative to canvas window.

y【Input】 The position y relative to canvas window.

Parameters Camera index, 0 represents the rear


index【Input】
camera; 1 represents the front camera.

The zoom ratio of the preview image on


zoom【Input】 preview window. For more information
please refer to XuiPreviewZoom.

NULL Failed
Return
Others Pointer of preview window
1. Because the taking and previewing picture function and
photographing/barcode scanning function use the same
camera device,, if this function is called after OsScanOpen()
or OsCameraOpen(), NULL will be returned; if
Instruction
OsScanOpen() or OsCameraOpen() is called after this
function, ERR_DEV_BUSY will be returned.
2. This function and XuiCreateCamera() use the same camera
device, so they cannot be called at the same time.

3.60 XuiScanerDecode

int XuiScanerDecode(XuiWindow *window


unsigned char *outdata
Prototype int *datalen
int maxlen
int timeout);
Function Decode the image captured by camera.

Parameters window【Input】 Preview scanning window.

PAX Computer Technology (Shenzhen) Co.,Ltd. 52


Prolin XUI Interface

Buffer which stores decoded data, the length


of one-dimensional code is recommended to
outdata【Output】 be greater than 512 bytes, and the length of
two-dimensional code is recommended to be
greater than 3072 bytes.

datalen【Output】 The actual length of decoded data.

maxlen【Input】 The size of parameter outdata in buffer.

timeout【Input】 Timeout period of decoding, unit: ms.

0 Succeeded
Return
<0 Failed

Instruction

3.61 XuiRgbaToImg

XuiImg *XuiRgbaToImg(char *rgba,


unsigned int len,
Prototype
unsigned int width,
unsigned int height);
Function Covert rgba buffer data to XuiImg data.

rgba【Input】 rgba buffer data.

len【Input】 Length of buffer data.


Parameters
width【Input】 Image width.

height【Input】 Image height.

NULL Failed
Return
Others Image pointer
1. The parameters should meet the condition: len = width *
height * 4;
Instruction
2. XuiImgFree() must be called to release memory after calling
this function; otherwise, there will be a memory leak.

PAX Computer Technology (Shenzhen) Co.,Ltd. 53


Prolin XUI Interface

3.62 XuiFrameBufferToImg

XuiImg *XuiFrameBufferToImg(char *data,


unsigned int len,
Prototype
unsigned int width,
unsigned int height);
Function Covert the framebuffer data to XuiImg data.

data【Input】 framebuffer data.

len【Input】 Data length.


Parameters
width【Input】 Image width.

height【Input】 Image height.

NULL Failed
Return
Others Image pointer
1. The value of len can be obtained while obtaining the
framebuffer data pointer. In general, the parameters should
meet the condition: len >= width * height * bpp, the bpp is
the number of bytes occupied by each pixel data in the
framebuffer. It is recommended to obtain whole screenful of
Instruction the framebuffer data as much as possible, the actual width
and height of the screen should be set to the values of
parameters width and height, and the value of the bpp can
be ignored;
2. XuiImgFree() must be called to release memory after calling
this function; otherwise, there will be a memory leak.

3.63 XuiImgLoadFromBase64

XuiImg *XuiImgLoadFromBase64(const char *base64string,


Prototype
int *errcode);
Load the image data which is transcoded into a string through
Function
base64.
String buffer to store the image data which is
base64string transcoded through base64, the image data
Parameters
【Input】 before transcoding can be bmp, png or jpeg
format.

PAX Computer Technology (Shenzhen) Co.,Ltd. 54


Prolin XUI Interface

When the function returns NULL, the error


code is recorded. If you do not care about
errcode【Output】
error messages, you can set this parameter
to NULL.

NULL Failed
Return
Others Image pointer
When transferring data between devices, it is sometimes
necessary to transcode image data into a string for easy
transmission, and the most common transcoding method is
Instruction base64 transcoding. Based on this application scenario, this
function directly receives image data (the original image format
can be bmp, png or jpeg) after base64 transcoding and loads it
as XUI image pointer.

PAX Computer Technology (Shenzhen) Co.,Ltd. 55


Prolin XUI Interface

4 Note

4.1 Multi-process

Currently, XUI does not support multi-process, because they will preempt screen
when running at the same time. (Multiple processes will respond to key pressing and
touch duration at the same time, and showing the windows on the screen
inconsistently.)
If multiple processes need to run at the same time, users can implement it by
remote calling. Use a main process to manage the screen and create a canvas for
each process to implement screen switches of the multiple processes.

4.2 XuiDestroyWindow

Note that when calling XuiDestroyWindow() to destroy the window, other resources
used by the window have not been destroyed . So destroy window firstly and then
resource (such as image, font) followed.
Please abide to this principle: the former created canvas windows should be
destroyed after the latter created canvas windows. For example:

The right way to destroy:


/*Create*/
font_simsun_0 = XuiCreateFont ("./res/fallback.ttf", 0, 0);
img_bg = XuiImgLoadFromFile ("./res/bg.png");
btn = XuiCreateButton(XuiRootCanvas(), 10, 50, 220, 30);

PAX Computer Technology (Shenzhen) Co.,Ltd. 56


Prolin XUI Interface

/*Destroy*/
XuiDestroyWindow(btn);
XuiImgFree(img_bg);
XuiDestroyFont(font_simsun_0);

The wrong way to destroy:


/*Create*/
font_simsun_0 = XuiCreateFont ("./res/fallback.ttf", 0, 0);
img_bg = XuiImgLoadFromFile ("./res/bg.png");
btn = XuiCreateButton(XuiRootCanvas(), 10, 50, 220, 30);
/*Destroy*/
XuiImgFree(img_bg);
XuiDestroyFont(font_simsun_0);
XuiDestroyWindow(btn);

PAX Computer Technology (Shenzhen) Co.,Ltd. 57


Prolin XUI Interface

5 FAQ

1. The root canvas exists after opening the XUI, so can the root canvas be gotten by

calling XuiRootCanvas()? Can the root canvas be destroyed?

Answer: Users can call XuiRootCanvas() to get the root canvas which cannot be

destroyed. In addition, if the status bar has been set in XuiOpen(), and the status bar

canvas exists after calling the XuiOpen(), users can directly get the status bar canvas

by XuiStatusbarCanvas(), and the canvas cannot be destroyed.

2. Does XUI support canvas nesting? For example, Root canvas-> sub-canvas 1 ->

sub-canvas 2-> sub-canvas 3-> ... -> sub-canvas N? Is there a limit to N?

Answer: Yes, it supports nesting and there is no limit to N. But users need to manage

XuiWondow pointer of each canvas and not to mix them up. Follow the principle to

destroy windows: the former created canvas windows should be destroyed after the

latter created canvas windows.

3. Does the canvas support using the ShowWindow to display?

PAX Computer Technology (Shenzhen) Co.,Ltd. 58


Prolin XUI Interface

Answer: Yes, it does.

4. Does DestoryWindow() need to be called to release the signature board?

Answer: Yes, it does. All the returning type of XuiWindow* need to be destroyed

except XuiRootCanvas() and XuiStatusbarCanvas(), since they will be

destroyed automatically.

5. When displaying images, how to adjust the image size? Stretch or fill?

Answer: Do not stretch. If the image size is larger than the display area, it only

displays the part which is in the area. If the image size is smaller than the display area,

the blank space will be filled with the background color.

6. When calling ClearArea(), does it only clear contents in the upmost layer or all

the layers? Or it is just a form of covering the area with background color?

Answer: It depends on the parameter XuiWindow *window, user can specify the

canvas pointer of the layer that needs to be cleared, and the canvas background color

will be displayed when clearing the canvas.

PAX Computer Technology (Shenzhen) Co.,Ltd. 59


Prolin XUI Interface

You might also like