thorvg/src/loaders/lottie/thorvg_lottie.h
Hermet Park d3edc0c5f7 api: clean up
promoted offical c++ apis (v0.15)
 - enum class BlendMethod
 - enum class CanvasEngine::Wg
 - virtual Result Canvas::viewport(int32_t x, int32_t y, int32_t w, int32_t h);
 - class Text
 - Result Text::fill(uint8_t r, uint8_t g, uint8_t b)
 - Result Text::fill(std::unique_ptr<Fill> f)
 - static Result Text::unload(const std::string& path)
 - static Result Text::load(const std::string& path)
 - static Result Text::load(const char* name, const char* data, uint32_t size, const std::string& mimeType = "ttf", bool copy = false)
 - static std::unique_ptr<Text> Text::gen()
 - class WgCanvas
 - static std::unique_ptr<WgCanvas> WgCanvas::gen()
 - static const char* Initializer::version(uint32_t* major, uint32_t* minor, uint32_t* micro)
 - class LottieAnimation

promoted official c apis (v0.15)
 - Tvg_Blend_Method
 - Tvg_Result tvg_engine_version(uint32_t* major, uint32_t* minor, uint32_t* micro, const char** version)
 - Tvg_Result tvg_canvas_set_viewport(Tvg_Canvas* canvas, int32_t x, int32_t y, int32_t w, int32_t h)
 - Tvg_Result tvg_paint_set_blend_method(Tvg_Paint* paint, Tvg_Blend_Method method)
 - Tvg_Paint* tvg_text_new(void)
 - Tvg_Result tvg_text_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b)
 - Tvg_Result tvg_text_set_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
 - Tvg_Result tvg_font_load(const char* path)
 - Tvg_Result tvg_font_load_data(const char* name, const char* data, uint32_t size, const char *mimetype, bool copy)
 - Tvg_Result tvg_font_unload(const char* path)
 - Tvg_Animation* tvg_lottie_animation_new(void)

removed experimental apis
 - BlendMethod paint::blend() const
 - bool Shape::strokeTrim(float* begin, float* end) const
 - Tvg_Result tvg_paint_get_blend_method(const Tvg_Paint* paint, Tvg_Blend_Method* method)
 - Tvg_Result tvg_shape_get_stroke_trim(Tvg_Paint* paint, float* begin, float* end, bool* simultaneous)
 - tvg_text_set_linear_gradient(Paint* paint, Tvg_Gradient* gradient)
 - tvg_text_set_radial_gradient(Paint* paint, Tvg_Gradient* gradient)

issue: https://github.com/thorvg/thorvg/issues/1372
2024-09-30 16:44:22 +09:00

94 lines
2.7 KiB
C++

#ifndef _THORVG_LOTTIE_H_
#define _THORVG_LOTTIE_H_
#include <thorvg.h>
namespace tvg
{
/**
* @class LottieAnimation
*
* @brief The LottieAnimation class enables control of advanced Lottie features.
*
* This class extends the Animation and has additional interfaces.
*
* @see Animation
*
* @since 0.15
*/
class TVG_API LottieAnimation final : public Animation
{
public:
~LottieAnimation();
/**
* @brief Override Lottie properties using slot data.
*
* @param[in] slot The Lottie slot data in JSON format to override, or @c nullptr to reset.
*
* @retval Result::Success When succeed.
* @retval Result::InsufficientCondition In case the animation is not loaded.
* @retval Result::InvalidArguments When the given parameter is invalid.
*
* @note Experimental API
*/
Result override(const char* slot) noexcept;
/**
* @brief Specifies a segment by marker.
*
* Markers are used to control animation playback by specifying start and end points,
* eliminating the need to know the exact frame numbers.
* Generally, markers are designated at the design level,
* meaning the callers must know the marker name in advance to use it.
*
* @param[in] marker The name of the segment marker.
*
* @retval Result::Success When successful.
* @retval Result::InsufficientCondition If the animation is not loaded.
* @retval Result::InvalidArguments When the given parameter is invalid.
* @retval Result::NonSupport When it's not animatable.
*
* @note If a @c marker is specified, the previously set segment will be disregarded.
* @note Set @c nullptr to reset the specified segment.
* @see Animation::segment(float begin, float end)
* @note Experimental API
*/
Result segment(const char* marker) noexcept;
/**
* @brief Gets the marker count of the animation.
*
* @retval The count of the markers, zero if there is no marker.
*
* @see LottieAnimation::marker()
* @note Experimental API
*/
uint32_t markersCnt() noexcept;
/**
* @brief Gets the marker name by a given index.
*
* @param[in] idx The index of the animation marker, starts from 0.
*
* @retval The name of marker when succeed, @c nullptr otherwise.
*
* @see LottieAnimation::markersCnt()
* @note Experimental API
*/
const char* marker(uint32_t idx) noexcept;
/**
* @brief Creates a new LottieAnimation object.
*
* @return A new LottieAnimation object.
*
* @since 0.15
*/
static std::unique_ptr<LottieAnimation> gen() noexcept;
};
} //namespace
#endif //_THORVG_LOTTIE_H_