lv_snapshot.h

API reference for lv_snapshot.h

Report on GitHub
Summary

Functions

lv_snapshot_take

Take snapshot for object with its children, create the draw buffer as needed.

 
lv_draw_buf_t * lv_snapshot_take(lv_obj_t *obj, lv_color_format_t cf)
Parameters
NameTypeDescription
objlv_obj_t *the object to generate snapshot.
cflv_color_format_tcolor format for generated image.

Returns: lv_draw_buf_t * — a pointer to an draw buffer containing snapshot image, or NULL if failed.

lv_snapshot_create_draw_buf

Create a draw buffer to store the snapshot image for object.

 
lv_draw_buf_t * lv_snapshot_create_draw_buf(lv_obj_t *obj, lv_color_format_t cf)
Parameters
NameTypeDescription
objlv_obj_t *the object to generate snapshot.
cflv_color_format_tcolor format for generated image.

Returns: lv_draw_buf_t * — a pointer to an draw buffer ready for taking snapshot, or NULL if failed.

lv_snapshot_reshape_draw_buf

Reshape the draw buffer to prepare for taking snapshot for obj. This is usually used to check if the existing draw buffer is enough for obj snapshot. If return LV_RESULT_INVALID, you should create a new one.

 
lv_result_t lv_snapshot_reshape_draw_buf(lv_obj_t *obj, lv_draw_buf_t *draw_buf)
Parameters
NameTypeDescription
objlv_obj_t *the object to generate snapshot.
draw_buflv_draw_buf_t *the draw buffer to reshape.

lv_snapshot_take_to_draw_buf

Take snapshot for object with its children, save image info to provided buffer.

 
lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t *obj, lv_color_format_t cf, lv_draw_buf_t *draw_buf)
Parameters
NameTypeDescription
objlv_obj_t *the object to generate snapshot.
cflv_color_format_tcolor format for new snapshot image. It could differ with cf of draw_buf as long as the new cf will fit in.
draw_buflv_draw_buf_t *the draw buffer to store the image result. It's reshaped automatically.

Returns: lv_result_t — LV_RESULT_OK on success, LV_RESULT_INVALID on error.

lv_snapshot_free

> Deprecated: Use lv_draw_buf_destroy instead.

Free the snapshot image returned by lv_snapshot_take

 
void lv_snapshot_free(lv_image_dsc_t *dsc)
Parameters
NameTypeDescription
dsclv_image_dsc_t *the image descriptor generated by lv_snapshot_take.

lv_snapshot_take_to_buf

Take snapshot for object with its children, save image info to provided buffer.

> Deprecated: Use lv_snapshot_take_to_draw_buf instead.

 
lv_result_t lv_snapshot_take_to_buf(lv_obj_t *obj, lv_color_format_t cf, lv_image_dsc_t *dsc, void *buf, uint32_t buf_size)
Parameters
NameTypeDescription
objlv_obj_t *the object to generate snapshot.
cflv_color_format_tcolor format for generated image.
dsclv_image_dsc_t *image descriptor to store the image result.
bufvoid *the buffer to store image data. It must meet align requirement.
buf_sizeuint32_tprovided buffer size in bytes.

Returns: lv_result_t — LV_RESULT_OK on success, LV_RESULT_INVALID on error.

Dependencies

How is this guide?

Last updated on

On this page