2021-04-27 12:29:25 +08:00
|
|
|
/**
|
|
|
|
* @file lv_draw_img.h
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_DRAW_IMG_H
|
|
|
|
#define LV_DRAW_IMG_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include "lv_img_decoder.h"
|
|
|
|
#include "lv_img_buf.h"
|
2022-10-21 10:17:49 +08:00
|
|
|
#include "../misc/lv_style.h"
|
2021-04-27 12:29:25 +08:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
2022-10-21 10:17:49 +08:00
|
|
|
typedef struct {
|
2021-04-27 12:29:25 +08:00
|
|
|
|
2022-10-21 10:17:49 +08:00
|
|
|
int16_t angle;
|
2021-04-27 12:29:25 +08:00
|
|
|
uint16_t zoom;
|
2022-10-21 10:17:49 +08:00
|
|
|
lv_point_t pivot;
|
2021-04-27 12:29:25 +08:00
|
|
|
|
|
|
|
lv_color_t recolor;
|
2022-10-21 10:17:49 +08:00
|
|
|
lv_opa_t recolor_opa;
|
2021-04-27 12:29:25 +08:00
|
|
|
|
2022-10-21 10:17:49 +08:00
|
|
|
lv_opa_t opa;
|
|
|
|
lv_blend_mode_t blend_mode : 4;
|
2021-04-27 12:29:25 +08:00
|
|
|
|
2022-10-21 10:17:49 +08:00
|
|
|
int32_t frame_id;
|
|
|
|
uint8_t antialias : 1;
|
2021-04-27 12:29:25 +08:00
|
|
|
} lv_draw_img_dsc_t;
|
|
|
|
|
2022-10-21 10:17:49 +08:00
|
|
|
struct _lv_draw_ctx_t;
|
|
|
|
|
2021-04-27 12:29:25 +08:00
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
2022-10-21 10:17:49 +08:00
|
|
|
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
|
2021-04-27 12:29:25 +08:00
|
|
|
/**
|
|
|
|
* Draw an image
|
|
|
|
* @param coords the coordinates of the image
|
|
|
|
* @param mask the image will be drawn only in this area
|
|
|
|
* @param src pointer to a lv_color_t array which contains the pixels of the image
|
|
|
|
* @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
|
|
|
|
*/
|
2022-10-21 10:17:49 +08:00
|
|
|
void lv_draw_img(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, const lv_area_t * coords,
|
|
|
|
const void * src);
|
|
|
|
|
|
|
|
|
|
|
|
void lv_draw_img_decoded(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
|
|
|
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format);
|
2021-04-27 12:29:25 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the type of an image source
|
|
|
|
* @param src pointer to an image source:
|
|
|
|
* - pointer to an 'lv_img_t' variable (image stored internally and compiled into the code)
|
|
|
|
* - a path to a file (e.g. "S:/folder/image.bin")
|
|
|
|
* - or a symbol (e.g. LV_SYMBOL_CLOSE)
|
|
|
|
* @return type of the image source LV_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN
|
|
|
|
*/
|
2022-10-21 10:17:49 +08:00
|
|
|
lv_img_src_t lv_img_src_get_type(const void * src);
|
2021-04-27 12:29:25 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the pixel size of a color format in bits
|
|
|
|
* @param cf a color format (`LV_IMG_CF_...`)
|
|
|
|
* @return the pixel size in bits
|
|
|
|
*/
|
|
|
|
uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a color format is chroma keyed or not
|
|
|
|
* @param cf a color format (`LV_IMG_CF_...`)
|
|
|
|
* @return true: chroma keyed; false: not chroma keyed
|
|
|
|
*/
|
|
|
|
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a color format has alpha channel or not
|
|
|
|
* @param cf a color format (`LV_IMG_CF_...`)
|
|
|
|
* @return true: has alpha channel; false: doesn't have alpha channel
|
|
|
|
*/
|
|
|
|
bool lv_img_cf_has_alpha(lv_img_cf_t cf);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2022-10-21 10:17:49 +08:00
|
|
|
} /*extern "C"*/
|
2021-04-27 12:29:25 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /*LV_DRAW_IMG_H*/
|