/**1* @file lv_img.h2*3*/45#ifndef LV_IMG_H6#define LV_IMG_H78#ifdef __cplusplus9extern "C" {10#endif1112/*********************13* INCLUDES14*********************/15#ifdef LV_CONF_INCLUDE_SIMPLE16#include "lv_conf.h"17#else18#include "../../lv_conf.h"19#endif2021#if USE_LV_IMG != 02223#include "../lv_core/lv_obj.h"24#include "../lv_misc/lv_fs.h"25#include "../lv_misc/lv_symbol_def.h"26#include "lv_label.h"27#include "../lv_draw/lv_draw.h"2829/*********************30* DEFINES31*********************/3233/**********************34* TYPEDEFS35**********************/36/*Data of image*/37typedef struct38{39/*No inherited ext. because inherited from the base object*/ /*Ext. of ancestor*/40/*New data for this type */41const void * src; /*Image source: Pointer to an array or a file or a symbol*/4243lv_coord_t w; /*Width of the image (Handled by the library)*/44lv_coord_t h; /*Height of the image (Handled by the library)*/45#if USE_LV_MULTI_LANG46uint16_t lang_txt_id; /*The ID of the image to display. */47#endif48uint8_t src_type :2; /*See: lv_img_src_t*/49uint8_t auto_size :1; /*1: automatically set the object size to the image size*/50uint8_t cf :5; /*Color format from `lv_img_color_format_t`*/51} lv_img_ext_t;5253/**********************54* GLOBAL PROTOTYPES55**********************/5657/**58* Create an image objects59* @param par pointer to an object, it will be the parent of the new button60* @param copy pointer to a image object, if not NULL then the new object will be copied from it61* @return pointer to the created image62*/63lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy);6465/*=====================66* Setter functions67*====================*/6869/**70* Set the pixel map to display by the image71* @param img pointer to an image object72* @param data the image data73*/74void lv_img_set_src(lv_obj_t * img, const void * src_img);7576#if USE_LV_MULTI_LANG77/**78* Set an ID which means a the same source but on different languages79* @param img pointer to an image object80* @param src_id ID of the source81*/82void lv_img_set_src_id(lv_obj_t * img, uint32_t txt_id);83#endif8485/**86* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0.87* Use 'lv_img_set_src()' instead.88* @param img -89* @param fn -90*/91static inline void lv_img_set_file(lv_obj_t * img, const char * fn)92{93(void) img;94(void) fn;95}9697/**98* Enable the auto size feature.99* If enabled the object size will be same as the picture size.100* @param img pointer to an image101* @param en true: auto size enable, false: auto size disable102*/103void lv_img_set_auto_size(lv_obj_t * img, bool autosize_en);104105/**106* Set the style of an image107* @param img pointer to an image object108* @param style pointer to a style109*/110static inline void lv_img_set_style(lv_obj_t *img, lv_style_t *style)111{112lv_obj_set_style(img, style);113}114115/**116* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0117* @param img -118* @param upscale -119*/120static inline void lv_img_set_upscale(lv_obj_t * img, bool upcale)121{122(void) img;123(void) upcale;124}125126/*=====================127* Getter functions128*====================*/129130/**131* Get the source of the image132* @param img pointer to an image object133* @return the image source (symbol, file name or C array)134*/135const void * lv_img_get_src(lv_obj_t * img);136137/**138* Get the name of the file set for an image139* @param img pointer to an image140* @return file name141*/142const char * lv_img_get_file_name(const lv_obj_t * img);143144#if USE_LV_MULTI_LANG145/**146* Get the source ID of the image. (Used by the multi-language feature)147* @param img pointer to an image148* @return ID of the source149*/150uint16_t lv_img_get_src_id(lv_obj_t * img);151#endif152153/**154* Get the auto size enable attribute155* @param img pointer to an image156* @return true: auto size is enabled, false: auto size is disabled157*/158bool lv_img_get_auto_size(const lv_obj_t * img);159160/**161* Get the style of an image object162* @param img pointer to an image object163* @return pointer to the image's style164*/165static inline lv_style_t* lv_img_get_style(const lv_obj_t *img)166{167return lv_obj_get_style(img);168}169170/**171* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0172* @param img -173* @return false174*/175static inline bool lv_img_get_upscale(const lv_obj_t * img)176{177(void)img;178return false;179}180181/**********************182* MACROS183**********************/184185/*Use this macro to declare an image in a c file*/186#define LV_IMG_DECLARE(var_name) extern const lv_img_dsc_t var_name;187188#endif /*USE_LV_IMG*/189190#ifdef __cplusplus191} /* extern "C" */192#endif193194#endif /*LV_IMG_H*/195196197