1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/lv_objx/lv_img.h

88 lines
2.1 KiB
C
Raw Normal View History

2016-06-08 07:25:08 +02:00
/**
* @file lv_img.h
*
*/
#ifndef LV_IMG_H
#define LV_IMG_H
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
2017-01-02 10:48:21 +01:00
#include "misc_conf.h"
#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0
2016-06-08 07:25:08 +02:00
#include "../lv_obj/lv_obj.h"
#include "misc/fs/fsint.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
2016-10-07 11:15:46 +02:00
/*Style of template*/
2016-06-08 07:25:08 +02:00
typedef struct
{
2016-10-07 11:15:46 +02:00
lv_objs_t objs; /*Style of ancestor*/
/*New style element for this type */
opa_t recolor_opa;
2016-06-08 07:25:08 +02:00
}lv_imgs_t;
2016-10-07 11:15:46 +02:00
/*Built-in styles of template*/
typedef enum
{
LV_IMGS_DEF,
LV_IMGS_LIGHT,
LV_IMGS_DARK,
}lv_imgs_builtin_t;
/*Data of template*/
2016-06-08 07:25:08 +02:00
typedef struct
{
2016-10-07 11:15:46 +02:00
/*No ext. because inherited from the base object*/ /*Ext. of ancestor*/
/*New data for this type */
2016-12-15 10:31:30 +01:00
char* fn; /*Image file name. E.g. "U:/my_image"*/
cord_t w; /*Width of the image (if LV_UPSCALE_MAP != 0 then multiplied by LV_DOWNSCALE)*/
cord_t h; /*Height of the image (if LV_UPSCALE_MAP != 0 then multiplied by LV_DOWNSCALE)*/
uint8_t auto_size :1; /*1: automatically set the object size to the image size*/
2016-06-16 10:57:03 +02:00
uint8_t transp :1; /*Transp. bit in the images header (library handles this)*/
2016-06-08 07:25:08 +02:00
}lv_img_ext_t;
2016-10-07 11:15:46 +02:00
/*Image header*/
2016-06-08 07:25:08 +02:00
typedef struct
{
2016-12-15 10:31:30 +01:00
uint16_t w; /*Width of the image map*/
uint16_t h; /*Height of the image map*/
uint16_t cd; /*Color depth (8/16 or 24)*/
uint16_t transp :1; /*1: Do not draw LV_IMG_TRANSP_COLOR pixels*/
2016-06-08 07:25:08 +02:00
}lv_img_raw_header_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*Create function*/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy);
2016-06-08 07:25:08 +02:00
2016-10-07 11:15:46 +02:00
bool lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param);
void lv_img_set_file(lv_obj_t * img, const char * fn);
2016-06-08 07:25:08 +02:00
fs_res_t lv_img_create_file(const char * fn, const color_int_t * data_p);
2016-10-07 11:15:46 +02:00
void lv_img_set_auto_size(lv_obj_t * img, bool autotosize);
2016-06-08 07:25:08 +02:00
2016-10-07 11:15:46 +02:00
bool lv_img_get_auto_size(lv_obj_t * img);
2016-06-08 07:25:08 +02:00
2016-10-07 11:15:46 +02:00
lv_imgs_t * lv_imgs_get(lv_imgs_builtin_t style, lv_imgs_t * copy);
2016-06-08 07:25:08 +02:00
/**********************
* MACROS
**********************/
2016-10-07 11:15:46 +02:00
#define LV_IMG_DECLARE(var_name) extern const color_int_t var_name[];
2016-06-08 07:25:08 +02:00
#endif
#endif