lv_img.h
Defines
-
LV_IMG_DECLARE(var_name)
Use this macro to declare an image in a C file
Typedefs
-
typedef _lv_img_size_mode_t lv_img_size_mode_t
Enums
-
enum _lv_img_size_mode_t
Image size mode, when image size and object size is different
Values:
-
enumerator LV_IMG_SIZE_MODE_VIRTUAL
Zoom doesn't affect the coordinates of the object, however if zoomed in the image is drawn out of the its coordinates. The layout's won't change on zoom
-
enumerator LV_IMG_SIZE_MODE_REAL
If the object size is set to SIZE_CONTENT, then object size equals zoomed image size. It causes layout recalculation. If the object size is set explicitly, the image will be cropped when zoomed in.
-
enumerator LV_IMG_SIZE_MODE_VIRTUAL
Functions
-
lv_obj_t *lv_img_create(lv_obj_t *parent)
Create an image object
- Parameters:
parent -- pointer to an object, it will be the parent of the new image
- Returns:
pointer to the created image
-
void lv_img_set_src(lv_obj_t *obj, const void *src)
Set the image data to display on the object
- Parameters:
obj -- pointer to an image object
src -- 1) pointer to an lv_img_dsc_t descriptor (converted by LVGL's image converter) (e.g. &my_img) or 2) path to an image file (e.g. "S:/dir/img.bin")or 3) a SYMBOL (e.g. LV_SYMBOL_OK)
-
void lv_img_set_offset_x(lv_obj_t *obj, lv_coord_t x)
Set an offset for the source of an image so the image will be displayed from the new origin.
- Parameters:
obj -- pointer to an image
x -- the new offset along x axis.
-
void lv_img_set_offset_y(lv_obj_t *obj, lv_coord_t y)
Set an offset for the source of an image. so the image will be displayed from the new origin.
- Parameters:
obj -- pointer to an image
y -- the new offset along y axis.
-
void lv_img_set_angle(lv_obj_t *obj, int16_t angle)
Set the rotation angle of the image. The image will be rotated around the set pivot set by
lv_img_set_pivot()
Note that indexed and alpha only images can't be transformed.- Parameters:
obj -- pointer to an image object
angle -- rotation angle in degree with 0.1 degree resolution (0..3600: clock wise)
-
void lv_img_set_pivot(lv_obj_t *obj, lv_coord_t x, lv_coord_t y)
Set the rotation center of the image. The image will be rotated around this point.
- Parameters:
obj -- pointer to an image object
x -- rotation center x of the image
y -- rotation center y of the image
-
void lv_img_set_antialias(lv_obj_t *obj, bool antialias)
Enable/disable anti-aliasing for the transformations (rotate, zoom) or not. The quality is better with anti-aliasing looks better but slower.
- Parameters:
obj -- pointer to an image object
antialias -- true: anti-aliased; false: not anti-aliased
-
void lv_img_set_size_mode(lv_obj_t *obj, lv_img_size_mode_t mode)
Set the image object size mode.
- Parameters:
obj -- pointer to an image object
mode -- the new size mode.
-
const void *lv_img_get_src(lv_obj_t *obj)
Get the source of the image
- Parameters:
obj -- pointer to an image object
- Returns:
the image source (symbol, file name or ::lv-img_dsc_t for C arrays)
-
lv_coord_t lv_img_get_offset_x(lv_obj_t *obj)
Get the offset's x attribute of the image object.
- Parameters:
obj -- pointer to an image
- Returns:
offset X value.
-
lv_coord_t lv_img_get_offset_y(lv_obj_t *obj)
Get the offset's y attribute of the image object.
- Parameters:
obj -- pointer to an image
- Returns:
offset Y value.
-
lv_coord_t lv_img_get_angle(lv_obj_t *obj)
Get the rotation angle of the image.
- Parameters:
obj -- pointer to an image object
- Returns:
rotation angle in 0.1 degrees (0..3600)
-
void lv_img_get_pivot(lv_obj_t *obj, lv_point_t *pivot)
Get the pivot (rotation center) of the image.
- Parameters:
obj -- pointer to an image object
pivot -- store the rotation center here
-
lv_coord_t lv_img_get_zoom(lv_obj_t *obj)
Get the zoom factor of the image.
- Parameters:
obj -- pointer to an image object
- Returns:
zoom factor (256: no zoom)
-
bool lv_img_get_antialias(lv_obj_t *obj)
Get whether the transformations (rotate, zoom) are anti-aliased or not
- Parameters:
obj -- pointer to an image object
- Returns:
true: anti-aliased; false: not anti-aliased
-
lv_img_size_mode_t lv_img_get_size_mode(lv_obj_t *obj)
Get the size mode of the image
- Parameters:
obj -- pointer to an image object
- Returns:
element of lv_img_size_mode_t
Variables
-
const lv_obj_class_t lv_img_class
-
struct lv_img_t
- #include <lv_img.h>
Data of image
Public Members
-
const void *src
-
lv_point_t offset
-
lv_coord_t angle
-
lv_point_t pivot
-
lv_coord_t zoom
-
uint8_t src_type
-
uint8_t cf
-
uint8_t antialias
-
uint8_t obj_size_mode
-
const void *src