1 /**
2  * @file lv_objmask.h
3  *
4  */
5 
6 #ifndef LV_OBJMASK_H
7 #define LV_OBJMASK_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../lv_conf_internal.h"
17 
18 #if LV_USE_OBJMASK != 0
19 
20 #include "../lv_core/lv_obj.h"
21 #include "../lv_widgets/lv_cont.h"
22 
23 /*********************
24  *      DEFINES
25  *********************/
26 
27 /**********************
28  *      TYPEDEFS
29  **********************/
30 
31 typedef struct {
32     void * param;
33 } lv_objmask_mask_t;
34 
35 /*Data of object mask*/
36 typedef struct {
37     lv_cont_ext_t cont; /*Ext. of ancestor*/
38     /*New data for this type */
39     lv_ll_t mask_ll;    /*Store the created masks*/
40 
41 } lv_objmask_ext_t;
42 
43 /*Parts of the object*/
44 enum {
45     LV_OBJMASK_PART_MAIN,
46 };
47 typedef uint8_t lv_objmask_part_t;
48 
49 /**********************
50  * GLOBAL PROTOTYPES
51  **********************/
52 
53 /**
54  * Create a object mask objects
55  * @param par pointer to an object, it will be the parent of the new object mask
56  * @param copy pointer to a object mask object, if not NULL then the new object will be copied from it
57  * @return pointer to the created object mask
58  */
59 lv_obj_t * lv_objmask_create(lv_obj_t * par, const lv_obj_t * copy);
60 
61 /*======================
62  * Add/remove functions
63  *=====================*/
64 
65 /**
66  * Add a mask
67  * @param objmask pointer to an Object mask object
68  * @param param an initialized mask parameter
69  * @return pointer to the added mask
70  */
71 lv_objmask_mask_t * lv_objmask_add_mask(lv_obj_t * objmask, void * param);
72 
73 /**
74  * Update an already created mask
75  * @param objmask pointer to an Object mask object
76  * @param mask pointer to created mask (returned by `lv_objmask_add_mask`)
77  * @param param an initialized mask parameter (initialized by `lv_draw_mask_line/angle/.../_init`)
78  */
79 void lv_objmask_update_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask, void * param);
80 
81 /**
82  * Remove a mask
83  * @param objmask pointer to an Object mask object
84  * @param mask pointer to created mask (returned by `lv_objmask_add_mask`)
85  * If `NULL` passed all masks will be deleted.
86  */
87 void lv_objmask_remove_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask);
88 
89 /*=====================
90  * Setter functions
91  *====================*/
92 
93 /*=====================
94  * Getter functions
95  *====================*/
96 
97 /*=====================
98  * Other functions
99  *====================*/
100 
101 /**********************
102  *      MACROS
103  **********************/
104 
105 #endif /*LV_USE_OBJMASK*/
106 
107 #ifdef __cplusplus
108 } /* extern "C" */
109 #endif
110 
111 #endif /*LV_OBJMASK_H*/
112