mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-11 15:12:08 +00:00
binding/capi: support lottie extensions
these experimental apis are allowed to use when the lottie loader is enabled. APIs: - Tvg_Animation* tvg_lottie_animation_new() - Tvg_Result tvg_lottie_animation_override(Tvg_Animation* animation, const char* slot)
This commit is contained in:
parent
65e8fe2791
commit
71a5c3ad02
2 changed files with 64 additions and 1 deletions
|
@ -2316,7 +2316,47 @@ TVG_API Tvg_Result tvg_animation_get_duration(Tvg_Animation* animation, float* d
|
||||||
TVG_API Tvg_Result tvg_animation_del(Tvg_Animation* animation);
|
TVG_API Tvg_Result tvg_animation_del(Tvg_Animation* animation);
|
||||||
|
|
||||||
|
|
||||||
/** \} */ // end defgroup ThorVG_CAPI
|
/** \} */ // end defgroup ThorVGCapi_Animation
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \defgroup ThorVGCapi_LottieAnimation LottieAnimation
|
||||||
|
* \brief A module for manipulation of lottie extension features.
|
||||||
|
*
|
||||||
|
* The module enables control of advanced Lottie features.
|
||||||
|
* \{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* LottieAnimation Extension API */
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Creates a new LottieAnimation object. (Experimental API)
|
||||||
|
*
|
||||||
|
* \return Tvg_Animation A new Tvg_LottieAnimation object.
|
||||||
|
*/
|
||||||
|
TVG_API Tvg_Animation* tvg_lottie_animation_new();
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Override the lottie properties through the slot data. (Experimental API)
|
||||||
|
*
|
||||||
|
* \param[in] animation The Tvg_Animation object to override the property with the slot.
|
||||||
|
* \param[in] slot The lottie slot data in json.
|
||||||
|
*
|
||||||
|
* \return Tvg_Animation A new Tvg_LottieAnimation object.
|
||||||
|
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||||
|
* \retval TVG_RESULT_INSUFFICIENT_CONDITION When the given @p slot is invalid
|
||||||
|
* \retval TVG_RESULT_NOT_SUPPORTED The Lottie Animation is not supported.
|
||||||
|
*/
|
||||||
|
TVG_API Tvg_Result tvg_lottie_animation_override(Tvg_Animation* animation, const char* slot);
|
||||||
|
|
||||||
|
|
||||||
|
/** \} */ // end addtogroup ThorVGCapi_LottieAnimation
|
||||||
|
|
||||||
|
|
||||||
|
/** \} */ // end defgroup ThorVGCapi
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -773,6 +773,29 @@ TVG_API Tvg_Result tvg_animation_del(Tvg_Animation* animation)
|
||||||
return TVG_RESULT_SUCCESS;
|
return TVG_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* Lottie Animation API */
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
TVG_API Tvg_Animation* tvg_lottie_animation_new()
|
||||||
|
{
|
||||||
|
#ifdef THORVG_LOTTIE_LOADER_SUPPORT
|
||||||
|
return (Tvg_Animation*) LottieAnimation::gen().release();
|
||||||
|
#endif
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TVG_API Tvg_Result tvg_lottie_animation_override(Tvg_Animation* animation, const char* slot)
|
||||||
|
{
|
||||||
|
#ifdef THORVG_LOTTIE_LOADER_SUPPORT
|
||||||
|
if (!animation) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
|
return (Tvg_Result) reinterpret_cast<LottieAnimation*>(animation)->override(slot);
|
||||||
|
#endif
|
||||||
|
return TVG_RESULT_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue