1 /**
2  * @file lv_draw_arc.h
3  *
4  */
5 
6 #ifndef LV_DRAW_ARC_H
7 #define LV_DRAW_ARC_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 
21 /*********************
22  *      DEFINES
23  *********************/
24 
25 /**********************
26  *      TYPEDEFS
27  **********************/
28 
29 typedef struct {
30     lv_draw_dsc_base_t base;
31 
32     lv_color_t color;
33     int32_t width;
34     lv_value_precise_t start_angle;
35     lv_value_precise_t end_angle;
36     lv_point_t center;
37     uint16_t radius;
38     const void * img_src;
39     lv_opa_t opa;
40     uint8_t rounded : 1;
41 } lv_draw_arc_dsc_t;
42 
43 /**********************
44  * GLOBAL PROTOTYPES
45  **********************/
46 
47 /**
48  * Initialize an arc draw descriptor.
49  * @param dsc       pointer to a draw descriptor
50  */
51 void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc);
52 
53 /**
54  * Try to get an arc draw descriptor from a draw task.
55  * @param task      draw task
56  * @return          the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_ARC
57  */
58 lv_draw_arc_dsc_t * lv_draw_task_get_arc_dsc(lv_draw_task_t * task);
59 
60 /**
61  * Create an arc draw task.
62  * @param layer         pointer to a layer
63  * @param dsc           pointer to an initialized draw descriptor variable
64  */
65 void lv_draw_arc(lv_layer_t * layer, const lv_draw_arc_dsc_t * dsc);
66 
67 /**
68  * Get an area the should be invalidated when the arcs angle changed between start_angle and end_ange
69  * @param x             the x coordinate of the center of the arc
70  * @param y             the y coordinate of the center of the arc
71  * @param radius        the radius of the arc
72  * @param start_angle   the start angle of the arc (0 deg on the bottom, 90 deg on the right)
73  * @param end_angle     the end angle of the arc
74  * @param w             width of the arc
75  * @param rounded       true: the arc is rounded
76  * @param area          store the area to invalidate here
77  */
78 void lv_draw_arc_get_area(int32_t x, int32_t y, uint16_t radius,  lv_value_precise_t start_angle,
79                           lv_value_precise_t end_angle,
80                           int32_t w, bool rounded, lv_area_t * area);
81 
82 /**********************
83  *      MACROS
84  **********************/
85 
86 #ifdef __cplusplus
87 } /*extern "C"*/
88 #endif
89 
90 #endif /*LV_DRAW_ARC_H*/
91