1 /**
2  * @file lv_draw_img.h
3  *
4  */
5 
6 #ifndef LV_DRAW_IMG_H
7 #define LV_DRAW_IMG_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "lv_img_decoder.h"
17 #include "lv_img_buf.h"
18 #include "../misc/lv_style.h"
19 
20 /*********************
21  *      DEFINES
22  *********************/
23 
24 /**********************
25  *      MACROS
26  **********************/
27 
28 /**********************
29  *      TYPEDEFS
30  **********************/
31 
32 typedef struct {
33 
34     uint16_t angle;
35     uint16_t zoom;
36     lv_point_t pivot;
37 
38     lv_color_t recolor;
39     lv_opa_t recolor_opa;
40 
41     lv_opa_t opa;
42     lv_blend_mode_t blend_mode : 4;
43 
44     int32_t frame_id;
45     uint8_t antialias       : 1;
46 } lv_draw_img_dsc_t;
47 
48 struct _lv_draw_ctx_t;
49 
50 /**********************
51  * GLOBAL PROTOTYPES
52  **********************/
53 
54 void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
55 /**
56  * Draw an image
57  * @param coords the coordinates of the image
58  * @param mask the image will be drawn only in this area
59  * @param src pointer to a lv_color_t array which contains the pixels of the image
60  * @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
61  */
62 void lv_draw_img(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, const lv_area_t * coords,
63                  const void * src);
64 
65 
66 void lv_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 /**
70  * Get the type of an image source
71  * @param src pointer to an image source:
72  *  - pointer to an 'lv_img_t' variable (image stored internally and compiled into the code)
73  *  - a path to a file (e.g. "S:/folder/image.bin")
74  *  - or a symbol (e.g. LV_SYMBOL_CLOSE)
75  * @return type of the image source LV_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN
76  */
77 lv_img_src_t lv_img_src_get_type(const void * src);
78 
79 /**
80  * Get the pixel size of a color format in bits
81  * @param cf a color format (`LV_IMG_CF_...`)
82  * @return the pixel size in bits
83  */
84 uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf);
85 
86 /**
87  * Check if a color format is chroma keyed or not
88  * @param cf a color format (`LV_IMG_CF_...`)
89  * @return true: chroma keyed; false: not chroma keyed
90  */
91 bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
92 
93 /**
94  * Check if a color format has alpha channel or not
95  * @param cf a color format (`LV_IMG_CF_...`)
96  * @return true: has alpha channel; false: doesn't have alpha channel
97  */
98 bool lv_img_cf_has_alpha(lv_img_cf_t cf);
99 
100 #ifdef __cplusplus
101 } /*extern "C"*/
102 #endif
103 
104 #endif /*LV_DRAW_IMG_H*/
105