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 int16_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 void lv_draw_img_decoded(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, 66 const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format); 67 68 /** 69 * Get the type of an image source 70 * @param src pointer to an image source: 71 * - pointer to an 'lv_img_t' variable (image stored internally and compiled into the code) 72 * - a path to a file (e.g. "S:/folder/image.bin") 73 * - or a symbol (e.g. LV_SYMBOL_CLOSE) 74 * @return type of the image source LV_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN 75 */ 76 lv_img_src_t lv_img_src_get_type(const void * src); 77 78 /** 79 * Get the pixel size of a color format in bits 80 * @param cf a color format (`LV_IMG_CF_...`) 81 * @return the pixel size in bits 82 */ 83 uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf); 84 85 /** 86 * Check if a color format is chroma keyed or not 87 * @param cf a color format (`LV_IMG_CF_...`) 88 * @return true: chroma keyed; false: not chroma keyed 89 */ 90 bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf); 91 92 /** 93 * Check if a color format has alpha channel or not 94 * @param cf a color format (`LV_IMG_CF_...`) 95 * @return true: has alpha channel; false: doesn't have alpha channel 96 */ 97 bool lv_img_cf_has_alpha(lv_img_cf_t cf); 98 99 #ifdef __cplusplus 100 } /*extern "C"*/ 101 #endif 102 103 #endif /*LV_DRAW_IMG_H*/ 104