diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-14 12:39:06 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-14 21:08:17 +0200 |
commit | 41bf4139cab36984cff514bfdd6b1b13576746a3 (patch) | |
tree | f976deb977ad2b7bc372b1193fde8984a3842bd8 /include/basegfx | |
parent | b6474249caa697513affdbcb02c7a69fda8203be (diff) |
tdf#155735: Add support for saturate type
Add getModifierName to BColorModifier class so when
can assert which modifier is being used
Change-Id: I2bc2a36470a449df4dc84a8440f232149c1f8278
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153048
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'include/basegfx')
-rw-r--r-- | include/basegfx/color/bcolormodifier.hxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/basegfx/color/bcolormodifier.hxx b/include/basegfx/color/bcolormodifier.hxx index 911d74289a17..28ab7487eec3 100644 --- a/include/basegfx/color/bcolormodifier.hxx +++ b/include/basegfx/color/bcolormodifier.hxx @@ -22,6 +22,7 @@ #include <config_options.h> #include <basegfx/basegfxdllapi.h> #include <basegfx/color/bcolor.hxx> +#include <rtl/ustring.hxx> #include <osl/diagnose.h> @@ -80,6 +81,8 @@ namespace basegfx // compute modified color virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const = 0; + + virtual OUString getModifierName() const = 0; }; /** convert color to gray @@ -98,6 +101,7 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** invert color @@ -118,6 +122,7 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** convert to alpha based on luminance @@ -142,6 +147,7 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** replace color @@ -171,6 +177,7 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** interpolate color @@ -200,6 +207,35 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; + }; + + /** Apply saturation + This derivation is used for the svg importer and does exactly what SVG + defines for this needed case. + + See: + https://www.w3.org/TR/filter-effects/#elementdef-fecolormatrix + */ + class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_saturate final : public BColorModifier + { + private: + double mfValue; + + public: + BColorModifier_saturate(double fValue) + : mfValue(fValue) + { + } + + virtual ~BColorModifier_saturate() override; + + // compare operator + SAL_DLLPRIVATE virtual bool operator==(const BColorModifier& rCompare) const override; + + // compute modified color + SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** convert color to black and white @@ -225,6 +261,7 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** gamma correction @@ -252,6 +289,7 @@ namespace basegfx // compute modified color virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** Red, Green, Blue, Luminance and Contrast correction @@ -288,6 +326,7 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /** mix a part of the original color with randomized color (mainly for debug visualizations) @@ -309,6 +348,7 @@ namespace basegfx // compute modified color SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; + SAL_DLLPRIVATE virtual OUString getModifierName() const override; }; /// typedef to allow working with shared instances of BColorModifier |