「App:Library:LVGL:docs:Others:Snapshot」の版間の差分
58行目: | 58行目: | ||
Below code snippet explains usage of this API. | Below code snippet explains usage of this API. | ||
− | <syntaxhighlight lang="C++"> | + | <syntaxhighlight lang="C++" style="border: 1px dashed blue;"> |
void update_snapshot(lv_obj_t * obj, lv_obj_t * img_snapshot) | void update_snapshot(lv_obj_t * obj, lv_obj_t * img_snapshot) | ||
{ | { |
2022年6月22日 (水) 21:34時点における版
https://docs.lvgl.io/8.2/others/snapshot.html
英文 | 自動翻訳 |
---|---|
Snapshot
英文 | 自動翻訳 |
---|---|
Snapshot provides APIs to take snapshot image for LVGL object together with its children. The image will look exactly like the object. |
Usage
英文 | 自動翻訳 |
---|---|
Simply call API Note, only below color formats are supported for now:
|
Free the Image
英文 | 自動翻訳 |
---|---|
The memory Use API Take caution to free the snapshot but not delete the image object. Before free the memory, be sure to firstly unlink it from image object, using Below code snippet explains usage of this API. void update_snapshot(lv_obj_t * obj, lv_obj_t * img_snapshot)
{
lv_img_dsc_t* snapshot = (void*)lv_img_get_src(img_snapshot);
if(snapshot) {
lv_snapshot_free(snapshot);
}
snapshot = lv_snapshot_take(obj, LV_IMG_CF_TRUE_COLOR_ALPHA);
lv_img_set_src(img_snapshot, snapshot);
}
|
Use Existing Buffer
英文 | 自動翻訳 |
---|---|
If the snapshot needs update now and then, or simply caller provides memory, use API If snapshot is generated successfully, the image descriptor is updated and image data will be stored to provided
It's recommended to use API |
Example
Simple snapshot example
英文 | 自動翻訳 |
---|---|
API
英文 | 自動翻訳 |
---|---|
Functions lv_img_dsc_t *lv_snapshot_take(lv_obj_t *obj, lv_img_cf_t cf)
void lv_snapshot_free(lv_img_dsc_t *dsc)
uint32_t lv_snapshot_buf_size_needed(lv_obj_t *obj, lv_img_cf_t cf)
lv_res_t lv_snapshot_take_to_buf(lv_obj_t *obj, lv_img_cf_t cf, lv_img_dsc_t *dsc, void *buf, uint32_t buff_size)
|