lv_image_buf.h

Defines

_LV_ZOOM_INV_UPSCALE
LV_IMAGE_HEADER_MAGIC

Magic number for lvgl image, 9 means lvgl version 9 It must not be a valid ASCII character nor larger than 0x80. See lv_image_src_get_type.

Typedefs

typedef enum _lv_image_flags_t lv_image_flags_t

Enums

enum _lv_image_flags_t

Values:

enumerator LV_IMAGE_FLAGS_PREMULTIPLIED

For RGB map of the image data, mark if it's pre-multiplied with alpha. For indexed image, this bit indicated palette data is pre-multiplied with alpha.

enumerator LV_IMAGE_FLAGS_MODIFIABLE

If the image data is malloced and can be processed in place. In image decoder post processing, this flag means we modify it in-place.

enumerator LV_IMAGE_FLAGS_VECTORS

Indicating it's a vector image instead of default raster image. Some of the flags are not usable for vector image, like PREMULTIPLIED.

enumerator LV_IMAGE_FLAGS_COMPRESSED

The image data is compressed, so decoder needs to decode image firstly. If this flag is set, the whole image will be decompressed upon decode, and get_area_cb won't be necessary.

enumerator LV_IMAGE_FLAGS_ALLOCATED

The image is allocated from heap, thus should be freed after use.

enumerator LV_IMAGE_FLAGS_USER1

Flags reserved for user, lvgl won't use these bits.

enumerator LV_IMAGE_FLAGS_USER2
enumerator LV_IMAGE_FLAGS_USER3
enumerator LV_IMAGE_FLAGS_USER4
enumerator LV_IMAGE_FLAGS_USER5
enumerator LV_IMAGE_FLAGS_USER6
enumerator LV_IMAGE_FLAGS_USER7
enumerator LV_IMAGE_FLAGS_USER8
enum lv_image_compress_t

Values:

enumerator LV_IMAGE_COMPRESS_NONE
enumerator LV_IMAGE_COMPRESS_RLE
enumerator LV_IMAGE_COMPRESS_LZ4

Functions

void lv_image_buf_set_palette(lv_image_dsc_t *dsc, uint8_t id, lv_color32_t c)

Set the palette color of an indexed image. Valid only for LV_COLOR_FORMAT_I1/2/4/8

Parameters:
  • dsc -- pointer to an image descriptor

  • id -- the palette color to set:

    • for LV_COLOR_FORMAT_I1: 0..1

    • for LV_COLOR_FORMAT_I2: 0..3

    • for LV_COLOR_FORMAT_I4: 0..15

    • for LV_COLOR_FORMAT_I8: 0..255

  • c -- the color to set in lv_color32_t format

void lv_image_buf_free(lv_image_dsc_t *dsc)

Free an allocated image buffer

Parameters:

dsc -- image buffer to free

void _lv_image_buf_get_transformed_area(lv_area_t *res, int32_t w, int32_t h, int32_t angle, uint16_t scale_x, uint16_t scale_y, const lv_point_t *pivot)

Get the area of a rectangle if its rotated and scaled

Parameters:
  • res -- store the coordinates here

  • w -- width of the rectangle to transform

  • h -- height of the rectangle to transform

  • angle -- angle of rotation

  • scale_x -- zoom in x direction, (256 no zoom)

  • scale_y -- zoom in y direction, (256 no zoom)

  • pivot -- x,y pivot coordinates of rotation

static inline void lv_image_header_init(lv_image_header_t *header, uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride, lv_image_flags_t flags)
struct lv_image_header_t

Public Members

uint32_t magic
uint32_t cf
uint32_t flags
uint32_t w
uint32_t h
uint32_t stride
uint32_t reserved_2
struct lv_yuv_plane_t

Public Members

void *buf
uint32_t stride
union lv_yuv_buf_t

Public Members

lv_yuv_plane_t yuv
lv_yuv_plane_t y
lv_yuv_plane_t u
lv_yuv_plane_t v
struct lv_yuv_buf_t::[anonymous] planar
lv_yuv_plane_t uv
struct lv_yuv_buf_t::[anonymous] semi_planar
struct lv_image_dsc_t
#include <lv_image_buf.h>

Struct to describe an image. Both decoded and raw image can share the same struct.

Image is also identical to lv_draw_buf_t for now. Ideally, decoded image should be lv_draw_buf_t.

Public Members

lv_image_header_t header

A header describing the basics of the image

uint32_t data_size

Size of the image in bytes

const uint8_t *data

Pointer to the data of the image