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_conf_internal.h"
17 #include "../misc/lv_color.h"
18 #include "../misc/lv_area.h"
19 #include "../misc/lv_style.h"
20 #include "sw/lv_draw_sw_gradient.h"
21 
22 /*********************
23  *      DEFINES
24  *********************/
25 #define LV_RADIUS_CIRCLE        0x7FFF /**< A very big radius to always draw as circle*/
26 LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE);
27 
28 /**********************
29  *      TYPEDEFS
30  **********************/
31 
32 typedef struct {
33     lv_coord_t radius;
34     lv_blend_mode_t blend_mode;
35 
36     /*Background*/
37     lv_opa_t bg_opa;
38     lv_color_t bg_color;        /**< First element of a gradient is a color, so it maps well here*/
39     lv_grad_dsc_t bg_grad;
40 
41     /*Background img*/
42     const void * bg_img_src;
43     const void * bg_img_symbol_font;
44     lv_color_t bg_img_recolor;
45     lv_opa_t bg_img_opa;
46     lv_opa_t bg_img_recolor_opa;
47     uint8_t bg_img_tiled;
48 
49     /*Border*/
50     lv_color_t border_color;
51     lv_coord_t border_width;
52     lv_opa_t border_opa;
53     uint8_t border_post : 1;        /*There is a border it will be drawn later.*/
54     lv_border_side_t border_side : 5;
55 
56     /*Outline*/
57     lv_color_t outline_color;
58     lv_coord_t outline_width;
59     lv_coord_t outline_pad;
60     lv_opa_t outline_opa;
61 
62     /*Shadow*/
63     lv_color_t shadow_color;
64     lv_coord_t shadow_width;
65     lv_coord_t shadow_ofs_x;
66     lv_coord_t shadow_ofs_y;
67     lv_coord_t shadow_spread;
68     lv_opa_t shadow_opa;
69 } lv_draw_rect_dsc_t;
70 
71 struct _lv_draw_ctx_t;
72 
73 /**********************
74  * GLOBAL PROTOTYPES
75  **********************/
76 
77 LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
78 
79 
80 /**
81  * Draw a rectangle
82  * @param coords the coordinates of the rectangle
83  * @param clip the rectangle will be drawn only in this area
84  * @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
85  */
86 void lv_draw_rect(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
87 
88 /**********************
89  *      MACROS
90  **********************/
91 
92 #ifdef __cplusplus
93 } /*extern "C"*/
94 #endif
95 
96 #endif /*LV_DRAW_RECT_H*/
97