XUI Programming Guide 2 0 7
User Manual:
Open the PDF directly: View PDF
.
Page Count: 56
| Download | |
| Open PDF In Browser | View PDF |
Prolin XUI Interface
V2.0.7
PAX Computer Technology(Shenzhen)Co., Ltd.
Copyright © 2000-2016 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
Revision History
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.
2014-01-21
V2.0.1
Increase the description of
structure XuiSignPoint and
XuiSignData.
Huang Lei
2. Add
a
new
interface
XuiSigBoardSignData().
1.
2014-03-25
V2.0.2
Modify the description of the
structure XuiSignPoint.
3. Add three new interfaces Huang Lei
XuiCreateCanvasEx(),
XuiCanvasMoveToY(),
XuiImgLoadFromMem().
1.
2015-04-28
2015-09-02
V2.0.3
V2.0.4
2016-03-01
V2.0.5
2016-03-28
V2.0.6
Added the support of bmp and
mbmp in XuiImgSaveToFile().
2. Modify the ending point of the
signature data to 0xffff in
XuiSigBoardSignData().
Huang Lei
3. Modify the parameter type of
maxlen from unsigned to
unsigned int in function
XuiGetHzString().
1. Added
the
support
of
combination key.
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.
Huang Lei
3. Added
XuiShowMode,
XuiAnimationType,XuiGesture
Type,XuiGesture structures in
2.2 Macro Definition.
4. Added XuiCanvasAnimation()
and XuiGetGesture().
1.
Added
XuiSetGestureRect()
Huang Lei
and XuiClearGesture().
II
2.
Added
XUI_GESTURE_CLICKDOW
N
and
XUI_GESTURE_CLICKUP
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.
2016-04-15
V2.0.7
Added the soft key definition
to 2.1 definition of key values
table.
2. Added two new functions
which are XuiImgCompose() Huang Lei &
and XuiShowSoftKeyboard().
Ye Si ning
3. The title of this document
changed
from
“XUI
Programming
Guide”
to
“Prolin XUI Interface”.
III
Contents
1
2
3
Introduction ......................................................................................................................... 1
1.1
Purpose ..................................................................................................................... 1
1.2
Function .................................................................................................................... 1
1.3
Feature ...................................................................................................................... 2
1.4
XUI Programming Logic .......................................................................................... 2
Macro and Structure ............................................................................................................ 4
2.1
Definition of Key Values .......................................................................................... 4
2.2
Macro Definition .................................................................................................... 10
2.3
Other Macro Definition .......................................................................................... 13
2.4
Structure .................................................................................................................. 14
XUI API............................................................................................................................. 19
3.1
XuiOpen .................................................................................................................. 19
3.2
XuiIsRunning .......................................................................................................... 20
3.3
XuiClose ................................................................................................................. 20
3.4
XuiSuspend ............................................................................................................. 20
3.5
XuiResume ............................................................................................................. 21
3.6
XuiRootCanvas ....................................................................................................... 21
3.7
XuiStatusbarCanvas ................................................................................................ 22
3.8
XuiCreateFont......................................................................................................... 22
3.9
XuiDestroyFont ...................................................................................................... 23
3.10
XuiCanvasDrawText ........................................................................................... 23
3.11
XuiCanvasDrawImg ............................................................................................ 24
3.12
XuiCanvasDrawRect ........................................................................................... 25
3.13
XuiClearArea ...................................................................................................... 25
3.14
XuiTextWidth...................................................................................................... 26
3.15
XuiCreateCanvas ................................................................................................. 26
3.16
XuiCreateCanvasEx ............................................................................................ 27
3.17
XuiCanvasMoveToY .......................................................................................... 28
IV
3.18
XuiDestroyWindow ............................................................................................ 28
3.19
XuiShowWindow ................................................................................................ 28
3.20
XuiCanvasSetBackground .................................................................................. 29
3.21
XuiCreateButton.................................................................................................. 29
3.22
XuiButtonSetStat ................................................................................................. 30
3.23
XuiButtonSetKey ................................................................................................ 30
3.24
XuiCreateSignatureBoard ................................................................................... 31
3.25
XuiSigBoardSetStat ............................................................................................ 31
3.26
XuiSigBoardImg ................................................................................................. 32
3.27
XuiSigBoardSignData ......................................................................................... 32
3.28
XuiCreateGif ....................................................................................................... 32
3.29
XuiHasKey .......................................................................................................... 33
3.30
XuiGetKey .......................................................................................................... 33
3.31
XuiClearKey........................................................................................................ 33
3.32
XuiCaptureScreen ............................................................................................... 34
3.33
XuiCaptureCanvas .............................................................................................. 34
3.34
XuiImgLoadFormFile ......................................................................................... 35
3.35
XuiImgLoadFromMem ....................................................................................... 35
3.36
XuiImgSaveToFile .............................................................................................. 35
3.37
XuiImgToRgba.................................................................................................... 36
3.38
XuiImgTransform................................................................................................ 36
3.39
XuiImgCompose ................................................................................................. 37
3.40
XuiImgFree ......................................................................................................... 37
3.41
XuiSetStatusbarIcon ............................................................................................ 38
3.42
XuiGetHzString ................................................................................................... 38
3.43
XuiGetString ....................................................................................................... 39
3.44
XuiBidiStrdup ..................................................................................................... 40
3.45
XuiCanvasAnimation .......................................................................................... 41
3.46
XuiGetGesture ..................................................................................................... 42
3.47
XuiSetGestureRect .............................................................................................. 42
V
4
5
3.48
XuiClearGesture .................................................................................................. 43
3.49
XuiShowSoftKeyboard ....................................................................................... 43
Note ................................................................................................................................... 44
4.1
Multi-process .......................................................................................................... 44
4.2
XuiDestroyWindow ................................................................................................ 44
FAQ ................................................................................................................................... 46
VI
Table List
Table 1 Definition of Key Values ...................................................................................... 4
Table 2 Macro Definition ................................................................................................. 10
Table 3 XuiTransform ...................................................................................................... 10
Table 4 XuiButtonStatType ............................................................................................. 11
Table 5 XuiBgStyle .......................................................................................................... 11
Table 6 XuiFontSet .......................................................................................................... 11
Table 7 XuiTextStyle ....................................................................................................... 11
Table 8 XuiSigPenFlat ..................................................................................................... 12
Table 9 XuiWindowType ................................................................................................. 12
Table 10 XuiShowMode .................................................................................................. 12
Table 11 XuiAnimationType ........................................................................................... 12
Table 12 XuiGestureType ................................................................................................ 13
Table 13 Structure XuiWindow ....................................................................................... 14
Table 14 Structure XuiImg ............................................................................................... 14
Table 15 Structure XuiButtonStat .................................................................................... 14
Table 16 Structure XuiSigBoardStat ................................................................................ 15
Table 17 Structure XuiImeAttr ........................................................................................ 16
Table 18 Structure XuiGetStrAttr .................................................................................... 16
Table 19 Structure XuiSignPoint ..................................................................................... 17
Table 20 Structure XuiSignData ...................................................................................... 17
VII
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.
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.
PAX Computer Technology(Shenzhen)Co.,Ltd.
1
Prolin XUI Interface
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.
Button
RootWindow
Text
Normal
Two state
Presse
d
Draw SomeText
SubWindow
Background
Color
RootWindow
Background
Picture
RootWindow
Background
Color
SubWindow
Background
Picture
The design only includes three elements: canvas, button and key value.
1.
2.
3.
1.
2.
3.
1.
Canvas
It must have a RootCanvas, and sub-canvas can be created.
Text, picture and buttons can be painted on the canvas.
It contains background image and background color, the background will not be cleared
when CLS.
Button
Buttons contain two states, normal and pressed.
Each state includes the following parameters: border, background color, icon, text font,
text color and text content.
When clicking 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
The key value and physical button value are in the same queue.
PAX Computer Technology(Shenzhen)Co.,Ltd.
2
Prolin XUI Interface
2.
3.
All windows have only one queue.
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, the 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 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
PAX Computer Technology(Shenzhen)Co.,Ltd.
4
Prolin XUI Interface
XUI_KEYCLEAR
14
Clear
XUI_KEYENTER
28
Enter
XUI_KEYALPHA
69
Alpha
XUI_KEYF1
59
XUI_KEYFUNC
102
XUI_KEYUP
103
XUI_KEYDOWN
108
XUI_KEYMENU
139
XUI_KEYENTER1
30
/* Enter+1 */ The combination of Enter key
and Key1.
XUI_KEYENTER2
31
/* Enter+2 */ The combination of Enter key
and Key2.
XUI_KEYENTER3
32
/* Enter+3 */ The combination of Enter key
and Key 3.
XUI_KEYENTER4
33
/* Enter+4 */ The combination of Enter key
and Key4.
XUI_KEYENTER5
34
/* Enter+5*/ The combination of Enter key
and Key5.
XUI_KEYENTER6
35
/* Enter+6*/ The combination of Enter key
and Key6.
XUI_KEYENTER7
36
/* Enter+7/ The combination of Enter key
and Key7.
XUI_KEYENTER8
37
/* Enter+8/ The combination of Enter key
and Key8.
XUI_KEYENTER9
38
/* Enter+9 */ The combination of Enter key
and Key9.
XUI_KEYENTER0
39
/* Enter+0 */ The combination of Enter key
and Key10.
XUI_SOFTKEYBOARD_KEYB
ACKSPACE
0xff+8
/* backspace key */
XUI_SOFTKEYBOARD_KEYS
PACE
0xff+32
/* space key*/
XUI_SOFTKEYBOARD_KEYE
XCLAM
0xff+33
/* ! */
XUI_SOFTKEYBOARD_KEYD
OUBLEQUOTE
0xff+34
/* " */
PAX Computer Technology(Shenzhen)Co.,Ltd.
5
Prolin XUI Interface
XUI_SOFTKEYBOARD_KEYS
HARP
0xff+35
/* # */
XUI_SOFTKEYBOARD_KEYD
OLLAR
0xff+36
/* $ */
XUI_SOFTKEYBOARD_KEYP
ERCENT
0xff+37
/* % */
XUI_SOFTKEYBOARD_KEYA
MPERSAND
0xff+38
/* & */
XUI_SOFTKEYBOARD_KEYSI
NGLEQUOTE
0xff+39
/* ' */
XUI_SOFTKEYBOARD_KEYP
ARENLEFT
0xff+40
/* ( */
XUI_SOFTKEYBOARD_KEYP
ARENRIGHT
0xff+41
/* ) */
XUI_SOFTKEYBOARD_KEYA
STERISK
0xff+42
/* * */
XUI_SOFTKEYBOARD_KEYP
LUS
0xff+43
/* + */
XUI_SOFTKEYBOARD_KEYC
OMMA
0xff+44
/* , */
XUI_SOFTKEYBOARD_KEYM
INUS
0xff+45
/* - */
XUI_SOFTKEYBOARD_KEYP
ERIOD
0xff+46
/* . */
XUI_SOFTKEYBOARD_KEYS
LASH
0xff+47
/* / */
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 */
PAX Computer Technology(Shenzhen)Co.,Ltd.
6
Prolin XUI Interface
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_KEYC
OLON
0xff+58
/* : */
XUI_SOFTKEYBOARD_KEYS
EMICOLON
0xff+59
/* ; */
XUI_SOFTKEYBOARD_KEYL
ESS
0xff+60
/* < */
XUI_SOFTKEYBOARD_KEYE
QUAL
0xff+61
/* = */
XUI_SOFTKEYBOARD_KEYG
REATER
0xff+62
/* > */
XUI_SOFTKEYBOARD_KEYQ
UESTION
0xff+63
/* ? */
XUI_SOFTKEYBOARD_KEYA
T
0xff+64
/* @ */
XUI_SOFTKEYBOARD_KEYA
0xff+65
/* A */
XUI_SOFTKEYBOARD_KEYB
0xff+66
/* B */
XUI_SOFTKEYBOARD_KEYC
0xff+67
/* C */
XUI_SOFTKEYBOARD_KEYD
0xff+68
/* D */
XUI_SOFTKEYBOARD_KEYE
0xff+69
/* E */
XUI_SOFTKEYBOARD_KEYF
0xff+70
/* F */
XUI_SOFTKEYBOARD_KEYG
0xff+71
/* G */
XUI_SOFTKEYBOARD_KEYH
0xff+72
/* H */
XUI_SOFTKEYBOARD_KEYI
0xff+73
/* I */
PAX Computer Technology(Shenzhen)Co.,Ltd.
7
Prolin XUI Interface
XUI_SOFTKEYBOARD_KEYJ
0xff+74
/* J */
XUI_SOFTKEYBOARD_KEYK
0xff+75
/* K */
XUI_SOFTKEYBOARD_KEYL
0xff+76
/* L */
XUI_SOFTKEYBOARD_KEYM
0xff+77
/* M */
XUI_SOFTKEYBOARD_KEYN
0xff+78
/* N */
XUI_SOFTKEYBOARD_KEYO
0xff+79
/* O */
XUI_SOFTKEYBOARD_KEYP
0xff+80
/* P */
XUI_SOFTKEYBOARD_KEYQ
0xff+81
/* Q */
XUI_SOFTKEYBOARD_KEYR
0xff+82
/* R */
XUI_SOFTKEYBOARD_KEYS
0xff+83
/* S */
XUI_SOFTKEYBOARD_KEYT
0xff+84
/* T */
XUI_SOFTKEYBOARD_KEYU
0xff+85
/* U */
XUI_SOFTKEYBOARD_KEYV
0xff+86
/* V */
XUI_SOFTKEYBOARD_KEYW
0xff+87
/* W */
XUI_SOFTKEYBOARD_KEYX
0xff+88
/* X */
XUI_SOFTKEYBOARD_KEYY
0xff+89
/* Y */
XUI_SOFTKEYBOARD_KEYZ
0xff+90
/* Z */
XUI_SOFTKEYBOARD_KEYB
RACKETLEFT
0xff+91
/* [ */
XUI_SOFTKEYBOARD_KEYB
ACKSLASH
0xff+92
/* \ */
XUI_SOFTKEYBOARD_KEYB
RACKETRIGHT
0xff+93
/* ] */
XUI_SOFTKEYBOARD_KEYC
ARET
0xff+94
/* ^ */
XUI_SOFTKEYBOARD_KEYU
NDERSCORE
0xff+95
/* _ */
XUI_SOFTKEYBOARD_KEYB
0xff+96
/* ` */
PAX Computer Technology(Shenzhen)Co.,Ltd.
8
Prolin XUI Interface
ACKQUOTE
XUI_SOFTKEYBOARD_KEYa
0xff+97
/* a */
XUI_SOFTKEYBOARD_KEYb
0xff+98
/* b */
XUI_SOFTKEYBOARD_KEYc
0xff+99
/* c */
XUI_SOFTKEYBOARD_KEYd
0xff+100
/* d */
XUI_SOFTKEYBOARD_KEYe
0xff+101
/* e */
XUI_SOFTKEYBOARD_KEYf
0xff+102
/* f */
XUI_SOFTKEYBOARD_KEYg
0xff+103
/* g */
XUI_SOFTKEYBOARD_KEYh
0xff+104
/* 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_KEYm
0xff+109
/* m */
XUI_SOFTKEYBOARD_KEYn
0xff+110
/* n */
XUI_SOFTKEYBOARD_KEYo
0xff+111
/* o */
XUI_SOFTKEYBOARD_KEYp
0xff+112
/* p */
XUI_SOFTKEYBOARD_KEYq
0xff+113
/* q */
XUI_SOFTKEYBOARD_KEYr
0xff+114
/* r */
XUI_SOFTKEYBOARD_KEYs
0xff+115
/* s */
XUI_SOFTKEYBOARD_KEYt
0xff+116
/* t */
XUI_SOFTKEYBOARD_KEYu
0xff+117
/* u */
XUI_SOFTKEYBOARD_KEYv
0xff+118
/* v */
XUI_SOFTKEYBOARD_KEYw
0xff+119
/* w */
XUI_SOFTKEYBOARD_KEYx
0xff+120
/* x */
XUI_SOFTKEYBOARD_KEYy
0xff+121
/* y */
PAX Computer Technology(Shenzhen)Co.,Ltd.
9
Prolin XUI Interface
XUI_SOFTKEYBOARD_KEYz
0xff+122
/* z */
XUI_SOFTKEYBOARD_KEYB
RACELEFT
0xff+123
/* { */
XUI_SOFTKEYBOARD_KEYB
AR
0xff+124
/* | */
XUI_SOFTKEYBOARD_KEYB
RACERIGHT
0xff+125
/* } */
XUI_SOFTKEYBOARD_KEYTI
LDE
0xff+126
/* ~ */
1.
2.
3.
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.
D200 (touch-key) doesn’t support combination key.
In addition, the value of soft keyboard minus 0xff will be equal to
the key value defined by ASCII.
2.2 Macro Definition
Table 2 Macro Definition
Macro
Description
b
Blue channel
g
Green channel
r
Red channel
a
ALPHA channel
Table 3 XuiTransform
Macro
PAX Computer Technology(Shenzhen)Co.,Ltd.
Description
10
Prolin XUI Interface
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 4 XuiButtonStatType
Macro
Description
XUI_BTN_NORMAL
Normal state
XUI_BTN_PRESSED
Pressed State
Table 5 XuiBgStyle
Macro
Description
XUI_BG_NORMAL
Normal, display the picture from the origin x, y.
XUI_BG_TILE
Tile
XUI_BG_CENTER
Center
XUI_BG_FOUR_CORNER
Stretch to four corners
Table 6 XuiFontSet
Macro
Description
XUI_FONT_MONO
Monochrome font(black and white)
XUI_FONT_GREY
Grey font
Table 7 XuiTextStyle
PAX Computer Technology(Shenzhen)Co.,Ltd.
11
Prolin XUI Interface
Macro
Description
XUI_TEXT_NORMAL
Normal
XUI_BOLD
Bold
XUI_ITALIC
Italic
XUI_TEXT_BOLD_ITALIC
Bold and italic
Table 8 XuiSigPenFlat
Macro
Description
XUI_SIG_FLAT
Signing Board with smooth processing
XUI_SIG_NORMAL
The normal Signing Board without smooth
processing
Table 9 XuiWindowType
Macro
Description
XUI_WIN_CANVAS
Canvas window
XUI_WIN_BUTTON
Button window
XUI_WIN_GIF
GIF window
XUI_WIN_SIGBOARD
Signature Board window
Table 10 XuiShowMode
Macro
Description
XUI_SHOW_NORMAL
Display on the screen normally
XUI_SHOW_MIRROR
Display on the mirror
XUI_SHOW_ALL
Display on the screen and mirror at the same
time.
Table 11 XuiAnimationType
PAX Computer Technology(Shenzhen)Co.,Ltd.
12
Prolin XUI Interface
Macro
Description
XUI_TRANSLATION
Translate right or left.
XUI_POLL
Translate up or down
XUI_SCALE
Scale
Table 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
XUI_GESTURE_SCROLLZOOMIN
Zoom in with two fingers
XUI_GESTURE_CLICKDOWN
Click down finger event
XUI_GESTURE_CLICKUP
Click up finger event
2.3 Other Macro Definition
Macro
XUI_RIGHT_X(_x, _width, _extend)
PAX Computer Technology(Shenzhen)Co.,Ltd.
Description
Get text in the right-most position within
_width (text-align right)
13
Prolin XUI Interface
XUI_CENTER_X(_x, _width, _extend)
Get text in the middle position within _width
(text-align horizontal center)
XUI_CENTER_Y(_y, _height, _extend)
Get text in the middle position within _height
(text-align vertical center)
2.4 Structure
1.
Structure XuiWindow
Table 13 Structure XuiWindow
Structure Member
2.
Description
width
Window width
height
Window height
widget
Window related canvas pointer
type
Window type, refers to XuiWindowType
key
Window related key values
Structure XuiImg
Table 14 Structure XuiImg
Structure Member
3.
Description
width
Img width
height
Img height
priy
Img data pointer
Structure XuiButtonStat
Table 15 Structure XuiButtonStat
Structure Member
btn_round
Description
rounded corner(0 means no rounded corner,
1 means rounded corner, and the default
PAX Computer Technology(Shenzhen)Co.,Ltd.
14
Prolin XUI Interface
value is 0)
4.
btn_bg
background color
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
Structure XuiSigBoardStat
Table 16 Structure XuiSigBoardStat
Structure Member
Description
btn_round
rounded corner (0 means has no rounded
corner, 1 means has rounded corner, and the
default value is 0)
btn_bg
Background color (Transparency is 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)
PAX Computer Technology(Shenzhen)Co.,Ltd.
15
Prolin XUI Interface
5.
img
Image
img_x
Image position: x
img_y
Image position: y
img_style
image type
pen_fg
pen color
pen_width
Pen width (ranges from 1 to 10)
pen_flat
Pen with smooth processing
Structure XuiImeAttr
Table 17 Structure XuiImeAttr
Structure Member
6.
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)
height
IME height (greater than 4* (text_size+10))
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
img_bg
IME background color (transparency is not
supported)
alpha_key
Customize alpha key value
sharp_key
Customize sharp key value
Structure XuiGetStrAttr
Table 18 Structure XuiGetStrAttr
PAX Computer Technology(Shenzhen)Co.,Ltd.
16
Prolin XUI Interface
Structure Member
7.
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.
Structure XuiSignPoint
Table 19 Structure XuiSignPoint
8.
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.
Structure XuiSignData
Table 20 Structure XuiSignData
Structure Member
9.
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
Structure XuiGesture
Table 21 Structure XuiGesture
Structure Member
type
PAX Computer Technology(Shenzhen)Co.,Ltd.
Description
Gesture type, for more information , please
17
Prolin XUI Interface
refer to XuiGestureType
velocity
The velocity of sliding the screen.
distance
The sliding distance.
down_x
The x-coordinate of where the finger presses
down.
down_y
The y-coordinate of where the finger presses
down.
cur_x
The current x-coordinate of gesture.
cur_y
The current y-coordinate of gesture.
PAX Computer Technology(Shenzhen)Co.,Ltd.
18
Prolin XUI Interface
3 XUI API
3.1 XuiOpen
Prototype
int XuiOpen(int argc,
char **argv);
Function
Open XUI and initialize it.
argc 【Input】 Number of parameters
Parameters
Return
Instruction
argv 【Input】 Parameter list
0
Success
<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/input/event0".*/
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)*/
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"};
PAX Computer Technology(Shenzhen)Co.,Ltd.
19
Prolin XUI Interface
XuiOpen(sizeof(xui_argv)/sizeof(xui_argv[0]), xui_argv);
1.
2.
3.
4.
5.
6.
When calling XuiOpen() for multiple times, only the first time
takes effect, the later calls will not work unless XuiClose() is
called.
When parameter argc=0 and argv=NULL, default settings will be
enabled.
XUI does not support multi-process, Calling XuiOpen() between
different processes will cause screen robbery during canvas
operations.
Parameters in argv are independent.
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.
Xuiopen() must be called before calling other related interfaces.
3.2 XuiIsRunning
Prototype
int XuiIsRunning(void);
Function
Check if the XUI is running.
Parameters
Return
None
1
Running.
0
Not running.
Instruction
3.3 XuiClose
Prototype
void XuiClose(void);
Function
Close the XUI.
Parameters
None
Return
None
Instruction
Call this function when the application exits.
3.4 XuiSuspend
Prototype
int XuiSuspend (void);
PAX Computer Technology(Shenzhen)Co.,Ltd.
20
Prolin XUI Interface
Function
Parameters
Return
Suspend the XUI.
None
0
Success
-1
Failed
1.
Instruction
2.
When the application needs to call another process which
occupies fb and event resource. This function needs to be called
suspend the XUI; otherwise, two processes will preempt fb and
event resource at the same time.
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
Return
Instruction
None
0
Success
-1
Failed
Key and touchscreen events will no longer be received after 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
Return
Instruction
None
NULL
Failed
else
Pointer of the root canvas
Call this function to do the operation on the root canvas:
For example:
XuiWindow* root;
root= XuiRootCanvas();
XuiCanvasSetBackground(root,XUI_BG_NORMAL,img_bg,color_bg
);
PAX Computer Technology(Shenzhen)Co.,Ltd.
21
Prolin XUI Interface
3.7 XuiStatusbarCanvas
Prototype
XuiWindow * XuiStatusbarCanvas (void);
Function
Get status bar canvas.
Parameters
Return
Instruction
None
NULL
Failed
else
Pointer of the status bar canvas
It is similar to XuiRootCanvas().
3.8 XuiCreateFont
Prototype
XuiFont *XuiCreateFont(char *fontfile,
int index,
XuiFontSet fontset);
Function
Create font.
fontfile 【Input】 Path of the font file.
index
Parameters
【Input】 Index of the font file.
Font style, it supports monochrome and grey
Fontset 【Input】 modes.
Details refer to XuiFontSet.
Return
Instruction
NULL
Failed
else
Font pointer
Font of displaying text is created by this function.
For Example:
XuiFont *font_simsun_0;
font_simsun_0 = XuiCreateFont("/usr/font/paxfont.ttf", 0, 0);
1.
2.
3.
4.
Custom font and ttc/ttf vector fonts are supported.
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.
The parameter index is valid for ttc font; it is used to specify a font
type of ttc font. It is invalid for custom font and ttf font since these
two only contain one type of font.
Users can call XuiDestroyFont() to destroy the created fonts which
PAX Computer Technology(Shenzhen)Co.,Ltd.
22
Prolin XUI Interface
5.
are no longer needed.
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
Return
Instruction
font 【Input】 Font pointer
None
Destroy the fonts created by XuiCreateFont().
3.10 XuiCanvasDrawText
Prototype
int XuiCanvasDrawText(XuiWindow *window,
unsigned int x,
unsigned int y,
unsigned int height,
XuiFont *font,
XuiTextStyle textstyle,
XuiColor fg,
char *text);
Function
Display string on canvas window.
Parameters
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().
textstyle 【Input】
Return
Instruction
Text style (bold, italic), details refer to the
XuiTextStyle.
fg
【Input】 Font color.
text
【Input】 Text (UTF-8 code).
0
Success
<0
Failed
1.
Auto linefeed, ‘\n’ or ‘\r’ linefeed is not supported. When the
PAX Computer Technology(Shenzhen)Co.,Ltd.
23
Prolin XUI Interface
2.
3.
displaying length is beyond the canvas, the excess part will not
be displayed.
Parameter text only supports UTF -8 coding; other formats
should be converted to UTF-8 code first.
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 XuiCanvasDrawImg
Prototype
int XuiCanvasDrawImg(XuiWindow *window,
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height,
XuiBgStyle bgstyle,
XuiImg *img);
Function
Display images on the canvas window.
Parameters
Return
Instruction
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.
height
【Input】 Image height.
bgstyle
【Input】 Background
XuiBgStyle.
img
【Input】 Image pointer.
0
Success
<0
Failed
style,
details
refer
to
the
Parameter img must be a valid image pointer created by
XuiImgLoadFormFile(); otherwise, the image can’t be displayed
correctly.
PAX Computer Technology(Shenzhen)Co.,Ltd.
24
Prolin XUI Interface
3.12 XuiCanvasDrawRect
Prototype
int XuiCanvasDrawRect(XuiWindow *window,
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height,
XuiColor fg,
int round,
int fill);
Function
Display rectangle on the canvas window.
Parameters
Return
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.
height
【Input】 Rectangle height.
Fg
【Input】 Foreground color.
round
【Input】
fill
【Input】
1: Rounded,
0: Rectangular.
1: Filled
0: Hollowed
0
Success
<0
Failed
Instruction
3.13 XuiClearArea
Prototype
int XuiClearArea(XuiWindow *window,
unsigned int x,
unsigned int y,
unsigned int width,
PAX Computer Technology(Shenzhen)Co.,Ltd.
25
Prolin XUI Interface
unsigned int height);
Function
Parameters
Return
Instruction
Clear the canvas area and cleared area will show the window
background color.
window
【Input】 Canvas window
x
【Input】 The position x relative to canvas window
y
【Input】 The position y relative to canvas window
width
【Input】 Width of clearing area
height
【Input】 Height of clearing area
0
Success
<0
Failed
When multiple canvases are overlapped, only the content specified by
parameter window will be cleared.
3.14 XuiTextWidth
Prototype
int XuiTextWidth(XuiFont *font,
int size,
char *text);
Function
Get the text width.
Parameters
Return
font
【Input】 The specified font created by XuiCreateFont()
size
【Input】 Font size (text height)
text
【Input】 Text string
Returns the string width.
1.
2.
Instruction
3.
4.
Call this function when setting text alignment to center or right.
Parameter font must be a valid font created by XuiCreateFont();
otherwise, it will cause program crash.
Parameter text must be a valid string pointer.
Only UTF-8 coding is supported; other formats need to be
converted to UTF-8 code first.
3.15 XuiCreateCanvas
Prototype
XuiWindow *XuiCreateCanvas(XuiWindow *parent,
unsigned int x,
unsigned int y,
unsigned int width,
PAX Computer Technology(Shenzhen)Co.,Ltd.
26
Prolin XUI Interface
unsigned int height);
Function
Parameters
Return
Create canvas.
parent
【Input】 Parent canvas
x
【Input】 The position x relative to canvas window
y
【Input】 The position y relative to canvas window
width
【Input】 Canvas width
height
【Input】 Canvas height
NULL
else
1.
Instruction
2.
Failed
Canvas pointer
Parameter parent must be a valid canvas pointer, and this rule
also applies to the following interfaces.
The new canvas will be displayed on the screen by calling
XuiShowWindow(), and the parent canvas will be covered.
3.16 XuiCreateCanvasEx
Prototype
XuiWindow *XuiCreateCanvasEx(XuiWindow *parent,
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height,
unsigned int vh);
Function
Create the movable canvas window, and the canvas height can be
greater than the window height.
Parameters
Return
Instruction
parent
【Input】 Parent canvas
x
【Input】
The position x of canvas window relative to the
parent canvas
y
【Input】
The position y of canvas window relative to the
parent canvas
width
【Input】 width of the canvas window
height
【Input】 height of the canvas window
vh
【Input】
The height of the actual operation area of the
canvas
NULL
Failed
else
Pointer of the canvas window
1.
2.
The canvas width cannot be greater than the window width.
When the parameter vh is not more than height, this function is
PAX Computer Technology(Shenzhen)Co.,Ltd.
27
Prolin XUI Interface
equivalent to the XuiCreateCanvas().
3.17 XuiCanvasMoveToY
Prototype
void XuiCanvasMoveToY (XuiWindow * window,
unsigned int my);
Function
Move the canvas in the canvas window.
Parameters
Return
parent
【Input】 Parent canvas created by XuiCreateCanvasEx().
my
【Input】
None
1.
Instruction
The moving height of canvas, the height is
relative to the original height of canvas window.
2.
3.
This function has no effect on the canvas created by
XuiCreateCanvas(). It is only valid when the canvas is created by
XuiCreateCanvasEx() and actual canvas height is greater than the
window height.
Canvas can only be moved within the canvas window.
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.18 XuiDestroyWindow
Prototype
void XuiDestroyWindow(XuiWindow *window);
Function
Destroy the canvas windows.
Parameters
window
1.
Instruction
2.
【Input】 Canvas window
Destroy the canvas windows created by XuiCreateCanvas(),
XuiCreateButton(),
XuiCreateSignatureBoard()
and
XuiCreateGIF().
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.19 XuiShowWindow
Prototype
void XuiShowWindow(XuiWindow *window,
int show,
int flag);
PAX Computer Technology(Shenzhen)Co.,Ltd.
28
Prolin XUI Interface
Function
Parameters
Return
Instruction
Show or hide the window.
window
【Input】 window
show
【Input】
flag
【Input】 Reserved for future use, the default value is 0.
1: Show
0: Hide
None
3.20 XuiCanvasSetBackground
Prototype
void XuiCanvasSetBackground(XuiWindow *window,
XuiBgStyle bgstyle,
XuiImg *img,
XuiColor bg);
Function
Set the canvas background.
window
【Input】 Canvas
bgstyle
【Input】
img
【Input】 Image, NULL indicates no image.
Parameters
bg
Return
Instruction
Background
XuiBgStyle.
style.
Details
refer
to
the
Background color.
None
1.
Screen will be cleared after calling this function.
2.
This interface only takes effect on the canvas specified by
window. Other canvas area will not be affected.
3.
It does not support transparency in the background.
3.21 XuiCreateButton
Prototype
XuiWindow *XuiCreateButton(XuiWindow *parent,
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height);
Function
Create button in canvas.
Parameters
parent
【Input】 Parent canvas
x
【Input】 The position x relative to canvas window
PAX Computer Technology(Shenzhen)Co.,Ltd.
29
Prolin XUI Interface
Return
y
【Input】 The position y relative to canvas window
width
【Input】 width
height
【Input】 height
NULL
Failed
else
Button pointer
Instruction
3.22 XuiButtonSetStat
Prototype
int XuiButtonSetStat(XuiWindow *window,
XuiButtonStatType type,
XuiButtonStat *stat);
Function
Set the button state.
Parameters
Return
Instruction
window
【Input】 Button
type
【Input】
State type, details
XuiButtonStatType.
refer
stat
【Input】
State variable, details
XuiButtonStat.
refer to structure
0
Success
<0
Failed
1.
2.
3.
to
macro
The setting takes effect immediately after calling this function.
The parameter stat must be a valid state pointer; otherwise, it will
lead to crashes. It also applies to the following interfaces.
When stat’s text_font and text are NULL, the function can return
correctly, and text will not be displayed.
3.23 XuiButtonSetKey
Prototype
int XuiButtonSetKey(XuiWindow *window,
int key);
Function
Set the key value of the button.
Parameters
Return
window
【Input】 Button
key
【Input】 Key value (key>0)
0
Success
<0
Failed
PAX Computer Technology(Shenzhen)Co.,Ltd.
30
Prolin XUI Interface
1.
Instruction
2.
After releasing the button, key values can be acquired through
XuiGetKey().
The key value must be greater than 0.
3.24 XuiCreateSignatureBoard
Prototype
XuiWindow * XuiCreateSignatureBoard (XuiWindow *parent,
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height);
Function
Create the signature board.
Parameters
Return
parent
【Input】 Parent canvas.
x
【Input】 The position x relative to canvas window.
y
【Input】 The position y relative to canvas window.
width
【Input】 Width.
height
【Input】 Height.
NULL
Failed
else
Pointer of the signature board
1.
Instruction
2.
3.
When creating signature board, several canvases cannot be
overlapped.
Prolin-2.4 doesn’t support multi-touch.
Prolin-phoenix-2.5 support multi-touch and it supports up to 3
points.
3.25 XuiSigBoardSetStat
Prototype
int XuiSigBoardSetStat (XuiWindow *window,
XuiSigBoardStat *stat);
Function
Set the state of signature board.
Parameters
Return
Instruction
window
【Input】 Signature board.
stat
【Input】
State variable, details refer to the structure
XuiSigBoardStat.
0
Success
<0
Failed
1.
The setting will take effect immediately after calling this
function.
PAX Computer Technology(Shenzhen)Co.,Ltd.
31
Prolin XUI Interface
2.
3.
4.
When pen_flat is XUI_SIG_FLAT in parameter stat , pen color
and pen width can’t be changed.
When text_font and text are NULL in parameter stat, the function
will return successfully, but the text will not be displayed.
The background of signature board does not support
semitransparency.
3.26 XuiSigBoardImg
Prototype
XuiImg * XuiSigBoardImg(XuiWindow *window);
Function
Get the signature image.
Parameters
Return
Instruction
window
【Input】 Signature board。
NULL
Failed
else
Image pointer
After calling this function, call XuiImgFree() to destroy the image.
3.27 XuiSigBoardSignData
Prototype
XuiSignData* XuiSigBoardSignData(XuiWindow *window);
Function
Get the signature data.
Parameters
Return
window
NULL
Failed
else
Data pointer, details refer to structure
XuiSignData.
1.
Instruction
【Input】 Signature board
2.
Record the location of the signature point, the ending point of
signature is 0xffff.
The obtained signature data pointer does not need to be released.
3.28 XuiCreateGif
Prototype
XuiWindow * XuiCreateGif (XuiWindow *parent,
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height ,
const char* path);
Function
Create the GIF animation.
PAX Computer Technology(Shenzhen)Co.,Ltd.
32
Prolin XUI Interface
Parameters
Return
parent
【Input】 Parent canvas.
x
【Input】 The position x relative to canvas window.
y
【Input】 The position y relative to canvas window.
width
【Input】 width
height
【Input】 height
path
【Input】 path of GIF image
NULL
Failed
else
Pointer of GIF window
Instruction
3.29 XuiHasKey
Prototype
int XuiHasKey(void);
Function
Check whether the key value exists or not.
Parameters
Return
None
1
Yes
0
No
Instruction
3.30 XuiGetKey
Prototype
int XuiGetKey(void);
Function
Get the key.
Parameters
Return
Instruction
None
Key value.
This function won’t return until there is a key value.
3.31 XuiClearKey
Prototype
void XuiClearKey(void);
Function
Clear the key buffer.
Parameters
None
Return
None
PAX Computer Technology(Shenzhen)Co.,Ltd.
33
Prolin XUI Interface
Instruction
Clear the key buffer queue, this buffer is a dynamic linked list and the
length is not fixed.
3.32 XuiCaptureScreen
Prototype
XuiImg *XuiCaptureScreen(void);
Function
Capture the screen.
Parameters
Return
Instruction
None
NULL
Failed
else
Pointer of image
After calling this function, call XuiImgFree() to destroy the
screenshot.
3.33 XuiCaptureCanvas
Prototype
XuiImg *XuiCaptureCanvas(XuiWindow *window,
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height);
Function
Capture the canvas.
Parameters
Return
window
【Input】 canvas
x
【Input】
The starting position x relative to canvas
window
y
【Input】
The starting position y relative to canvas
window
width
【Input】 width
height
【Input】 height
NULL
Failed
else
Pointer of image
1.
2.
Instruction
3.
4.
5.
After using this interface, call XuiImgFree() to destroy the
canvas.
It will not capture the button on the canvas when capturing the
canvas.
It also applies to hidden canvas.
This function can generate images for printer.
Compare the parameter width (height) with the width (height) of
canvas, and the smaller value will be used as the width (height)
PAX Computer Technology(Shenzhen)Co.,Ltd.
34
Prolin XUI Interface
of the captured image.
3.34 XuiImgLoadFormFile
Prototype
XuiImg *XuiImgLoadFromFile(const char *file);
Function
Load the image from a file.
Parameters
Return
Instruction
file
【Input】 The file path.
NULL
Failed
else
Pointer of image
Currently it only supports images in bmp and png format.
3.35 XuiImgLoadFromMem
Prototype
XuiImg *XuiImgLoadFromMem(unsigned char *address,
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
type
Image data types.
【Input】 0 represents bmp data,
1 represents png data.
Parameters
Return
Instruction
NULL
Failed
else
Image pointer
Currently it only supports images in bmp and png format.
3.36 XuiImgSaveToFile
Prototype
int XuiImgSaveToFile(XuiImg *img,
const char *file);
Function
Save the image to a file.
Parameters
img
【Input】 Image pointer.
file
【Input】 The file path of the image to be saved.
Distinguish the different file types according to
PAX Computer Technology(Shenzhen)Co.,Ltd.
35
Prolin XUI Interface
suffixes. It supports suffixes of png, bmp
(24-bit true color), and mbmp (monochrome
bmp).
Return
Instruction
0
Success
<0
Failed
Currently it supports png, 24-bit true color bmp and monochrome
bmp, the suffix of monochrome bmp is mbmp.
3.37 XuiImgToRgba
Prototype
int XuiImgToRgba(XuiImg *img,
const char *rgba);
Function
Save the image to the rgba buffer.
Parameters
Return
img
【Input】 Image pointer
rgba
【Input】 rgba buffer.
0
Success
<0
Failed
1.
Instruction
2.
It does not check the buffer size, please allocate a buffer with
size of 4* width * height to save the image.
The parameter img must be a valid XuiImg pointer; this rule also
applies to the following functions.
3.38 XuiImgTransform
Prototype
int XuiImgTransform(XuiImg *img,
XuiTransform transform);
Function
Transform the image.
img
Parameters
Return
【Input】 Image pointer
transform 【Input】
Transform mode.
Details refer to the macro XuiTransform.
0
Success
<0
Failed
Instruction
PAX Computer Technology(Shenzhen)Co.,Ltd.
36
Prolin XUI Interface
3.39 XuiImgCompose
Prototype
XuiImg*
XuiImgCompose(XuiImg* img1,
XuiImg* img2,
unsigned int rate1,
unsigned int rate2,
int type);
Function
Parameters
Return
Instruction
Combine two XiuImg images.
img1
【Input】 Pointer to the buffer of first XuiImg image
img2
【Input】 Pointer to the buffer of second XuiImg image
rate1
【Input】 The ratio of the first image width
rate2
【Input】 The ratio of the second image width
type
【Input】
Reserved for future use, the default value is 0.
NULL
Failed
else
Pointer to the newly combined XuiImg 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;
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.40 XuiImgFree
Prototype
void XuiImgFree(XuiImg *img);
Function
Destroy the image.
Parameters
Return
img
【Input】 Image pointer
None
PAX Computer Technology(Shenzhen)Co.,Ltd.
37
Prolin XUI Interface
Instruction
3.41 XuiSetStatusbarIcon
Prototype
int XuiSetStatusbarIcon(int index,
const char* path);
Function
Set the icon of status bar.
Parameters
Return
index
【Input】 The specified icon index, 0-7 from left to right.
path
Image path.
【Input】 When it is NULL, the icon will not be
displayed.
0
Success
-1
Failed
1.
Instruction
2.
It takes effect after setting STATUSBAR by the parameter argv
of XuiOpen(). (that is, the height of the status bar has been set)
When the path is NULL or wrong, the original icon will be
hidden.
3.42 XuiGetHzString
Prototype
int XuiGetHzString(XuiImeAttr attr,
char *outstr,
unsigned int maxlen,
unsigned int timeout);
Function
It is a Chinese inputting interface with the mnemonic function,
English letter and numeric character can also be inputted.
attr
Attributes of the input method, refer to the
structure XuiImeAttr.
Parameter specification:
All the pointers must be valid, such as
pointers of font and parent canvas and so
on;
【Input】
x and y can’t be negative;
12 < text_size < 40 ;
height
must
be
greater
than
4*(text_size+10);
The transparent background is not
supported.
outstr
【Input】 Store the input string (ending with ‘\0’)
Parameters
PAX Computer Technology(Shenzhen)Co.,Ltd.
38
Prolin XUI Interface
Return
maxlen
【Input】
The maximum length of the input string (the
maximum is 1024 bytes)
timeout
【Input】
Timeout value,
【unit:second】.
0x00
Success
0xFE
Invalid parameter.
0xFD
Timeout
1.
2.
3.
Instruction
4.
5.
6.
7.
0
means
no
timeout.
Press key 【 Alpha 】 to switch input methods among
“PinYin-Chinese”, “uppercase”, “lowercase” and “area code”.
Input area code. Users can input Chinese character according to
the code in the mode of “area code” inputting.
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 “中”.
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.
Input number. Press number in the mode of “123” inputting, then
it will display on the screen.
Press key【Clear】to clear the inputted characters.
After inputting, press【Cancel】to exit the input method, and the
inputted character can be obtained from the parameter OutStr.
3.43 XuiGetString
Prototype
int XuiGetString(XuiGetStrAttr attr,
char *outstr,
unsigned char mode,
int minlen,
int maxlen);
Function
Input the character string and display it on the screen with the
specified mode, the character string can be letter, amount or password
etc.
Parameters
Attributes of inputting string, details refer to
structure XuiGetStrAttr.
attr
【Input】
outstr
【Input】 Store the input string (ending with ‘‗\0’)
mode
【Input】
PAX Computer Technology(Shenzhen)Co.,Ltd.
D7 1(0) reserved
D6 1(0) reserved
39
Prolin XUI Interface
D5 1(0) whether to input number
D4 1(0) whether to input letter
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
Return
Minlen
【Input】 The minimum length of the input string.
maxlen
【Input】
The maximum length of the input string (the
maximum value is 128 bytes)
0x00
Input successfully
0xFE
Invalid parameter value (including the mode
value is invalid; MaxLen =0; and the initial
digital string is invalid.)
0xFD
Input timeout (120 seconds, and this value
can’t be modified.)
Instruction
3.44 XuiBidiStrdup
Prototype
char * XuiBidiStrdup(const char *str);
Function
To do the string conversion for Arabic and Hebrew string characters,
and display the Arabic and Hebrew string characters.
Parameters str
Return
Instruction
【Input】
The UTF-8 coding string character that needs
conversion.
NULL
Conversion failed, parameter str is invalid.
a string
The converted UTF-8 coding 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;
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.
40
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.45 XuiCanvasAnimation
Prototype
int XuiCanvasAnimation(XuiWindow *front,
XuiWindow *background,
unsigned int front_rate,
unsigned int background_rate,
int type);
Function
Create switching animations of two XuiWindows.
front
【Input】 XuiWindow before switching
background【Input】 XuiWindow after switching
front_rate 【Input】
Parameters
background_rate
【Input】
type
Return
Instruction
【Input】
The ratio of front window on the display
window during the switch process.
The ratio of background window on the display
window during the switch process.
The animation type used during the switch
process.
For more information,
XuiAnimationType
0
Success
<0
Failed
please
refer
to
1. This function is used for switching the windows in the form of
animation, currently animation supports up/down/left/right
translation and scaling.
PAX Computer Technology(Shenzhen)Co.,Ltd.
41
Prolin XUI Interface
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.46 XuiGetGesture
Prototype
int XuiGetGesture(XuiGesture* gesture);
Function
Get gesture event.
Parameters
gesture【Output】
Gesture type, refer to structure XuiGesture.
1
Gesture event exists in current state.
<= 0
Gesture event doesn’t exist in current state.
Return
Instruction
1. The current supported gesture event types are up/down/left/right
slide, translation and scaling.
2. This function only applies to Prolin-cygnus-2.6.
3.47 XuiSetGestureRect
Prototype
int XuiSetGestureRect(unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height);
Function
Set the corresponding area of gesture event.
Parameters
Return
Instruction
x
【Input】
x coordinate of the gesture corresponding area.
y
【Input】
y coordinate of the gesture corresponding area.
width
【Input】
The width of the corresponding area.
height 【Input】
The height of the corresponding area.
0
Success
<0
Failed.
1. This function is called in combination with XuiGetGesture().
PAX Computer Technology(Shenzhen)Co.,Ltd.
42
Prolin XUI Interface
2. This function only applies to Prolin-cygnus-2.6.
3.48 XuiClearGesture
Prototype
void XuiClearGesture(void);
Function
Clear gesture event.
Parameters None
Return
Instruction
None
This function only applies to Prolin-cygnus-2.6.
3.49 XuiShowSoftKeyboard
Prototype
int XuiShowSoftKeyboard(int type,
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.
Parameters
show
Return
Instruction
【Input】
1-show
0-hide
0
Success
<0
Failed
When showing input soft keyboard, the password soft keyboard will be
automatically hidden (if it is showing). When showing 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.
PAX Computer Technology(Shenzhen)Co.,Ltd.
43
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);
/*Destroy*/
XuiDestroyWindow(btn);
PAX Computer Technology(Shenzhen)Co.,Ltd.
44
Prolin XUI Interface
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.
45
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?
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.
PAX Computer Technology(Shenzhen)Co.,Ltd.
46
Prolin XUI Interface
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.
47
Prolin XUI Interface
Prolin XUI Interface
PAX Computer Technology(Shenzhen)Co.,Ltd.
48
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf Linearized : No Page Count : 56 PDF Version : 1.4 Title : Prolin XUI Interface Author : wangfen Subject : V2.0.7 Producer : Mac OS X 10.11.5 Quartz PDFContext Creator : Microsoft® Office Word 2007 Create Date : 2016:09:28 14:19:45Z Modify Date : 2016:09:28 14:19:45ZEXIF Metadata provided by EXIF.tools