1 /**
2  * @file lv_obj_draw.h
3  *
4  */
5 
6 #ifndef LV_OBJ_DRAW_H
7 #define LV_OBJ_DRAW_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../misc/lv_types.h"
17 #include "../draw/lv_draw_rect.h"
18 #include "../draw/lv_draw_label.h"
19 #include "../draw/lv_draw_image.h"
20 #include "../draw/lv_draw_line.h"
21 #include "../draw/lv_draw_arc.h"
22 
23 /*********************
24  *      DEFINES
25  *********************/
26 
27 /**********************
28  *      TYPEDEFS
29  **********************/
30 
31 typedef enum {
32     LV_LAYER_TYPE_NONE,
33     LV_LAYER_TYPE_SIMPLE,
34     LV_LAYER_TYPE_TRANSFORM,
35 } lv_layer_type_t;
36 
37 /**********************
38  * GLOBAL PROTOTYPES
39  **********************/
40 
41 /**
42  * Initialize a rectangle draw descriptor from an object's styles in its current state
43  * @param obj       pointer to an object
44  * @param part      part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
45  * @param draw_dsc  the descriptor to initialize.
46  *                  If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized.
47  *                  Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`.
48  * @note Only the relevant fields will be set.
49  *       E.g. if `border width == 0` the other border properties won't be evaluated.
50  */
51 void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc);
52 
53 /**
54  * Initialize a label draw descriptor from an object's styles in its current state
55  * @param obj       pointer to an object
56  * @param part      part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
57  * @param draw_dsc  the descriptor to initialize.
58  *                  If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized.
59  *                  Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`.
60  */
61 void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc);
62 
63 /**
64  * Initialize an image draw descriptor from an object's styles in its current state
65  * @param obj       pointer to an object
66  * @param part      part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
67  * @param draw_dsc  the descriptor to initialize.
68  *                  Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
69  */
70 void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc);
71 
72 /**
73  * Initialize a line draw descriptor from an object's styles in its current state
74  * @param obj pointer to an object
75  * @param part      part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
76  * @param draw_dsc  the descriptor to initialize.
77  *                  Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
78  */
79 void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc);
80 
81 /**
82  * Initialize an arc draw descriptor from an object's styles in its current state
83  * @param obj       pointer to an object
84  * @param part      part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
85  * @param draw_dsc  the descriptor to initialize.
86  *                  Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
87  */
88 void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc);
89 
90 /**
91  * Get the required extra size (around the object's part) to draw shadow, outline, value etc.
92  * @param obj       pointer to an object
93  * @param part      part of the object
94  * @return          the extra size required around the object
95  */
96 int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part);
97 
98 /**
99  * Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
100  * The result will be saved in `obj`.
101  * @param obj       pointer to an object
102  */
103 void lv_obj_refresh_ext_draw_size(lv_obj_t * obj);
104 
105 /**********************
106  *      MACROS
107  **********************/
108 
109 #ifdef __cplusplus
110 } /*extern "C"*/
111 #endif
112 
113 #endif /*LV_OBJ_DRAW_H*/
114