1 /** 2 * @file lv_draw.h 3 * 4 */ 5 6 #ifndef LV_DRAW_H 7 #define LV_DRAW_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../lv_conf_internal.h" 17 18 #include "../misc/lv_style.h" 19 #include "../misc/lv_txt.h" 20 #include "lv_img_decoder.h" 21 #include "lv_img_cache.h" 22 23 #include "lv_draw_rect.h" 24 #include "lv_draw_label.h" 25 #include "lv_draw_img.h" 26 #include "lv_draw_line.h" 27 #include "lv_draw_triangle.h" 28 #include "lv_draw_arc.h" 29 #include "lv_draw_mask.h" 30 31 /********************* 32 * DEFINES 33 *********************/ 34 35 /********************** 36 * TYPEDEFS 37 **********************/ 38 39 typedef struct { 40 void * user_data; 41 } lv_draw_mask_t; 42 43 44 typedef struct _lv_draw_ctx_t { 45 /** 46 * Pointer to a buffer to draw into 47 */ 48 void * buf; 49 50 /** 51 * The position and size of `buf` (absolute coordinates) 52 */ 53 lv_area_t * buf_area; 54 55 /** 56 * The current clip area with absolute coordinates, always the same or smaller than `buf_area` 57 */ 58 const lv_area_t * clip_area; 59 60 61 void (*draw_rect)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords); 62 63 void (*draw_arc)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center, 64 uint16_t radius, uint16_t start_angle, uint16_t end_angle); 65 66 void (*draw_img_decoded)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, 67 const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format); 68 69 lv_res_t (*draw_img)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc, 70 const lv_area_t * coords, const void * src); 71 72 void (*draw_letter)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p, 73 uint32_t letter); 74 75 76 void (*draw_line)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1, 77 const lv_point_t * point2); 78 79 80 void (*draw_polygon)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, 81 const lv_point_t * points, uint16_t point_cnt); 82 83 /** 84 * Replace the buffer with a rect without decoration like radius or borders 85 */ 86 void (*draw_bg)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_area_t * coords); 87 88 /** 89 * Wait until all background operations are finished. (E.g. GPU operations) 90 */ 91 void (*wait_for_finish)(struct _lv_draw_ctx_t * draw); 92 93 #if LV_USE_USER_DATA 94 void * user_data; 95 #endif 96 97 } lv_draw_ctx_t; 98 99 /********************** 100 * GLOBAL PROTOTYPES 101 **********************/ 102 103 void lv_draw_init(void); 104 105 /********************** 106 * GLOBAL VARIABLES 107 **********************/ 108 109 /********************** 110 * MACROS 111 **********************/ 112 113 /********************** 114 * POST INCLUDES 115 *********************/ 116 117 #ifdef __cplusplus 118 } /*extern "C"*/ 119 #endif 120 121 #endif /*LV_DRAW_H*/ 122