1 /**
2  * @file lv_snapshot.h
3  *
4  */
5 
6 #ifndef LV_SNAPSHOT_H
7 #define LV_SNAPSHOT_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include <stdint.h>
17 #include <stddef.h>
18 
19 #include "../../../lv_conf_internal.h"
20 #include "../../../core/lv_obj.h"
21 
22 /*********************
23  *      DEFINES
24  *********************/
25 
26 #if LV_USE_SNAPSHOT
27 /**********************
28  *      TYPEDEFS
29  **********************/
30 
31 /**********************
32  * GLOBAL PROTOTYPES
33  **********************/
34 
35 /** Take snapshot for object with its children.
36  *
37  * @param obj    The object to generate snapshot.
38  * @param cf     color format for generated image.
39  *
40  * @return a pointer to an image descriptor, or NULL if failed.
41  */
42 lv_img_dsc_t * lv_snapshot_take(lv_obj_t * obj, lv_img_cf_t cf);
43 
44 /** Free the snapshot image returned by @ref lv_snapshot_take
45  *
46  * It will firstly free the data image takes, then the image descriptor.
47  *
48  * @param dsc    The image descriptor generated by lv_snapshot_take.
49  *
50  */
51 void lv_snapshot_free(lv_img_dsc_t * dsc);
52 
53 /** Get the buffer needed for object snapshot image.
54  *
55  * @param obj    The object to generate snapshot.
56  * @param cf     color format for generated image.
57  *
58  * @return the buffer size needed in bytes
59  */
60 uint32_t lv_snapshot_buf_size_needed(lv_obj_t * obj, lv_img_cf_t cf);
61 
62 /** Take snapshot for object with its children, save image info to provided buffer.
63  *
64  * @param obj      The object to generate snapshot.
65  * @param cf       color format for generated image.
66  * @param dsc      image descriptor to store the image result.
67  * @param buf      the buffer to store image data.
68  * @param buf_size provided buffer size in bytes.
69  *
70  * @return LV_RES_OK on success, LV_RES_INV on error.
71  */
72 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 buf_size);
73 
74 /**********************
75  *      MACROS
76  **********************/
77 #endif /*LV_USE_SNAPSHOT*/
78 
79 #ifdef __cplusplus
80 } /*extern "C"*/
81 #endif
82 
83 #endif
84