@@ -15,238 +15,6 @@ extern "C" {
1515
1616#include <stdbool.h>
1717
18- #include "lv_conf.h"
19-
20- typedef lv_coord_t wgl_coord_t ; /* lv_coord_t is defined in lv_conf.h */
21- typedef void * wgl_font_user_data_t ;
22-
23- /**
24- * Represents a point on the screen.
25- */
26- typedef struct
27- {
28- lv_coord_t x ;
29- lv_coord_t y ;
30- } wgl_point_t ;
31-
32- /** Represents an area of the screen. */
33- typedef struct
34- {
35- lv_coord_t x1 ;
36- lv_coord_t y1 ;
37- lv_coord_t x2 ;
38- lv_coord_t y2 ;
39- } wgl_area_t ;
40-
41-
42- /** Describes the properties of a glyph. */
43- typedef struct
44- {
45- uint16_t adv_w ; /**< The glyph needs this space. Draw the next glyph after this width. 8 bit integer, 4 bit fractional */
46- uint8_t box_w ; /**< Width of the glyph's bounding box*/
47- uint8_t box_h ; /**< Height of the glyph's bounding box*/
48- int8_t ofs_x ; /**< x offset of the bounding box*/
49- int8_t ofs_y ; /**< y offset of the bounding box*/
50- uint8_t bpp ; /**< Bit-per-pixel: 1, 2, 4, 8*/
51- }wgl_font_glyph_dsc_t ;
52-
53- /*Describe the properties of a font*/
54- typedef struct _wgl_font_struct
55- {
56- /** Get a glyph's descriptor from a font*/
57- bool (* get_glyph_dsc )(const struct _wgl_font_struct * , wgl_font_glyph_dsc_t * , uint32_t letter , uint32_t letter_next );
58-
59- /** Get a glyph's bitmap from a font*/
60- const uint8_t * (* get_glyph_bitmap )(const struct _wgl_font_struct * , uint32_t );
61-
62- /*Pointer to the font in a font pack (must have the same line height)*/
63- uint8_t line_height ; /**< The real line height where any text fits*/
64- uint8_t base_line ; /**< Base line measured from the top of the line_height*/
65- void * dsc ; /**< Store implementation specific data here*/
66- #if LV_USE_USER_DATA
67- wgl_font_user_data_t user_data ; /**< Custom user data for font. */
68- #endif
69- } wgl_font_t ;
70-
71- #if LV_COLOR_DEPTH == 1
72- #define LV_COLOR_SIZE 8
73- #elif LV_COLOR_DEPTH == 8
74- #define LV_COLOR_SIZE 8
75- #elif LV_COLOR_DEPTH == 16
76- #define LV_COLOR_SIZE 16
77- #elif LV_COLOR_DEPTH == 32
78- #define LV_COLOR_SIZE 32
79- #else
80- #error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
81- #endif
82-
83- /**********************
84- * TYPEDEFS
85- **********************/
86-
87- typedef union
88- {
89- uint8_t blue : 1 ;
90- uint8_t green : 1 ;
91- uint8_t red : 1 ;
92- uint8_t full : 1 ;
93- } wgl_color1_t ;
94-
95- typedef union
96- {
97- struct
98- {
99- uint8_t blue : 2 ;
100- uint8_t green : 3 ;
101- uint8_t red : 3 ;
102- } ch ;
103- uint8_t full ;
104- } wgl_color8_t ;
105-
106- typedef union
107- {
108- struct
109- {
110- #if LV_COLOR_16_SWAP == 0
111- uint16_t blue : 5 ;
112- uint16_t green : 6 ;
113- uint16_t red : 5 ;
114- #else
115- uint16_t green_h : 3 ;
116- uint16_t red : 5 ;
117- uint16_t blue : 5 ;
118- uint16_t green_l : 3 ;
119- #endif
120- } ch ;
121- uint16_t full ;
122- } wgl_color16_t ;
123-
124- typedef union
125- {
126- struct
127- {
128- uint8_t blue ;
129- uint8_t green ;
130- uint8_t red ;
131- uint8_t alpha ;
132- } ch ;
133- uint32_t full ;
134- } wgl_color32_t ;
135-
136- #if LV_COLOR_DEPTH == 1
137- typedef uint8_t wgl_color_int_t ;
138- typedef wgl_color1_t wgl_color_t ;
139- #elif LV_COLOR_DEPTH == 8
140- typedef uint8_t wgl_color_int_t ;
141- typedef wgl_color8_t wgl_color_t ;
142- #elif LV_COLOR_DEPTH == 16
143- typedef uint16_t wgl_color_int_t ;
144- typedef wgl_color16_t wgl_color_t ;
145- #elif LV_COLOR_DEPTH == 32
146- typedef uint32_t wgl_color_int_t ;
147- typedef wgl_color32_t wgl_color_t ;
148- #else
149- #error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
150- #endif
151-
152- typedef uint8_t wgl_opa_t ;
153-
154-
155-
156- /*Border types (Use 'OR'ed values)*/
157- enum {
158- WGL_BORDER_NONE = 0x00 ,
159- WGL_BORDER_BOTTOM = 0x01 ,
160- WGL_BORDER_TOP = 0x02 ,
161- WGL_BORDER_LEFT = 0x04 ,
162- WGL_BORDER_RIGHT = 0x08 ,
163- WGL_BORDER_FULL = 0x0F ,
164- WGL_BORDER_INTERNAL = 0x10 , /**< FOR matrix-like objects (e.g. Button matrix)*/
165- };
166- typedef uint8_t wgl_border_part_t ;
167-
168- /*Shadow types*/
169- enum {
170- WGL_SHADOW_BOTTOM = 0 , /**< Only draw bottom shadow */
171- WGL_SHADOW_FULL , /**< Draw shadow on all sides */
172- };
173- typedef uint8_t wgl_shadow_type_t ;
174-
175- /**
176- * Objects in LittlevGL can be assigned a style - which holds information about
177- * how the object should be drawn.
178- *
179- * This allows for easy customization without having to modify the object's design
180- * function.
181- */
182- typedef struct
183- {
184- uint8_t glass : 1 ; /**< 1: Do not inherit this style*/
185-
186- /** Object background. */
187- struct
188- {
189- wgl_color_t main_color ; /**< Object's main background color. */
190- wgl_color_t grad_color ; /**< Second color. If not equal to `main_color` a gradient will be drawn for the background. */
191- wgl_coord_t radius ; /**< Object's corner radius. You can use #WGL_RADIUS_CIRCLE if you want to draw a circle. */
192- wgl_opa_t opa ; /**< Object's opacity (0-255). */
193-
194- struct
195- {
196- wgl_color_t color ; /**< Border color */
197- wgl_coord_t width ; /**< Border width */
198- wgl_border_part_t part ; /**< Which borders to draw */
199- wgl_opa_t opa ; /**< Border opacity. */
200- } border ;
201-
202-
203- struct
204- {
205- wgl_color_t color ;
206- wgl_coord_t width ;
207- wgl_shadow_type_t type ; /**< Which parts of the shadow to draw */
208- } shadow ;
209-
210- struct
211- {
212- wgl_coord_t top ;
213- wgl_coord_t bottom ;
214- wgl_coord_t left ;
215- wgl_coord_t right ;
216- wgl_coord_t inner ;
217- } padding ;
218- } body ;
219-
220- /** Style for text drawn by this object. */
221- struct
222- {
223- wgl_color_t color ; /**< Text color */
224- wgl_color_t sel_color ; /**< Text selection background color. */
225- const wgl_font_t * font ;
226- wgl_coord_t letter_space ; /**< Space between letters */
227- wgl_coord_t line_space ; /**< Space between lines (vertical) */
228- wgl_opa_t opa ; /**< Text opacity */
229- } text ;
230-
231- /**< Style of images. */
232- struct
233- {
234- wgl_color_t color ; /**< Color to recolor the image with */
235- wgl_opa_t intense ; /**< Opacity of recoloring (0 means no recoloring) */
236- wgl_opa_t opa ; /**< Opacity of whole image */
237- } image ;
238-
239- /**< Style of lines (not borders). */
240- struct
241- {
242- wgl_color_t color ;
243- wgl_coord_t width ;
244- wgl_opa_t opa ;
245- uint8_t rounded : 1 ; /**< 1: rounded line endings*/
246- } line ;
247- } wgl_style_t ;
248-
249-
25018
25119/* Object native function IDs */
25220enum {
0 commit comments