summaryrefslogtreecommitdiff
path: root/include/tools/color.hxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-05-13 14:00:10 +0000
committerTomaž Vajngerl <quikee@gmail.com>2019-05-14 03:20:50 +0200
commitd14d1341f2b0cd62098425b36438ae20b887fe93 (patch)
treee1bb6f188239144e7792e678c903334e099e3b9c /include/tools/color.hxx
parent0a3f9a7e113c184355d49dbd6bd2ed75b0980b1e (diff)
Switch everyone to stricter GetColorError
This replaces the variant in Color with the stricter one of BitmapColor. I couldn't find any reasoning for the lazy variant used in Color. Change-Id: I6dab3ab94a7f24ef5e80299d64267e3be8df888c Reviewed-on: https://gerrit.libreoffice.org/72234 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/tools/color.hxx')
-rw-r--r--include/tools/color.hxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index ed8b8813afee..fa62f28f362b 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -126,7 +126,7 @@ public:
return color::extractRGB(mValue);
}
- sal_uInt8 GetColorError(const Color& rCompareColor) const;
+ sal_uInt16 GetColorError(const Color& rCompareColor) const;
sal_uInt8 GetLuminance() const;
void IncreaseLuminance(sal_uInt8 cLumInc);
@@ -224,6 +224,14 @@ inline void Color::Invert()
B = ~B;
}
+inline sal_uInt16 Color::GetColorError( const Color& rColor ) const
+{
+ return static_cast<sal_uInt16>(
+ abs(static_cast<int>(GetBlue()) - rColor.GetBlue()) +
+ abs(static_cast<int>(GetGreen()) - rColor.GetGreen()) +
+ abs(static_cast<int>(GetRed()) - rColor.GetRed()));
+}
+
inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency )
{
R = ColorChannelMerge(R, rMergeColor.R, cTransparency);