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 /sw/source/filter/ww8 | |
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 'sw/source/filter/ww8')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e5b068a11676..29da55150a6a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7444,7 +7444,7 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor ) } AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_val ), aColorString.getStr() ); - m_nCharTransparence = aColor.GetTransparency(); + m_nCharTransparence = 255 - aColor.GetAlpha(); } void DocxAttributeOutput::CharContour( const SvxContourItem& rContour ) @@ -9038,7 +9038,7 @@ void DocxAttributeOutput::FormatAnchor( const SwFormatAnchor& ) static std::optional<sal_Int32> lcl_getDmlAlpha(const SvxBrushItem& rBrush) { std::optional<sal_Int32> oRet; - sal_Int32 nTransparency = rBrush.GetColor().GetTransparency(); + sal_Int32 nTransparency = 255 - rBrush.GetColor().GetAlpha(); if (nTransparency) { // Convert transparency to percent diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 1ed60de45e25..1af1dce13942 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1083,7 +1083,7 @@ static OString lcl_TransparencyToDrawingMlAlpha(const Color& rColor) { if (rColor.IsTransparent()) { - sal_Int32 nAlphaPercent = 100 - float(rColor.GetTransparency()) / 2.55; + sal_Int32 nAlphaPercent = float(rColor.GetAlpha()) / 2.55; return OString::number(nAlphaPercent * oox::drawingml::PER_PERCENT); } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 8b514baa59a4..48bf34fc9881 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1869,7 +1869,7 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush, rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillColor ^ 0xffffff ); rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 ); - nOpaque = rBrush.GetColor().GetTransparency(); + nOpaque = 255 - rBrush.GetColor().GetAlpha(); if (0 != nOpaque) bSetOpacity = true; } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index de8a1866ba36..c04770c53f3c 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1838,7 +1838,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj, sal_uInt16 nRes = WW8ITEMVALUE(rOldSet, XATTR_FILLTRANSPARENCE, XFillTransparenceItem); nTrans = sal_uInt8((nRes * 0xFE) / 100); - aBrushItem.GetColor().SetTransparency(nTrans); + aBrushItem.GetColor().SetAlpha(255 - nTrans); bBrushItemOk = true; } @@ -1855,7 +1855,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj, // Writer graphics don't have it yet if (eShapeType != mso_sptPictureFrame) { - aBrushItem.GetColor().SetTransparency(0xFE); + aBrushItem.GetColor().SetAlpha(1); bBrushItemOk = true; } break; @@ -1867,7 +1867,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj, aBrushItem.SetColor(aColor); if (bBrushItemOk) // has trans - aBrushItem.GetColor().SetTransparency(nTrans); + aBrushItem.GetColor().SetAlpha(255 - nTrans); bBrushItemOk = true; } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 75289e386eb4..762ea0c81869 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3605,7 +3605,7 @@ void SwWW8ImplReader::Read_TextForeColor(sal_uInt16, const sal_uInt8* pData, sho // At least when transparency is 0xff and the color is black, Word renders that as black. if (aColor.IsTransparent() && aColor != COL_AUTO) { - aColor.SetTransparency(0); + aColor.SetAlpha(255); } NewAttr(SvxColorItem(aColor, RES_CHRATR_COLOR)); |