lv_snapshot.h

Functions

lv_draw_buf_t *lv_snapshot_take(lv_obj_t *obj, lv_color_format_t cf)

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

Parameters:
  • obj -- the object to generate snapshot.

  • cf -- color format for generated image.

Returns:

a pointer to an draw buffer containing snapshot image, or NULL if failed.

lv_draw_buf_t *lv_snapshot_create_draw_buf(lv_obj_t *obj, lv_color_format_t cf)

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

Parameters:
  • obj -- the object to generate snapshot.

  • cf -- color format for generated image.

Returns:

a pointer to an draw buffer ready for taking snapshot, or NULL if failed.

lv_result_t lv_snapshot_reshape_draw_buf(lv_obj_t *obj, lv_draw_buf_t *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.

Parameters:
  • draw_buf -- the draw buffer to reshape.

  • obj -- the object to generate snapshot.

lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t *obj, lv_color_format_t cf, lv_draw_buf_t *draw_buf)

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

Parameters:
  • obj -- the object to generate snapshot.

  • cf -- color format for new snapshot image. It could differ with cf of draw_buf as long as the new cf will fit in.

  • draw_buf -- the draw buffer to store the image result. It's reshaped automatically.

Returns:

LV_RESULT_OK on success, LV_RESULT_INVALID on error.

static inline void lv_snapshot_free(lv_image_dsc_t *dsc)

Deprecated:

Use lv_draw_buf_destroy instead.

Free the snapshot image returned by lv_snapshot_take

Parameters:

dsc -- the image descriptor generated by lv_snapshot_take.

static inline 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)

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

Deprecated:

Use lv_snapshot_take_to_draw_buf instead.

Parameters:
  • obj -- the object to generate snapshot.

  • cf -- color format for generated image.

  • dsc -- image descriptor to store the image result.

  • buf -- the buffer to store image data. It must meet align requirement.

  • buf_size -- provided buffer size in bytes.

Returns:

LV_RESULT_OK on success, LV_RESULT_INVALID on error.