summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2020-03-19 23:20:44 +0100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2020-03-20 08:21:53 +0100
commitad4ee3bb3bf99c3b02ddca2318d39a1c0f2469a0 (patch)
treef3f74d351d57c80108e72e8ffc922cae797de4bb
parent20ed81fd42cf8079c11c2b18973b9504a679e49c (diff)
EMF+ tdf#124424 Add support for transparency to LinearGradient and blend points
Change-Id: Ia1cabaef6aa01337581cb9359bdd1ae90a4ebd55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90767 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
-rw-r--r--drawinglayer/source/tools/emfphelperdata.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index f7c22c6831b6..c8e0d078be39 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -835,10 +835,11 @@ namespace emfplushelper
// seems like SvgRadialGradientPrimitive2D needs doubled, inverted radius
aBlendPoint = 2. * ( 1. - brush->blendPositions [i] );
}
- aColor.setGreen( aStartColor.getGreen() * (1. - brush->blendFactors[i]) + aEndColor.getGreen() * brush->blendFactors[i] );
- aColor.setBlue ( aStartColor.getBlue() * (1. - brush->blendFactors[i]) + aEndColor.getBlue() * brush->blendFactors[i] );
- aColor.setRed ( aStartColor.getRed() * (1. - brush->blendFactors[i]) + aEndColor.getRed() * brush->blendFactors[i] );
- aVector.emplace_back(aBlendPoint, aColor, 1. );
+ aColor.setGreen( aStartColor.getGreen() + brush->blendFactors[i] * ( aEndColor.getGreen() - aStartColor.getGreen() ) );
+ aColor.setBlue ( aStartColor.getBlue() + brush->blendFactors[i] * ( aEndColor.getBlue() - aStartColor.getBlue() ) );
+ aColor.setRed ( aStartColor.getRed() + brush->blendFactors[i] * ( aEndColor.getRed() - aStartColor.getRed() ) );
+ const double aTransparency = brush->solidColor.GetTransparency() + brush->blendFactors[i] * ( brush->secondColor.GetTransparency() - brush->solidColor.GetTransparency() );
+ aVector.emplace_back(aBlendPoint, aColor, (255.0 - aTransparency) / 255.0);
}
}
else if (brush->colorblendPositions)
@@ -860,7 +861,7 @@ namespace emfplushelper
aBlendPoint = 2. * ( 1. - brush->colorblendPositions [i] );
}
aColor = brush->colorblendColors[i].getBColor();
- aVector.emplace_back(aBlendPoint, aColor, 1. );
+ aVector.emplace_back(aBlendPoint, aColor, (255 - brush->colorblendColors[i].GetTransparency()) / 255.0 );
}
}
else // ok, no extra points: just start and end