lv_image.h

API reference for lv_image.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_image_private.h

Functions

lv_image_set_src

Set the image data to display on the object

 
void lv_image_set_src(lv_obj_t *obj, const void *src)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
srcconst void *1) pointer to an lv_image_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)

lv_image_set_offset_x

Set an offset for the source of an image so the image will be displayed from the new origin.

 
void lv_image_set_offset_x(lv_obj_t *obj, int32_t x)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image
xint32_tthe new offset along x axis.

lv_image_set_offset_y

Set an offset for the source of an image. so the image will be displayed from the new origin.

 
void lv_image_set_offset_y(lv_obj_t *obj, int32_t y)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image
yint32_tthe new offset along y axis.

lv_image_set_rotation

Set the rotation angle of the image. The image will be rotated around the set pivot set by lv_image_set_pivot() Note that indexed and alpha only images can't be transformed.

 
void lv_image_set_rotation(lv_obj_t *obj, int32_t angle)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
angleint32_trotation in degree with 0.1 degree resolution (0..3600: clock wise)

if image_align is LV_IMAGE_ALIGN_STRETCH or LV_IMAGE_ALIGN_FIT rotation will be set to 0 automatically.

lv_image_set_pivot

Set the rotation center of the image. The image will be rotated around this point. x, y can be set with value of LV_PCT, lv_image_get_pivot will return the true pixel coordinate of pivot in this case.

 
void lv_image_set_pivot(lv_obj_t *obj, int32_t x, int32_t y)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
xint32_trotation center x of the image
yint32_trotation center y of the image

lv_image_set_pivot_x

Set the rotation horizontal center of the image.

 
void lv_image_set_pivot_x(lv_obj_t *obj, int32_t x)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
xint32_trotation center x of the image, or lv_pct()

lv_image_set_pivot_y

Set the rotation vertical center of the image.

 
void lv_image_set_pivot_y(lv_obj_t *obj, int32_t y)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
yint32_trotation center y of the image, or lv_pct()

lv_image_set_scale

Set the zoom factor of the image. Note that indexed and alpha only images can't be transformed.

 
void lv_image_set_scale(lv_obj_t *obj, uint32_t zoom)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
zoomuint32_tthe zoom factor. Example values:
- 256 or LV_SCALE_NONE: no zoom
- <256: scale down
- >256: scale up
- 128: half size
- 512: double size

lv_image_set_scale_x

Set the horizontal zoom factor of the image. Note that indexed and alpha only images can't be transformed.

 
void lv_image_set_scale_x(lv_obj_t *obj, uint32_t zoom)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
zoomuint32_tthe zoom factor. Example values:
- 256 or LV_SCALE_NONE: no zoom
- <256: scale down
- >256: scale up
- 128: half size
- 512: double size

lv_image_set_scale_y

Set the vertical zoom factor of the image. Note that indexed and alpha only images can't be transformed.

 
void lv_image_set_scale_y(lv_obj_t *obj, uint32_t zoom)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
zoomuint32_tthe zoom factor. Example values:
- 256 or LV_SCALE_NONE: no zoom
- <256: scale down
- >256: scale up
- 128: half size
- 512: double size

lv_image_set_blend_mode

Set the blend mode of an image.

 
void lv_image_set_blend_mode(lv_obj_t *obj, lv_blend_mode_t blend_mode)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
blend_modelv_blend_mode_tthe new blend mode

lv_image_set_antialias

Enable/disable anti-aliasing for the transformations (rotate, zoom) or not. The quality is better with anti-aliasing looks better but slower.

 
void lv_image_set_antialias(lv_obj_t *obj, bool antialias)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
antialiasbooltrue: anti-aliased; false: not anti-aliased

lv_image_set_inner_align

Set the image object size mode.

 
void lv_image_set_inner_align(lv_obj_t *obj, lv_image_align_t align)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
alignlv_image_align_tthe new align mode.

if image_align is LV_IMAGE_ALIGN_STRETCH or LV_IMAGE_ALIGN_FIT rotation, scale and pivot will be overwritten and controlled internally.

lv_image_set_bitmap_map_src

Set an A8 bitmap mask for the image.

 
void lv_image_set_bitmap_map_src(lv_obj_t *obj, const lv_image_dsc_t *src)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an image object
srcconst lv_image_dsc_t *an lv_image_dsc_t bitmap mask source.

Enums

lv_image_align_t

Image size mode, when image size and object size is different

NameValueDescription
LV_IMAGE_ALIGN_DEFAULT0
LV_IMAGE_ALIGN_TOP_LEFT
LV_IMAGE_ALIGN_TOP_MID
LV_IMAGE_ALIGN_TOP_RIGHT
LV_IMAGE_ALIGN_BOTTOM_LEFT
LV_IMAGE_ALIGN_BOTTOM_MID
LV_IMAGE_ALIGN_BOTTOM_RIGHT
LV_IMAGE_ALIGN_LEFT_MID
LV_IMAGE_ALIGN_RIGHT_MID
LV_IMAGE_ALIGN_CENTER
_LV_IMAGE_ALIGN_AUTO_TRANSFORMMarks the start of modes that transform the image
LV_IMAGE_ALIGN_STRETCHSet X and Y scale to fill the Widget's area.
LV_IMAGE_ALIGN_TILETile image to fill Widget's area. Offset is applied to shift the tiling.
LV_IMAGE_ALIGN_CONTAINThe image keeps its aspect ratio, but is resized to the maximum size that fits within the Widget's area.
LV_IMAGE_ALIGN_COVERThe image keeps its aspect ratio and fills the Widget's area.
Used by 1 function
  • lv_image_set_inner_align — param align

_lv_property_image_id_t

NameValue
LV_PROPERTY_IMAGE_SRC(LV_PROPERTY_IMAGE_START + ((int) 0 )) | (( 6 ) << 28 )
LV_PROPERTY_IMAGE_OFFSET_X(LV_PROPERTY_IMAGE_START + ((int) 1 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_OFFSET_Y(LV_PROPERTY_IMAGE_START + ((int) 2 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_ROTATION(LV_PROPERTY_IMAGE_START + ((int) 3 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_PIVOT(LV_PROPERTY_IMAGE_START + ((int) 4 )) | (( 4 ) << 28 )
LV_PROPERTY_IMAGE_SCALE(LV_PROPERTY_IMAGE_START + ((int) 5 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_SCALE_X(LV_PROPERTY_IMAGE_START + ((int) 6 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_SCALE_Y(LV_PROPERTY_IMAGE_START + ((int) 7 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_BLEND_MODE(LV_PROPERTY_IMAGE_START + ((int) 8 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_ANTIALIAS(LV_PROPERTY_IMAGE_START + ((int) 9 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_INNER_ALIGN(LV_PROPERTY_IMAGE_START + ((int) 10 )) | (( 1 ) << 28 )
LV_PROPERTY_IMAGE_END

Macros

LV_IMAGE_DECLARE

 
#define LV_IMAGE_DECLARE(var_name) \
    extern const lv_image_dsc_t var_name

Use this macro to declare an image in a C file

Variables

lv_image_class

 
const lv_obj_class_t lv_image_class

Dependencies

How is this guide?

Last updated on

On this page