diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-11 08:54:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-12 17:38:53 +0100 |
commit | d765ec2295d12ccde1fb25aa92c5d821de748add (patch) | |
tree | c2f806389478df23b78319c6043971f92995851c /svx/source | |
parent | a1d6701105456248f6ff39766a6699f26a8f3d60 (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 'svx/source')
-rw-r--r-- | svx/source/accessibility/AccessibleShape.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaypolypolygon.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/nbdtmg.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdotextdecomposition.cxx | 2 | ||||
-rw-r--r-- | svx/source/unodraw/unobrushitemhelper.cxx | 10 |
7 files changed, 13 insertions, 13 deletions
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 0780801cd3b0..074687dd6e0d 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -675,12 +675,12 @@ sal_Int32 SAL_CALL AccessibleShape::getBackground() Color crBk(nColor); if (nTrans == 0 ) { - crBk.SetTransparency(0xff); + crBk.SetAlpha(0); } else { nTrans = short(256 - nTrans / 100. * 256); - crBk.SetTransparency(sal_uInt8(nTrans)); + crBk.SetAlpha(255 - sal_uInt8(nTrans)); } nColor = crBk; } diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx index 796fe0e2368a..ef973ecea8c8 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx @@ -143,7 +143,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageBackgroun // init background with InitColor xRetval.resize(1); const basegfx::BColor aRGBColor(aInitColor.getBColor()); - xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor, aInitColor.GetTransparency() / 255.0)); + xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor, (255 - aInitColor.GetAlpha()) / 255.0)); } return xRetval; diff --git a/svx/source/sdr/overlay/overlaypolypolygon.cxx b/svx/source/sdr/overlay/overlaypolypolygon.cxx index 8abde414faa0..5be533074a50 100644 --- a/svx/source/sdr/overlay/overlaypolypolygon.cxx +++ b/svx/source/sdr/overlay/overlaypolypolygon.cxx @@ -53,13 +53,13 @@ namespace sdr::overlay auto aLine(new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(maLinePolyPolygon, aLineAttribute)); aReturnContainer = drawinglayer::primitive2d::Primitive2DContainer { aLine }; - if (maFillColor.GetTransparency() != 255) + if (maFillColor.GetAlpha() != 0) { auto aFill(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(maLinePolyPolygon, maFillColor.getBColor())); aReturnContainer.push_back(aFill); } - sal_uInt8 nTransparency = getBaseColor().GetTransparency(); + sal_uInt8 nTransparency = 255 - getBaseColor().GetAlpha(); if (nTransparency > 0) { const drawinglayer::primitive2d::Primitive2DReference aTransparencePrimitive( diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 5ee93efef85f..fc9154d42c6a 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -219,7 +219,7 @@ namespace drawinglayer Color aColor(rSet.Get(SDRATTR_GLOW_COLOR).GetColorValue()); sal_uInt16 nTransparency(rSet.Get(SDRATTR_GLOW_TRANSPARENCY).GetValue()); if (nTransparency) - aColor.SetTransparency(std::round(nTransparency / 100.0 * 255.0)); + aColor.SetAlpha(255 - std::round(nTransparency / 100.0 * 255.0)); attribute::SdrGlowAttribute glowAttr{ nRadius, aColor }; return glowAttr; diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 390b9cf20e3d..f786738902e0 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -194,7 +194,7 @@ void NBOTypeMgrBase::ImplLoad(const OUString& filename) if (aFmt.GetBulletFont()) { vcl::Font aFont(*aFmt.GetBulletFont()); Color c=aFont.GetColor(); - c.SetTransparency(0xFF); + c.SetAlpha(0); aFont.SetColor(c); aFmt.SetBulletFont(&aFont); aNum.SetLevel(i, aFmt); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 2661c98b72e5..fd53bf0e9d3d 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -363,7 +363,7 @@ namespace // Handle semi-transparent text for both the decorated and simple case here. pNewPrimitive = new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( drawinglayer::primitive2d::Primitive2DContainer{ pNewPrimitive }, - aFontColor.GetTransparency() / 255.0); + (255 - aFontColor.GetAlpha()) / 255.0); } if(rInfo.mbEndOfBullet) diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx index 90168e42c8b3..d3dcf2680ec4 100644 --- a/svx/source/unodraw/unobrushitemhelper.cxx +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -46,7 +46,7 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI rToSet.ClearItem(a); } - const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency()); + const sal_uInt8 nTransparency(255 - rBrush.GetColor().GetAlpha()); // tdf#89478 check for image first if (GPOS_NONE != rBrush.GetGraphicPos()) @@ -181,7 +181,7 @@ static std::unique_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& r // since the oxff value is used for special purposes (like no fill and derive from parent) const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); - aFillColor.SetTransparency(aTargetTrans); + aFillColor.SetAlpha(255 - aTargetTrans); } return std::make_unique<SvxBrushItem>(aFillColor, nBackgroundID); @@ -200,7 +200,7 @@ std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo if (!bXMLImportHack && aFillColor != Color(0)) aFillColor = COL_AUTO; - aFillColor.SetTransparency(0xff); + aFillColor.SetAlpha(0); return std::make_unique<SvxBrushItem>(aFillColor, nBackgroundID); } @@ -241,7 +241,7 @@ std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo // since the oxff value is used for special purposes (like no fill and derive from parent) const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); - aMixedColor.SetTransparency(aTargetTrans); + aMixedColor.SetAlpha(255 - aTargetTrans); } aRetval = std::make_unique<SvxBrushItem>(aMixedColor, nBackgroundID); @@ -275,7 +275,7 @@ std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo // since the oxff value is used for special purposes (like no fill and derive from parent) const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); - aHatchColor.SetTransparency(aTargetTrans); + aHatchColor.SetAlpha(255 - aTargetTrans); aRetval = std::make_unique<SvxBrushItem>(aHatchColor, nBackgroundID); } |