mikroSDK Reference Manual
lv_img.h
Go to the documentation of this file.
1
6#ifndef LV_IMG_H
7#define LV_IMG_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
16#include "../lv_conf_internal.h"
17
18#if LV_USE_IMG != 0
19
20/*Testing of dependencies*/
21#if LV_USE_LABEL == 0
22#error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)"
23#endif
24
25#include "../core/lv_obj.h"
26#include "../misc/lv_fs.h"
27#include "../draw/lv_draw.h"
28
29/*********************
30 * DEFINES
31 *********************/
32
33/**********************
34 * TYPEDEFS
35 **********************/
36
40typedef struct {
41 lv_obj_t obj;
42 const void * src; /*Image source: Pointer to an array or a file or a symbol*/
43 lv_point_t offset;
44 lv_coord_t w; /*Width of the image (Handled by the library)*/
45 lv_coord_t h; /*Height of the image (Handled by the library)*/
46 uint16_t angle; /*rotation angle of the image*/
47 lv_point_t pivot; /*rotation center of the image*/
48 uint16_t zoom; /*256 means no zoom, 512 double size, 128 half size*/
49 uint8_t src_type : 2; /*See: lv_img_src_t*/
50 uint8_t cf : 5; /*Color format from `lv_img_color_format_t`*/
51 uint8_t antialias : 1; /*Apply anti-aliasing in transformations (rotate, zoom)*/
52 uint8_t obj_size_mode: 2; /*Image size mode when image size and object size is different.*/
53} lv_img_t;
54
55extern const lv_obj_class_t lv_img_class;
56
60enum {
64 LV_IMG_SIZE_MODE_VIRTUAL = 0,
65
69 LV_IMG_SIZE_MODE_REAL,
70};
71
72typedef uint8_t lv_img_size_mode_t;
73
74/**********************
75 * GLOBAL PROTOTYPES
76 **********************/
77
83lv_obj_t * lv_img_create(lv_obj_t * parent);
84
85/*=====================
86 * Setter functions
87 *====================*/
88
96void lv_img_set_src(lv_obj_t * obj, const void * src);
97
103void lv_img_set_offset_x(lv_obj_t * obj, lv_coord_t x);
104
111void lv_img_set_offset_y(lv_obj_t * obj, lv_coord_t y);
112
113
121void lv_img_set_angle(lv_obj_t * obj, int16_t angle);
122
130void lv_img_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
131
132
144void lv_img_set_zoom(lv_obj_t * obj, uint16_t zoom);
145
152void lv_img_set_antialias(lv_obj_t * obj, bool antialias);
153
160void lv_img_set_size_mode(lv_obj_t * obj, lv_img_size_mode_t mode);
161/*=====================
162 * Getter functions
163 *====================*/
164
170const void * lv_img_get_src(lv_obj_t * obj);
171
177lv_coord_t lv_img_get_offset_x(lv_obj_t * obj);
178
184lv_coord_t lv_img_get_offset_y(lv_obj_t * obj);
185
191uint16_t lv_img_get_angle(lv_obj_t * obj);
192
198void lv_img_get_pivot(lv_obj_t * obj, lv_point_t * pivot);
199
205uint16_t lv_img_get_zoom(lv_obj_t * obj);
206
212bool lv_img_get_antialias(lv_obj_t * obj);
213
219lv_img_size_mode_t lv_img_get_size_mode(lv_obj_t * obj);
220
221/**********************
222 * MACROS
223 **********************/
224
226#define LV_IMG_DECLARE(var_name) extern const lv_img_dsc_t var_name;
227
228#endif /*LV_USE_IMG*/
229
230#ifdef __cplusplus
231} /*extern "C"*/
232#endif
233
234#endif /*LV_IMG_H*/
Definition lv_obj_class.h:49
Definition lv_obj.h:174
Definition lv_area.h:37