1 /**
2  * @file lv_area_private.h
3  *
4  */
5 
6 #ifndef LV_AREA_PRIVATE_H
7 #define LV_AREA_PRIVATE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 
17 #include "lv_area.h"
18 
19 /*********************
20  *      DEFINES
21  *********************/
22 
23 /**********************
24  *      TYPEDEFS
25  **********************/
26 
27 /**********************
28  * GLOBAL PROTOTYPES
29  **********************/
30 
31 /**
32  * Set the position of an area (width and height will be kept)
33  * @param area_p pointer to an area
34  * @param x the new x coordinate of the area
35  * @param y the new y coordinate of the area
36  */
37 void lv_area_set_pos(lv_area_t * area_p, int32_t x, int32_t y);
38 
39 /**
40  * Get the common parts of two areas
41  * @param res_p pointer to an area, the result will be stored her
42  * @param a1_p pointer to the first area
43  * @param a2_p pointer to the second area
44  * @return false: the two area has NO common parts, res_p is invalid
45  */
46 bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
47 
48 /**
49  * Get resulting sub areas after removing the common parts of two areas from the first area
50  * @param res_p pointer to an array of areas with a count of 4, the resulting areas will be stored here
51  * @param a1_p pointer to the first area
52  * @param a2_p pointer to the second area
53  * @return number of results (max 4) or -1 if no intersect
54  */
55 int8_t lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t * a2_p);
56 
57 /**
58  * Join two areas into a third which involves the other two
59  * @param a_res_p pointer to an area, the result will be stored here
60  * @param a1_p pointer to the first area
61  * @param a2_p pointer to the second area
62  */
63 void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
64 
65 /**
66  * Check if a point is on an area
67  * @param a_p pointer to an area
68  * @param p_p pointer to a point
69  * @param radius radius of area (e.g. for rounded rectangle)
70  * @return false:the point is out of the area
71  */
72 bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t radius);
73 
74 /**
75  * Check if two area has common parts
76  * @param a1_p pointer to an area.
77  * @param a2_p pointer to another area
78  * @return false: a1_p and a2_p has no common parts
79  */
80 bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p);
81 
82 /**
83  * Check if an area is fully on another
84  * @param ain_p pointer to an area which could be in 'aholder_p'
85  * @param aholder_p pointer to an area which could involve 'ain_p'
86  * @param radius radius of `aholder_p` (e.g. for rounded rectangle)
87  * @return true: `ain_p` is fully inside `aholder_p`
88  */
89 bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, int32_t radius);
90 
91 /**
92  * Check if an area is fully out of another
93  * @param aout_p pointer to an area which could be in 'aholder_p'
94  * @param aholder_p pointer to an area which could involve 'ain_p'
95  * @param radius radius of `aholder_p` (e.g. for rounded rectangle)
96  * @return true: `aout_p` is fully outside `aholder_p`
97  */
98 bool lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, int32_t radius);
99 
100 /**
101  * Check if 2 area is the same
102  * @param a pointer to an area
103  * @param b pointer to another area
104  */
105 bool lv_area_is_equal(const lv_area_t * a, const lv_area_t * b);
106 
107 /**********************
108  *      MACROS
109  **********************/
110 
111 #ifdef __cplusplus
112 } /*extern "C"*/
113 #endif
114 
115 #endif /*LV_AREA_PRIVATE_H*/
116