diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2022-12-19 18:10:03 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-12-20 12:25:10 +0000 |
commit | 74f51d5ecd0bbeedff7b52d28294828c0726def4 (patch) | |
tree | 0c6878a97a396705977897496c3cbdf2bc9aa230 /include/basegfx | |
parent | 5f29cb2fad3481889adec0c2dd242f7288ad169d (diff) |
Added BColorModifier_randomize for visualization testing
This BColorModifier is able to blend a color against a
randomized one, by the given amount. This is useful for
testing purposes in th eliving office when making
interactive tests with it.
Change-Id: I96d8b83397783201080682cd4bd75779ef77b238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144541
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'include/basegfx')
-rw-r--r-- | include/basegfx/color/bcolormodifier.hxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/basegfx/color/bcolormodifier.hxx b/include/basegfx/color/bcolormodifier.hxx index b39849ed7987..911d74289a17 100644 --- a/include/basegfx/color/bcolormodifier.hxx +++ b/include/basegfx/color/bcolormodifier.hxx @@ -290,6 +290,27 @@ namespace basegfx SAL_DLLPRIVATE virtual ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const override; }; + /** mix a part of the original color with randomized color (mainly for debug visualizations) + */ + class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_randomize final : public BColorModifier + { + private: + // [0.0 .. 1.0] where 0.0 is no randomize, 1.0 is all random and in-between + // describes the mixed part. Default is 0.1 which means to mix with 10% random color + double mfRandomPart; + + public: + BColorModifier_randomize(double fRandomPart = 0.1); + + virtual ~BColorModifier_randomize() 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; + }; + /// typedef to allow working with shared instances of BColorModifier /// for the whole mechanism typedef std::shared_ptr< BColorModifier > BColorModifierSharedPtr; |