lv_draw.h

Typedefs

typedef struct _lv_draw_layer_ctx_t lv_draw_layer_ctx_t
typedef struct _lv_draw_ctx_t lv_draw_ctx_t

Functions

void lv_draw_init(void)
void lv_draw_wait_for_finish(lv_draw_ctx_t *draw_ctx)
struct lv_draw_mask_t

Public Members

void *user_data
struct _lv_draw_layer_ctx_t

Public Members

lv_area_t area_full
lv_area_t area_act
lv_coord_t max_row_with_alpha
lv_coord_t max_row_with_no_alpha
void *buf
const lv_area_t *clip_area
lv_area_t *buf_area
lv_color_format_t color_format
struct _lv_draw_layer_ctx_t::[anonymous] original
struct _lv_draw_ctx_t

Public Members

void *buf

Pointer to a buffer to draw into

lv_area_t *buf_area

The position and size of buf (absolute coordinates)

const lv_area_t *clip_area

The current clip area with absolute coordinates, always the same or smaller than buf_area

lv_area_t clip_area_original

The original area which is updated

lv_color_format_t color_format

The rendered image in draw_ctx->buf will be converted to this format using draw_ctx->buffer_convert.

void (*init_buf)(struct _lv_draw_ctx_t *draw_ctx)
void (*draw_rect)(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *dsc, const lv_area_t *coords)
void (*draw_arc)(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_arc_dsc_t *dsc, const lv_point_t *center, uint16_t radius, uint16_t start_angle, uint16_t end_angle)
void (*draw_img_decoded)(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc_t *dsc, const lv_area_t *coords, const uint8_t *map_p, const lv_draw_img_sup_t *sup, lv_color_format_t color_format)
lv_res_t (*draw_img)(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc_t *draw_dsc, const lv_area_t *coords, const void *src)
void (*draw_letter)(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_label_dsc_t *dsc, const lv_point_t *pos_p, uint32_t letter)
void (*draw_line)(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_line_dsc_t *dsc, const lv_point_t *point1, const lv_point_t *point2)
void (*draw_polygon)(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *draw_dsc, const lv_point_t points[], uint16_t point_cnt)
void (*draw_transform)(struct _lv_draw_ctx_t *draw_ctx, const lv_area_t *dest_area, const void *src_buf, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, const lv_draw_img_dsc_t *draw_dsc, const lv_draw_img_sup_t *sup, lv_color_format_t cf, lv_color_t *cbuf, lv_opa_t *abuf)

Get an area of a transformed image (zoomed and/or rotated)

Param draw_ctx:

pointer to a draw context

Param dest_area:

get this area of the result image. It assumes that the original image is placed to the 0;0 position.

Param src_buf:

the source image

Param src_w:

width of the source image in [px]

Param src_h:

height of the source image in [px]

Param src_stride:

the stride in [px].

Param draw_dsc:

an lv_draw_img_dsc_t descriptor containing the transformation parameters

Param cf:

the color format of src_buf

Param cbuf:

place the colors of the pixels on dest_area here in RGB format

Param abuf:

place the opacity of the pixels on dest_area here

void (*wait_for_finish)(struct _lv_draw_ctx_t *draw_ctx)

Wait until all background operations are finished. (E.g. GPU operations)

void (*buffer_copy)(struct _lv_draw_ctx_t *draw_ctx, void *dest_buf, lv_coord_t dest_stride, const lv_area_t *dest_area, void *src_buf, lv_coord_t src_stride, const lv_area_t *src_area)

Copy an area from buffer to an other

Note

dest_area and src_area must have the same width and height but can have different x and y position.

Note

dest_area and src_area must be clipped to the real dimensions of the buffers

Param draw_ctx:

pointer to a draw context

Param dest_buf:

copy the buffer into this buffer

Param dest_stride:

the width of the dest_buf in pixels

Param dest_area:

the destination area

Param src_buf:

copy from this buffer

Param src_stride:

the width of src_buf in pixels

Param src_area:

the source area.

void (*buffer_convert)(struct _lv_draw_ctx_t *draw_ctx)

Convert the content of draw_ctx->buf to draw_ctx->color_format

Param draw_ctx:

void (*buffer_clear)(struct _lv_draw_ctx_t *draw_ctx)
struct _lv_draw_layer_ctx_t *(*layer_init)(struct _lv_draw_ctx_t *draw_ctx, struct _lv_draw_layer_ctx_t *layer_ctx, lv_draw_layer_flags_t flags)

Initialize a new layer context. The original buffer and area data are already saved from draw_ctx to layer_ctx

Param draw_ctx:

pointer to the current draw context

Param layer_area:

the coordinates of the layer

Param flags:

OR-ed flags from @lv_draw_layer_flags_t

Return:

pointer to the layer context, or NULL on error

void (*layer_adjust)(struct _lv_draw_ctx_t *draw_ctx, struct _lv_draw_layer_ctx_t *layer_ctx, lv_draw_layer_flags_t flags)

Adjust the layer_ctx and/or draw_ctx based on the layer_ctx->area_act. It's called only if flags has LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE

Param draw_ctx:

pointer to the current draw context

Param layer_ctx:

pointer to a layer context

Param flags:

OR-ed flags from @lv_draw_layer_flags_t

void (*layer_blend)(struct _lv_draw_ctx_t *draw_ctx, struct _lv_draw_layer_ctx_t *layer_ctx, const lv_draw_img_dsc_t *draw_dsc)

Blend a rendered layer to layer_ctx->area_act

Param draw_ctx:

pointer to the current draw context

Param layer_ctx:

pointer to a layer context

Param draw_dsc:

pointer to an image draw descriptor

void (*layer_destroy)(struct _lv_draw_ctx_t *draw_ctx, lv_draw_layer_ctx_t *layer_ctx)

Destroy a layer context. The original buffer and area data of the draw_ctx will be restored and the layer_ctx itself will be freed automatically.

Param draw_ctx:

pointer to the current draw context

Param layer_ctx:

pointer to a layer context

size_t layer_instance_size

Size of a layer context in bytes.

void *user_data