lv_image.h
API reference for lv_image.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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
src | const 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image |
x | int32_t | the 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image |
y | int32_t | the 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
angle | int32_t | rotation 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
x | int32_t | rotation center x of the image |
y | int32_t | rotation 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
x | int32_t | rotation 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
y | int32_t | rotation 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
zoom | uint32_t | the 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
zoom | uint32_t | the 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
zoom | uint32_t | the 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
blend_mode | lv_blend_mode_t | the 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
antialias | bool | true: 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
align | lv_image_align_t | the 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)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to an image object |
src | const 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
| Name | Value | Description |
|---|---|---|
LV_IMAGE_ALIGN_DEFAULT | 0 | |
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_TRANSFORM | Marks the start of modes that transform the image | |
LV_IMAGE_ALIGN_STRETCH | Set X and Y scale to fill the Widget's area. | |
LV_IMAGE_ALIGN_TILE | Tile image to fill Widget's area. Offset is applied to shift the tiling. | |
LV_IMAGE_ALIGN_CONTAIN | The image keeps its aspect ratio, but is resized to the maximum size that fits within the Widget's area. | |
LV_IMAGE_ALIGN_COVER | The image keeps its aspect ratio and fills the Widget's area. |
Used by 1 function
lv_image_set_inner_align— paramalign
_lv_property_image_id_t
| Name | Value |
|---|---|
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_nameUse this macro to declare an image in a C file
Variables
lv_image_class
const lv_obj_class_t lv_image_classDependencies
Indirect dependencies
lv_anim.hlv_area.hlv_array.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.hlv_conf_kconfig.hlv_display.hlv_draw_arc.hlv_draw_blur.hlv_draw_buf.hlv_draw_image.hlv_draw_label.hlv_draw_line.hlv_draw_rect.hlv_draw_triangle.hlv_event.hlv_ext_data.hlv_flex.hlv_font.hlv_grad.hlv_grid.hlv_group.hlv_image_decoder.hlv_image_dsc.hlv_indev.hlv_layout.hlv_ll.hlv_log.hlv_math.hlv_matrix.hlv_mem.hlv_obj_class.hlv_obj_draw.hlv_obj_event.hlv_obj_pos.hlv_obj_property.hlv_obj_property_names.hlv_obj_scroll.hlv_obj_style.hlv_obj_style_gen.hlv_obj_tree.hlv_palette.hlv_profiler.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style.hlv_style_gen.hlv_style_properties.hlv_symbol_def.hlv_text.hlv_tick.hlv_timer.hlv_types.h
How is this guide?
Last updated on