1 #ifndef _LOTTIE_ANIMATION_CAPI_H_
2 #define _LOTTIE_ANIMATION_CAPI_H_
7 #include <lottiecommon.h>
13 typedef struct Lottie_Animation_S Lottie_Animation;
15 LOT_EXPORT Lottie_Animation *lottie_animation_from_file(const char *file);
16 LOT_EXPORT Lottie_Animation *lottie_animation_from_data(const char *data, const char *key);
17 LOT_EXPORT void lottie_animation_destroy(Lottie_Animation *animation);
18 LOT_EXPORT void lottie_animation_get_size(const Lottie_Animation *animation, size_t *w, size_t *h);
19 LOT_EXPORT double lottie_animation_get_duration(const Lottie_Animation *animation);
20 LOT_EXPORT size_t lottie_animation_get_totalframe(const Lottie_Animation *animation);
21 LOT_EXPORT double lottie_animation_get_framerate(const Lottie_Animation *animation);
25 * Request to update the content of the frame $frame_number in to Animation object.
26 * frame_number, the content of the animation in that frame number
27 * width , width of the viewbox
28 * height , height of the viewbox
30 * PS : user must call lottie_animation_get_node_count and lottie_animation_get_node
31 * to get the renderlist.
33 LOT_EXPORT size_t lottie_animation_prepare_frame(Lottie_Animation *animation,
36 LOT_EXPORT size_t lottie_animation_get_node_count(const Lottie_Animation *animation);
37 LOT_EXPORT const LOTNode* lottie_animation_get_node(Lottie_Animation *animation, size_t idx);
41 * Get the render tree which contains the snapshot of the animation object at frame $frame_number
42 * frame_number, the content of the animation in that frame number
43 * width , width of the viewbox
44 * height , height of the viewbox
46 * PS : user has to traverse the tree for rendering. @see LOTLayerNode and @see LOTNode
48 LOT_EXPORT const LOTLayerNode * lottie_animation_render_tree(Lottie_Animation *animation,
53 * Request to render the content of the frame $frame_number to buffer $buffer asynchronously.
54 * frame_number, the frame number needs to be rendered.
55 * buffer , surface buffer use for rendering
56 * width , width of the surface
57 * height , height of the surface
58 * bytes_per_line, stride of the surface in bytes.
60 * PS : user must call lottie_animation_render_flush to make sure render is finished.
63 lottie_animation_render_async(Lottie_Animation *animation,
68 size_t bytes_per_line);
72 * Request to finish the current asyn renderer job for this animation object.
73 * if render is finished then this call returns immidiately
74 * if not it waits till render job finish and then return.
75 * user must use lottie_animation_render_async and lottie_animation_render_flush
76 * together to get the benefit of async rendering.
79 lottie_animation_render_flush(Lottie_Animation *animation);
85 #endif //_LOTTIE_ANIMATION_CAPI_H_