diff --git a/inc/thorvg.h b/inc/thorvg.h index 4d4c18bd..1b37ab1d 100644 --- a/inc/thorvg.h +++ b/inc/thorvg.h @@ -303,6 +303,7 @@ public: Result push(std::unique_ptr paint) noexcept; Result reserve(uint32_t size) noexcept; + Result clear() noexcept; static std::unique_ptr gen() noexcept; diff --git a/inc/thorvg_capi.h b/inc/thorvg_capi.h index e1602014..22df235f 100644 --- a/inc/thorvg_capi.h +++ b/inc/thorvg_capi.h @@ -193,6 +193,7 @@ TVG_EXPORT Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, TVG_EXPORT Tvg_Paint* tvg_scene_new(); TVG_EXPORT Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size); TVG_EXPORT Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint); +TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint* scene); #ifdef __cplusplus diff --git a/src/bindings/capi/tvgCapi.cpp b/src/bindings/capi/tvgCapi.cpp index 6f47e97c..8d3fbf2e 100644 --- a/src/bindings/capi/tvgCapi.cpp +++ b/src/bindings/capi/tvgCapi.cpp @@ -514,6 +514,12 @@ TVG_EXPORT Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint) return (Tvg_Result) reinterpret_cast(scene)->push(unique_ptr((Paint*)paint)); } +TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint* scene) +{ + if (!scene) return TVG_RESULT_INVALID_ARGUMENT; + return (Tvg_Result) reinterpret_cast(scene)->clear(); +} + #ifdef __cplusplus } diff --git a/src/lib/tvgScene.cpp b/src/lib/tvgScene.cpp index cf982a58..fae2ff34 100644 --- a/src/lib/tvgScene.cpp +++ b/src/lib/tvgScene.cpp @@ -58,4 +58,12 @@ Result Scene::reserve(uint32_t size) noexcept pImpl->paints.reserve(size); return Result::Success; -} \ No newline at end of file +} + + +Result Scene::clear() noexcept +{ + pImpl->paints.clear(); + + return Result::Success; +}