From 6eea979dae7ad8abbbf2ac215ef4cdd77a9146f6 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Thu, 24 Jun 2021 13:02:32 +0200 Subject: [PATCH] common: introducing the composite API (getter) The new API gets the composite method and the pointer to the composite target of the given paint object. --- inc/thorvg.h | 12 +++++++++++- src/lib/tvgPaint.cpp | 8 ++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/inc/thorvg.h b/inc/thorvg.h index ba1d98bc..26df36d0 100644 --- a/inc/thorvg.h +++ b/inc/thorvg.h @@ -266,7 +266,6 @@ public: * @param[in] method The method used to composite the source object with the target. * * @return Result::Success when succeed, Result::InvalidArguments otherwise. - * */ Result composite(std::unique_ptr target, CompositeMethod method) noexcept; @@ -300,6 +299,17 @@ public: */ uint8_t opacity() const noexcept; + /** + * @brief Gets the composition target object and the composition method. + * + * @param[out] target The paint of the target object. + * + * @return The method used to composite the source object with the target. + * + * @BETA_API + */ + CompositeMethod composite(const Paint** target) const noexcept; + _TVG_DECLARE_ACCESSOR(); _TVG_DECALRE_IDENTIFIER(); _TVG_DECLARE_PRIVATE(Paint); diff --git a/src/lib/tvgPaint.cpp b/src/lib/tvgPaint.cpp index ef553c1b..3884468b 100644 --- a/src/lib/tvgPaint.cpp +++ b/src/lib/tvgPaint.cpp @@ -308,6 +308,14 @@ Result Paint::composite(std::unique_ptr target, CompositeMethod method) n } +CompositeMethod Paint::composite(const Paint** target) const noexcept +{ + if (target) *target = pImpl->cmpTarget; + + return pImpl->cmpMethod; +} + + Result Paint::opacity(uint8_t o) noexcept { if (pImpl->opacity == o) return Result::Success;