diff --git a/inc/rlottie_capi.h b/inc/rlottie_capi.h index d038782872..a5cb70ad50 100644 --- a/inc/rlottie_capi.h +++ b/inc/rlottie_capi.h @@ -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); +/** + * @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. * diff --git a/src/binding/c/lottieanimation_capi.cpp b/src/binding/c/lottieanimation_capi.cpp index cd85bd3789..d40df28b1a 100644 --- a/src/binding/c/lottieanimation_capi.cpp +++ b/src/binding/c/lottieanimation_capi.cpp @@ -107,6 +107,20 @@ lottie_animation_get_frame_at_pos(const Lottie_Animation_S *animation, float 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 lottie_animation_render_async(Lottie_Animation_S *animation, size_t frame_number,