rlottie: added sync version of render function in capi

This commit is contained in:
subhransu mohanty 2019-04-25 10:16:02 +09:00 committed by Hermet Park
parent 792e781423
commit 409d775f41
2 changed files with 36 additions and 0 deletions

View File

@ -170,6 +170,28 @@ LOT_EXPORT const LOTLayerNode * lottie_animation_render_tree(Lottie_Animation *a
*/ */
LOT_EXPORT size_t lottie_animation_get_frame_at_pos(const Lottie_Animation *animation, float pos); LOT_EXPORT size_t lottie_animation_get_frame_at_pos(const Lottie_Animation *animation, float pos);
/**
* @brief Request to render the content of the frame @p frame_num to buffer @p buffer.
*
* @param[in] animation Animation object.
* @param[in] frame_num the frame number needs to be rendered.
* @param[in] buffer surface buffer use for rendering.
* @param[in] width width of the surface
* @param[in] height height of the surface
* @param[in] bytes_per_line stride of the surface in bytes.
*
*
* @ingroup Lottie_Animation
* @internal
*/
LOT_EXPORT void
lottie_animation_render(Lottie_Animation *animation,
size_t frame_num,
uint32_t *buffer,
size_t width,
size_t height,
size_t bytes_per_line);
/** /**
* @brief Request to render the content of the frame @p frame_num to buffer @p buffer asynchronously. * @brief Request to render the content of the frame @p frame_num to buffer @p buffer asynchronously.
* *

View File

@ -107,6 +107,20 @@ lottie_animation_get_frame_at_pos(const Lottie_Animation_S *animation, float pos
return animation->mAnimation->frameAtPos(pos); return animation->mAnimation->frameAtPos(pos);
} }
LOT_EXPORT void
lottie_animation_render(Lottie_Animation_S *animation,
size_t frame_number,
uint32_t *buffer,
size_t width,
size_t height,
size_t bytes_per_line)
{
if (!animation) return;
rlottie::Surface surface(buffer, width, height, bytes_per_line);
animation->mAnimation->renderSync(frame_number, surface);
}
LOT_EXPORT void LOT_EXPORT void
lottie_animation_render_async(Lottie_Animation_S *animation, lottie_animation_render_async(Lottie_Animation_S *animation,
size_t frame_number, size_t frame_number,