Table of contents 2 B4X XUI
1 B4X platforms .............................................................................................................................. 5
2 General ......................................................................................................................................... 6
3 XUI Objects ................................................................................................................................. 7
3.1 B4XView ............................................................................................................................. 8
3.2 B4XBitmap ........................................................................................................................ 13
3.2.1 Examples ........................................................................................................................ 14
3.2.1.1 Define a B4XBitmap .............................................................................................. 14
3.2.1.2 Initialize the Bimap (B4A, B4i) or Image (B4J) .................................................... 14
3.2.1.3 Draw the bitmap ..................................................................................................... 14
3.2.1.4 Save a bitmap ......................................................................................................... 14
3.3 B4XCanvas ........................................................................................................................ 15
3.3.1 Examples ........................................................................................................................ 17
3.3.1.1 Declare a target B4XView ..................................................................................... 17
3.3.1.2 Initialize a B4XCanvas .......................................................................................... 17
3.3.1.2.1 B4A .................................................................................................................. 17
3.3.1.2.2 B4i .................................................................................................................... 17
3.3.1.2.3 B4J .................................................................................................................... 17
3.3.1.3 Draw a line ............................................................................................................. 17
3.3.1.4 Draw a rectangle .................................................................................................... 17
3.3.1.5 Draw a circle .......................................................................................................... 18
3.3.1.6 Draw a text ............................................................................................................. 18
3.3.1.7 ClipPath .................................................................................................................. 18
3.3.1.8 DrawPath ................................................................................................................ 19
3.3.1.9 DrawPolygon ......................................................................................................... 20
3.3.1.10 MeasureText ....................................................................................................... 21
3.4 B4XFont ............................................................................................................................. 22
3.4.1 Examples ........................................................................................................................ 22
3.4.1.1 Example with a ‘standard’ font .............................................................................. 22
3.4.1.2 Example with FontAwesome ................................................................................. 22
3.4.1.3 Example with MaterialIcons .................................................................................. 23
3.4.1.4 Example for a CustomView recovering the Label font ......................................... 23
3.4.1.5 Example with a custom font ................................................................................... 23
3.5 B4XPath ............................................................................................................................. 24
3.5.1 Examples ........................................................................................................................ 25
3.5.1.1 ClipPath .................................................................................................................. 25
3.5.1.2 DrawPath ................................................................................................................ 25
3.6 B4XRect ............................................................................................................................. 26
3.6.1 Examples ........................................................................................................................ 26
3.6.1.1 Declare a rectangle ................................................................................................. 26
3.6.1.2 Initialize rectangle and draw it ............................................................................... 26
3.6.1.3 Set a rectangle to transparent ClearRect .............................................................. 26
3.7 As keyword ........................................................................................................................ 27
4 Compatibilities B4A B4i B4J XUI ........................................................................................ 28
5 XUI Process objects ................................................................................................................... 29
6 First example .............................................................................................................................. 33
6.1 The code ............................................................................................................................. 34
6.1.1 B4A ................................................................................................................................ 34
6.1.2 B4i .................................................................................................................................. 35
6.1.3 B4J ................................................................................................................................. 36
6.1.4 Common code ................................................................................................................ 37
7 Graphics first steps ..................................................................................................................... 38
7.1.1 Initialization B4XMainPage module ............................................................................ 40
7.1.2 Initialization GraphicsFirstSteps module ...................................................................... 40