lottie: add lottie_animation_render_tree() c api . 46/192946/2
authorsubhransu mohanty <sub.mohanty@samsung.com>
Tue, 13 Nov 2018 06:16:48 +0000 (15:16 +0900)
committerHermet Park <chuneon.park@samsung.com>
Thu, 22 Nov 2018 06:30:23 +0000 (06:30 +0000)
Change-Id: I23004c1c2a4aed7e285624e095295ee8e4b18894

inc/lottieanimation_capi.h
src/binding/c/lottieanimation_capi.cpp

index 86a7bfc..89b94cd 100644 (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.
index a619389..2d7efc3 100644 (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,