1 /**
2  * @file lv_draw_rect.h
3  *
4  */
5 
6 #ifndef LV_DRAW_RECT_H
7 #define LV_DRAW_RECT_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../lv_core/lv_style.h"
17 
18 /*********************
19  *      DEFINES
20  *********************/
21 
22 /**********************
23  *      TYPEDEFS
24  **********************/
25 
26 typedef struct {
27     lv_style_int_t radius;
28 
29     /*Background*/
30     lv_color_t bg_color;
31     lv_color_t bg_grad_color;
32     lv_grad_dir_t bg_grad_dir;
33     lv_style_int_t bg_main_color_stop;
34     lv_style_int_t bg_grad_color_stop;
35     lv_opa_t bg_opa;
36     lv_blend_mode_t bg_blend_mode;
37 
38     /*Border*/
39     lv_color_t border_color;
40     lv_style_int_t border_width;
41     lv_style_int_t border_side;
42     lv_opa_t border_opa;
43     lv_blend_mode_t border_blend_mode;
44     uint8_t border_post : 1;        /*There is a border it will be drawn later. */
45 
46     /*Outline*/
47     lv_color_t outline_color;
48     lv_style_int_t outline_width;
49     lv_style_int_t outline_pad;
50     lv_opa_t outline_opa;
51     lv_blend_mode_t outline_blend_mode;
52 
53     /*Shadow*/
54     lv_color_t shadow_color;
55     lv_style_int_t shadow_width;
56     lv_style_int_t shadow_ofs_x;
57     lv_style_int_t shadow_ofs_y;
58     lv_style_int_t shadow_spread;
59     lv_opa_t shadow_opa;
60     lv_blend_mode_t shadow_blend_mode;
61 
62     /*Pattern*/
63     const void * pattern_image;
64     const lv_font_t * pattern_font;
65     lv_color_t pattern_recolor;
66     lv_opa_t pattern_opa;
67     lv_opa_t pattern_recolor_opa;
68     uint8_t pattern_repeat : 1;
69     lv_blend_mode_t pattern_blend_mode;
70 
71     /*Value*/
72     const char * value_str;
73     const lv_font_t * value_font;
74     lv_opa_t value_opa;
75     lv_color_t value_color;
76     lv_style_int_t value_ofs_x;
77     lv_style_int_t value_ofs_y;
78     lv_style_int_t value_letter_space;
79     lv_style_int_t value_line_space;
80     lv_align_t value_align;
81     lv_blend_mode_t value_blend_mode;
82 } lv_draw_rect_dsc_t;
83 
84 /**********************
85  * GLOBAL PROTOTYPES
86  **********************/
87 
88 LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
89 
90 //! @endcond
91 
92 /**
93  * Draw a rectangle
94  * @param coords the coordinates of the rectangle
95  * @param mask the rectangle will be drawn only in this mask
96  * @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
97  */
98 void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_rect_dsc_t * dsc);
99 
100 /**
101  * Draw a pixel
102  * @param point the coordinates of the point to draw
103  * @param mask the pixel will be drawn only in this mask
104  * @param style pointer to a style
105  */
106 void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style);
107 
108 /**********************
109  *      MACROS
110  **********************/
111 
112 #ifdef __cplusplus
113 } /* extern "C" */
114 #endif
115 
116 #endif /*LV_DRAW_RECT_H*/
117