drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 21 ++++++---------- drawinglayer/source/processor2d/vclprocessor2d.cxx | 5 +++ 2 files changed, 12 insertions(+), 14 deletions(-)
New commits: commit 82acd02f1395ea1a1b1e43c6b4beeec93ebf9428 Author: Mike Kaganski <[email protected]> AuthorDate: Thu May 14 14:42:24 2020 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Fri May 29 10:31:12 2020 +0200 Use buffer with alpha in VclProcessor2D::RenderTransparencePrimitive2D This allows TransparencePrimitive2D to produce truly transparent image, usable later in the stack - specifically by soft edge effect. Change-Id: I54e6f9a8fd196247b1130446af3d21b082820f01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95038 Tested-by: Mike Kaganski <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> (cherry picked from commit d5a995c0296df61cd6c9341779bccbf8989ecc75) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95080 Tested-by: Jenkins diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 9e3cf43208bc..60b372b0ef48 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -870,7 +870,7 @@ void VclProcessor2D::RenderTransparencePrimitive2D( basegfx::B2DRange aRange(rTransCandidate.getChildren().getB2DRange(getViewInformation2D())); aRange.transform(maCurrentTransformation); - impBufferDevice aBufferDevice(*mpOutputDevice, aRange); + impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true); if (!aBufferDevice.isVisible()) return; @@ -878,6 +878,7 @@ void VclProcessor2D::RenderTransparencePrimitive2D( // remember last OutDev and set to content OutputDevice* pLastOutputDevice = mpOutputDevice; mpOutputDevice = &aBufferDevice.getContent(); + mpOutputDevice->Erase(); // paint content to it process(rTransCandidate.getChildren()); @@ -889,6 +890,8 @@ void VclProcessor2D::RenderTransparencePrimitive2D( basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); + mpOutputDevice->Erase(); + // paint mask to it (always with transparence intensities, evtl. with AA) process(rTransCandidate.getTransparence()); commit a89d2a19930ba4f14bc498978664c45bfd3e8b58 Author: Mike Kaganski <[email protected]> AuthorDate: Thu May 28 15:13:15 2020 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Fri May 29 10:31:03 2020 +0200 tdf#49247: Reimplement soft edges to keep object transparency So the objects that were semi-transparent don't become opaque upon applying soft edge effect. This requires that the objects are actually semi-transparent, so that we can get alpha mask from bitmap Change-Id: Ic4af9bea19e5e71139d3f065797583f7c7c78815 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95034 Tested-by: Jenkins Tested-by: Mike Kaganski <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> (cherry picked from commit 425125e31f9053e0e4895fb13e1e267ec5d26487) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95079 diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 9e44ef292d34..3c1a1087adcf 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -1027,33 +1027,28 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D( // Blur radius is equal to soft edge radius const double fBlurRadius = aRadiusVector.getLength(); - impBufferDevice aBufferDevice(*mpOutputDevice, aRange); + impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true); if (aBufferDevice.isVisible()) { // remember last OutDev and set to content OutputDevice* pLastOutputDevice = mpOutputDevice; mpOutputDevice = &aBufferDevice.getContent(); - // Processing will draw whatever geometry on white background, applying *black* - // replacement color mpOutputDevice->Erase(); - rCandidate.setMaskGeneration(); process(rCandidate); - rCandidate.setMaskGeneration(false); + const tools::Rectangle aRect(static_cast<long>(std::floor(aRange.getMinX())), static_cast<long>(std::floor(aRange.getMinY())), static_cast<long>(std::ceil(aRange.getMaxX())), static_cast<long>(std::ceil(aRange.getMaxY()))); - Bitmap bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize()); - - AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, -fBlurRadius, fBlurRadius, 0); + BitmapEx bitmap = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), aRect.GetSize()); - // The end result is the original bitmap with blurred 8-bit alpha mask + AlphaMask aMask = bitmap.GetAlpha(); + AlphaMask blurMask = ProcessAndBlurAlphaMask(aMask, -fBlurRadius, fBlurRadius, 0); - mpOutputDevice->Erase(); - process(rCandidate); - bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize()); + aMask.BlendWith(blurMask); - BitmapEx result(bitmap, mask); + // The end result is the original bitmap with blurred 8-bit alpha mask + BitmapEx result(bitmap.GetBitmap(), aMask); // back to old OutDev mpOutputDevice = pLastOutputDevice; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
