From e121f7b37c48b6d843dfdd1d774d2a40567c46c7 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 16 Jun 2023 11:50:57 +0200 Subject: tdf#155735: Add support for matrix type Change-Id: Icc172c5f47731ddcf0beca64c72c2022313e74a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153177 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- basegfx/source/color/bcolormodifier.cxx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'basegfx/source') diff --git a/basegfx/source/color/bcolormodifier.cxx b/basegfx/source/color/bcolormodifier.cxx index 8d6f99a3faf5..829b0abda659 100644 --- a/basegfx/source/color/bcolormodifier.cxx +++ b/basegfx/source/color/bcolormodifier.cxx @@ -142,6 +142,38 @@ namespace basegfx return "interpolate"; } + BColorModifier_matrix::~BColorModifier_matrix() + { + } + + bool BColorModifier_matrix::operator==(const BColorModifier& rCompare) const + { + const BColorModifier_matrix* pCompare = dynamic_cast< const BColorModifier_matrix* >(&rCompare); + + if(!pCompare) + { + return false; + } + + return maMatrix == pCompare->maMatrix; + } + + ::basegfx::BColor BColorModifier_matrix::getModifiedColor(const ::basegfx::BColor& aSourceColor) const + { + basegfx::B3DHomMatrix aColorMatrix; + aColorMatrix.set(0, 0, aSourceColor.getRed()); + aColorMatrix.set(1, 0, aSourceColor.getGreen()); + aColorMatrix.set(2, 0, aSourceColor.getBlue()); + + aColorMatrix = maMatrix * aColorMatrix; + return ::basegfx::BColor(aColorMatrix.get(0, 0), aColorMatrix.get(1, 0), aColorMatrix.get(2, 0)); + } + + OUString BColorModifier_matrix::getModifierName() const + { + return "matrix"; + } + BColorModifier_saturate::BColorModifier_saturate(double fValue) { maSatMatrix.set(0, 0, 0.213 + 0.787 * fValue); -- cgit