Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_gfx.h
1 #ifndef _BC_GFX_H
2 #define _BC_GFX_H
3 
4 #include <bc_common.h>
5 #include <bc_font_common.h>
6 
10 
12 
13 typedef struct
14 {
15  int width;
16  int height;
17 
19 
21 
22 typedef struct
23 {
25  bool (*is_ready)(void *self);
26 
28  void (*clear)(void *self);
29 
31  void (*draw_pixel)(void *self, int left, int top, uint32_t color);
32 
34  uint32_t (*get_pixel)(void *self, int left, int top);
35 
37  bool (*update)(void *self);
38 
40  bc_gfx_caps_t (*get_caps)(void *self);
41 
43 
45 
46 typedef enum
47 {
50 
53 
56 
59 
61 
62 typedef enum
63 {
66 
69 
72 
75 
77 
79 
80 typedef struct
81 {
82  void *_display;
83  const bc_gfx_driver_t *_driver;
84  bc_gfx_rotation_t _rotation;
85  const bc_font_t *_font;
86  bc_gfx_caps_t _caps;
87 
88 } bc_gfx_t;
89 
92 
93 void bc_gfx_init(bc_gfx_t *self, void *display, const bc_gfx_driver_t *driver);
94 
99 
101 
104 
106 
109 
110 void bc_gfx_clear(bc_gfx_t *self);
111 
115 
116 void bc_gfx_set_font(bc_gfx_t *self, const bc_font_t *font);
117 
121 
122 void bc_gfx_set_rotation(bc_gfx_t *self, bc_gfx_rotation_t rotation);
123 
127 
129 
135 
136 void bc_gfx_draw_pixel(bc_gfx_t *self, int x, int y, uint32_t color);
137 
145 
146 int bc_gfx_draw_char(bc_gfx_t *self, int left, int top, uint8_t ch, uint32_t color);
147 
151 
152 int bc_gfx_calc_char_width(bc_gfx_t *self, uint8_t ch);
153 
161 
162 int bc_gfx_draw_string(bc_gfx_t *self, int left, int top, char *str, uint32_t color);
163 
168 
169 int bc_gfx_calc_string_width(bc_gfx_t *self, char *str);
170 
179 
180 int bc_gfx_printf(bc_gfx_t *self, int left, int top, uint32_t color, char *format, ...);
181 
189 
190 void bc_gfx_draw_line(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color);
191 
199 
200 void bc_gfx_draw_rectangle(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color);
201 
209 
210 void bc_gfx_draw_fill_rectangle(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color);
211 
219 
220 void bc_gfx_draw_fill_rectangle_dithering(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color);
221 
228 
229 void bc_gfx_draw_circle(bc_gfx_t *self, int x0, int y0, int radius, uint32_t color);
230 
237 
238 void bc_gfx_draw_fill_circle(bc_gfx_t *self, int x0, int y0, int radius, uint32_t color);
239 
247 
248 void bc_gfx_draw_round_corner(bc_gfx_t *self, int x0, int y0, int radius, bc_gfx_round_corner_t corner, uint32_t color);
249 
257 
258 void bc_gfx_draw_fill_round_corner(bc_gfx_t *self, int x0, int y0, int radius, bc_gfx_round_corner_t corner, uint32_t color);
259 
264 
265 bool bc_gfx_update(bc_gfx_t *self);
266 
268 
269 #endif // _BC_GFX_H
bc_gfx_rotation_t
Rotation.
Definition: bc_gfx.h:46
int bc_gfx_draw_char(bc_gfx_t *self, int left, int top, uint8_t ch, uint32_t color)
Display draw char.
Definition: bc_gfx.c:86
void bc_gfx_clear(bc_gfx_t *self)
Clear.
Definition: bc_gfx.c:22
void bc_gfx_init(bc_gfx_t *self, void *display, const bc_gfx_driver_t *driver)
Initialize button.
Definition: bc_gfx.c:3
void bc_gfx_draw_pixel(bc_gfx_t *self, int x, int y, uint32_t color)
Draw pixel.
Definition: bc_gfx.c:42
Display size.
Definition: bc_gfx.h:13
void bc_gfx_draw_fill_round_corner(bc_gfx_t *self, int x0, int y0, int radius, bc_gfx_round_corner_t corner, uint32_t color)
Lcd draw fill round corner, using Midpoint circle algorithm.
Definition: bc_gfx.c:427
bc_gfx_round_corner_t
Definition: bc_gfx.h:62
Rotation 90 degrees.
Definition: bc_gfx.h:52
int bc_gfx_printf(bc_gfx_t *self, int left, int top, uint32_t color, char *format,...)
Display string.
Definition: bc_gfx.c:173
Display driver interface.
Definition: bc_gfx.h:22
int bc_gfx_calc_char_width(bc_gfx_t *self, uint8_t ch)
Calc width character.
Definition: bc_gfx.c:132
void bc_gfx_set_rotation(bc_gfx_t *self, bc_gfx_rotation_t rotation)
Set rotation.
Definition: bc_gfx.c:32
void bc_gfx_draw_fill_rectangle(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color)
Display draw fill rectangle.
Definition: bc_gfx.c:286
void bc_gfx_draw_rectangle(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color)
Display draw rectangle.
Definition: bc_gfx.c:278
int bc_gfx_calc_string_width(bc_gfx_t *self, char *str)
Calc width string.
Definition: bc_gfx.c:162
int bc_gfx_draw_string(bc_gfx_t *self, int left, int top, char *str, uint32_t color)
Display draw string.
Definition: bc_gfx.c:152
void bc_gfx_draw_circle(bc_gfx_t *self, int x0, int y0, int radius, uint32_t color)
Lcd draw circle, using Midpoint circle algorithm.
Definition: bc_gfx.c:313
Rotation 180 degrees.
Definition: bc_gfx.h:55
bool bc_gfx_display_is_ready(bc_gfx_t *self)
Check if display driver is ready for commands.
Definition: bc_gfx.c:12
void bc_gfx_draw_round_corner(bc_gfx_t *self, int x0, int y0, int radius, bc_gfx_round_corner_t corner, uint32_t color)
Lcd draw round corner, using Midpoint circle algorithm.
Definition: bc_gfx.c:378
void bc_gfx_draw_fill_circle(bc_gfx_t *self, int x0, int y0, int radius, uint32_t color)
Lcd draw fill circle, using Midpoint circle algorithm.
Definition: bc_gfx.c:348
Round corner left top.
Definition: bc_gfx.h:74
Round corner left bottom.
Definition: bc_gfx.h:71
bool bc_gfx_update(bc_gfx_t *self)
Display update, send data.
Definition: bc_gfx.c:476
Instance.
Definition: bc_gfx.h:80
bc_gfx_rotation_t bc_gfx_get_rotation(bc_gfx_t *self)
Get rotation.
Definition: bc_gfx.c:37
void bc_gfx_set_font(bc_gfx_t *self, const bc_font_t *font)
Set font.
Definition: bc_gfx.c:27
void bc_gfx_draw_line(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color)
Display draw line.
Definition: bc_gfx.c:188
Round corner right bottom.
Definition: bc_gfx.h:68
Round corner right top.
Definition: bc_gfx.h:65
Rotation 270 degrees.
Definition: bc_gfx.h:58
bc_gfx_caps_t bc_gfx_get_caps(bc_gfx_t *self)
Get Display capabilities.
Definition: bc_gfx.c:17
Rotation 0 degrees.
Definition: bc_gfx.h:49
void bc_gfx_draw_fill_rectangle_dithering(bc_gfx_t *self, int x0, int y0, int x1, int y1, uint32_t color)
Display draw fill rectangle with a dithering pattern defined in the color parameter.
Definition: bc_gfx.c:298