lottie: add lottie_animation_render_tree() c api .

Change-Id: I23004c1c2a4aed7e285624e095295ee8e4b18894
This commit is contained in:
subhransu mohanty 2018-11-13 15:16:48 +09:00 committed by Hermet Park
parent b0ff909587
commit 01733cd6cd
2 changed files with 23 additions and 0 deletions

View File

@ -36,6 +36,19 @@ LOT_EXPORT size_t lottie_animation_prepare_frame(Lottie_Animation *animation,
LOT_EXPORT size_t lottie_animation_get_node_count(const Lottie_Animation *animation);
LOT_EXPORT const LOTNode* lottie_animation_get_node(Lottie_Animation *animation, size_t idx);
/*
* Get the render tree which contains the snapshot of the animation object at frame $frame_number
* frame_number, the content of the animation in that frame number
* width , width of the viewbox
* height , height of the viewbox
*
* PS : user has to traverse the tree for rendering. @see LOTLayerNode and @see LOTNode
*/
LOT_EXPORT const LOTLayerNode * lottie_animation_render_tree(Lottie_Animation *animation,
size_t frameNo,
size_t w, size_t h);
/*
* Request to render the content of the frame $frame_number to buffer $buffer asynchronously.
* frame_number, the frame number needs to be rendered.

View File

@ -99,6 +99,16 @@ LOT_EXPORT const LOTNode* lottie_animation_get_node(const Lottie_Animation_S *an
return animation->mAnimation->renderList(animation->mFrameNo, animation->mWidth, animation->mHeight)[idx];
}
LOT_EXPORT const LOTLayerNode * lottie_animation_render_tree(Lottie_Animation_S *animation, size_t frameNo, size_t w, size_t h)
{
if (!animation) return nullptr;
animation->mFrameNo = frameNo;
animation->mWidth = w;
animation->mHeight = h;
return animation->mAnimation->renderTree(frameNo, w, h);
}
LOT_EXPORT void
lottie_animation_render_async(Lottie_Animation_S *animation,
size_t frame_number,