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.
This commit is contained in:
Mira Grudzinska 2021-06-24 13:02:32 +02:00 committed by Hermet Park
parent 96d6b47a64
commit 6eea979dae
2 changed files with 19 additions and 1 deletions

View file

@ -266,7 +266,6 @@ public:
* @param[in] method The method used to composite the source object with the target. * @param[in] method The method used to composite the source object with the target.
* *
* @return Result::Success when succeed, Result::InvalidArguments otherwise. * @return Result::Success when succeed, Result::InvalidArguments otherwise.
*
*/ */
Result composite(std::unique_ptr<Paint> target, CompositeMethod method) noexcept; Result composite(std::unique_ptr<Paint> target, CompositeMethod method) noexcept;
@ -300,6 +299,17 @@ public:
*/ */
uint8_t opacity() const noexcept; 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_DECLARE_ACCESSOR();
_TVG_DECALRE_IDENTIFIER(); _TVG_DECALRE_IDENTIFIER();
_TVG_DECLARE_PRIVATE(Paint); _TVG_DECLARE_PRIVATE(Paint);

View file

@ -308,6 +308,14 @@ Result Paint::composite(std::unique_ptr<Paint> 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 Result Paint::opacity(uint8_t o) noexcept
{ {
if (pImpl->opacity == o) return Result::Success; if (pImpl->opacity == o) return Result::Success;