summaryrefslogtreecommitdiff
path: root/filter
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 /filter
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 'filter')
-rw-r--r--filter/source/svg/svgwriter.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index c9b80e918ef1..9defa7812e67 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -160,7 +160,7 @@ double SVGAttributeWriter::ImplRound( double fValue )
void SVGAttributeWriter::ImplGetColorStr( const Color& rColor, OUString& rColorStr )
{
- if( rColor.GetTransparency() == 255 )
+ if( rColor.GetAlpha() == 0 )
rColorStr = "none";
else
{
@@ -178,8 +178,8 @@ void SVGAttributeWriter::AddColorAttr( const char* pColorAttrName,
ImplGetColorStr( rColor, aColor );
- if( rColor.GetTransparency() > 0 && rColor.GetTransparency() < 255 )
- aColorOpacity = OUString::number( ImplRound( ( 255.0 - rColor.GetTransparency() ) / 255.0 ) );
+ if( rColor.GetAlpha() < 255 && rColor.GetAlpha() > 0 )
+ aColorOpacity = OUString::number( ImplRound( rColor.GetAlpha() / 255.0 ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorAttrName, aColor );
@@ -3136,8 +3136,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
Color aNewLineColor( mpVDev->GetLineColor() ), aNewFillColor( mpVDev->GetFillColor() );
- aNewLineColor.SetTransparency( sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
- aNewFillColor.SetTransparency( sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
+ aNewLineColor.SetAlpha( 255 - sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
+ aNewFillColor.SetAlpha( 255 - sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
maAttributeWriter.AddPaintAttr( aNewLineColor, aNewFillColor );
ImplWritePolyPolygon( rPolyPoly, false );
@@ -3248,7 +3248,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
mapCurShape->maShapePolyPoly = aShapePolyPoly;
mapCurShape->maShapeFillColor = aFill.getFillColor();
- mapCurShape->maShapeFillColor.SetTransparency( static_cast<sal_uInt8>(FRound( 255.0 * aFill.getTransparency() )) );
+ mapCurShape->maShapeFillColor.SetAlpha( 255 - static_cast<sal_uInt8>(FRound( 255.0 * aFill.getTransparency() )) );
if( bGradient )
{
@@ -3338,7 +3338,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
mapCurShape->maShapeLineColor = mpVDev->GetLineColor();
- mapCurShape->maShapeLineColor.SetTransparency( static_cast<sal_uInt8>(FRound( aStroke.getTransparency() * 255.0 )) );
+ mapCurShape->maShapeLineColor.SetAlpha( 255 - static_cast<sal_uInt8>(FRound( aStroke.getTransparency() * 255.0 )) );
mapCurShape->mnStrokeWidth = FRound( aStroke.getStrokeWidth() );
aStroke.getDashArray( mapCurShape->maDashArray );