Prolin XUI Interface (V2.1.7)
Prolin XUI Interface (V2.1.7)
V2.1.7
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
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
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.
To put it simply, XUI programming is to draw, to write and to wait for keypress.
1.2 Function
Support screenshot.
1.3 Feature
The design only includes three elements: canvas, button and key value.
Canvas
PAX Computer Technology (Shenzhen) Co.,Ltd. 2
Prolin XUI Interface
3. It contains background image and background color, the background will not be
Button
2. Each state includes the following parameters: border, background color, icon, text
3. When click on the button, the parameter key takes the value of GetKey(). The key
Key value
1. The key value and physical button value are in the same queue.
When programming, operations are mainly done on the RootCanvas. If dialog boxes
For printer, user only needs to create a hidden canvas and write on it. After that, cut
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_KEYCLEAR 14 /*Clear*/
XUI_KEYENTER 28 /*Enter*/
XUI_KEYALPHA 63 /*Alpha*/
XUI_KEYF1 59
XUI_KEYFUNC 102
XUI_KEYUP 103
XUI_KEYDOWN 108
XUI_KEYMENU 139
XUI_SOFTKEYBOARD_KEY
0xff+8 /* backspace key */
BACKSPACE
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
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
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
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
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 */
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
key and digital key on the physical keypad, and virtual key
case, this virtual key can also generate this combination key
value.
Macro Description
b Blue channel
g Green channel
r Red channel
a ALPHA channel
Macro Description
XUI_ROTATE_0 No rotation
Macro Description
Macro Description
XUI_BG_TILE Tile
XUI_BG_CENTER Center
Macro Description
Macro Description
XUI_TEXT_NORMAL Normal
XUI_BOLD Bold
XUI_ITALIC Italic
Macro Description
Macro Description
Macro Description
Macro Description
XUI_SCALE Scale
Macro Description
XUI_GESTURE_FLINGUP Slid up
XUI_GESTURE_SCROLLUP Scroll up
Macro Description
Macro Description
Macro Description
2.4 Structure
1. Structure XuiWindow
2. Structure XuiImg
3. Structure XuiButtonStat
Text text
Img Image
4. Structure XuiSigBoardStat
text text
img Image
5. Structure XuiCameraStat
text Text
img image
6. Structure XuiImeAttr
7. Structure XuiGetStrAttr
8. Structure XuiSignPoint
9. Structure XuiSignData
3 XUI API
3.1 XuiOpen
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
3.3 XuiClose
Return None
Instruction Call this function when the application exits.
3.4 XuiSuspend
3.5 XuiResume
3.6 XuiRootCanvas
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
3.8 XuiCreateFont
3.9 XuiDestroyFont
3.10 XuiCanvasDrawText
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
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
3.13 XuiCanvasDrawRect
3.14 XuiClearArea
3.15 XuiTextWidth
3.16 XuiTextWidthEx
3.17 XuiCreateCanvas
3.18 XuiCreateCanvasEx
3.19 XuiCanvasMoveToY
3.20 XuiDestroyWindow
3.21 XuiShowWindow
3.22 XuiCanvasSetBackground
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
3.24 XuiButtonSetStat
3.25 XuiButtonSetKey
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.
3.27 XuiSigBoardSetStat
3.28 XuiSigBoardImg
3.29 XuiSigBoardSignData
3.30 XuiCreateGif
3.31 XuiHasKey
3.32 XuiGetKey
3.33 XuiClearKey
3.34 XuiCaptureScreen
3.35 XuiCaptureCanvas
3.36 XuiImgLoadFromFile
3.37 XuiImgLoadFromMem
Instruction Currently it only supports images in bmp, jpeg and png format.
3.38 XuiImgSaveToFile
3.39 XuiImgToRgba
3.40 XuiImgToGray8
3.41 XuiImgToBgr24
3.42 XuiImgToFrameBuffer
bit (RGB888), the size value is not less than width * height *
3;
2. The img should be a valid XuiImg pointer.
3.43 XuiImgTransform
3.44 XuiImgResize
3.45 XuiImgCompose
NULL Failed
3.46 XuiImgFree
3.47 XuiSetStatusbarIcon
3.48 XuiGetHzString
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
3.50 XuiBidiStrdup
3.51 XuiCanvasAnimation
background
XuiWindow after switching
【Input】
0 Succeeded
Return
<0 Failed
Instruction 1. This function is used for switching the windows in the form
3.52 XuiGetGesture
Parameter
s gesture【Output】 Gesture type, refer to structure XuiGesture.
3.53 XuiSetGestureRect
0 Succeeded
Return
<0 Failed.
3.54 XuiClearGesture
Parameters None
Return None
3.55 XuiShowSoftKeyboard
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
3.56 XuiCreateCamera
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.
3.57 XuiCameraSetStat
0 Failed
Return
<0 Image pointer
3.58 XuiCameraCapture
NULL Failed
Return
Others Image pointer
3.59 XuiCreateScaner
unsigned int y,
int index,
int zoom);
Create camera preview window on canvas for scanning
Function
barcode.
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
0 Succeeded
Return
<0 Failed
Instruction
3.61 XuiRgbaToImg
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.
3.62 XuiFrameBufferToImg
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
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.
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:
/*Destroy*/
XuiDestroyWindow(btn);
XuiImgFree(img_bg);
XuiDestroyFont(font_simsun_0);
5 FAQ
1. The root canvas exists after opening the XUI, so can the root canvas be gotten by
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
2. Does XUI support canvas nesting? For example, Root canvas-> sub-canvas 1 ->
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
Answer: Yes, it does. All the returning type of XuiWindow* need to be destroyed
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,
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