summaryrefslogtreecommitdiff
path: root/basegfx/source
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-16 11:50:57 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-22 17:19:27 +0200
commite121f7b37c48b6d843dfdd1d774d2a40567c46c7 (patch)
treef512af867d5653469713613df0b3b12a718ea40f /basegfx/source
parentcdce0b615a0bd599cd90dfd145d8270287045619 (diff)
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'basegfx/source')
-rw-r--r--basegfx/source/color/bcolormodifier.cxx32
1 files changed, 32 insertions, 0 deletions
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);