summaryrefslogtreecommitdiff
path: root/include/tools
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-01-11 08:54:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-12 17:38:53 +0100
commitd765ec2295d12ccde1fb25aa92c5d821de748add (patch)
treec2f806389478df23b78319c6043971f92995851c /include/tools
parenta1d6701105456248f6ff39766a6699f26a8f3d60 (diff)
transparency->alpha in tools::Color
this just changes the Get/Set methods, the constructor and internal representation of Color is not changed. Change-Id: Idb6e07cc08bbaa5bd55b6bd4b585e648aef507b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/tools')
-rw-r--r--include/tools/color.hxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index fa062d59eddd..259cdc52f919 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -134,19 +134,19 @@ public:
return B;
}
- /** Gets the transparency value.
+ /** Gets the alpha value.
* @return A
*/
- sal_uInt8 GetTransparency() const
+ sal_uInt8 GetAlpha() const
{
- return A;
+ return 255 - A;
}
/** Is the color transparent?
*/
bool IsTransparent() const
{
- return GetTransparency() != 0;
+ return GetAlpha() != 255;
}
/** Is the color fully transparent i.e. 100% transparency ?
@@ -180,12 +180,12 @@ public:
B = nBlue;
}
- /** Sets the transparency value.
- * @param nTransparency
+ /** Sets the alpha value.
+ * @param nAlpha
*/
- void SetTransparency(sal_uInt8 nTransparency)
+ void SetAlpha(sal_uInt8 nAlpha)
{
- A = nTransparency;
+ A = 255 - nAlpha;
}
/** Returns the same color but ignoring the transparency value.
@@ -475,7 +475,7 @@ inline std::basic_ostream<charT, traits>& operator <<(std::basic_ostream<charT,
<< std::setw(2) << static_cast<int>(rColor.GetRed())
<< std::setw(2) << static_cast<int>(rColor.GetGreen())
<< std::setw(2) << static_cast<int>(rColor.GetBlue())
- << std::setw(2) << static_cast<int>(rColor.GetTransparency()) << "]";
+ << std::setw(2) << static_cast<int>(rColor.GetAlpha()) << "]";
rStream.setf(nOrigFlags);
return rStream;
}