drawinglayer/source/tools/converters.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 9a0dad2a649066a10ace53a06d563596330199a0
Author:     Patrick Luby <plub...@libreoffice.org>
AuthorDate: Mon Nov 20 14:01:32 2023 -0500
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Nov 21 07:13:17 2023 +0100

    tdf#157558 invert and remove blended white color
    
    Before commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
    RemoveBlendedStartColor(COL_BLACK, aAlpha) would darken
    the bitmap when running a slideshow, printing, or exporting
    to PDF. To get the same effect, the alpha mask must be
    inverted, RemoveBlendedStartColor(COL_WHITE, aAlpha)
    called, and the alpha mask uninverted.
    
    Change-Id: I8e81b11aab05954c821f833f4a2fc77eec7b7701
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159742
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 56fe2fb91791..3e32af49c508 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -268,7 +268,22 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
         // Now that vcl supports bitmaps with an alpha channel, only apply
         // this correction to bitmaps without an alpha channel.
         if (pContent->GetBitCount() < 32)
+        {
             aRetval.RemoveBlendedStartColor(COL_BLACK, aAlpha);
+        }
+        else
+        {
+            // tdf#157558 invert and remove blended white color
+            // Before commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
+            // RemoveBlendedStartColor(COL_BLACK, aAlpha) would darken
+            // the bitmap when running a slideshow, printing, or exporting
+            // to PDF. To get the same effect, the alpha mask must be
+            // inverted, RemoveBlendedStartColor(COL_WHITE, aAlpha)
+            // called, and the alpha mask uninverted.
+            aAlpha.Invert();
+            aRetval.RemoveBlendedStartColor(COL_WHITE, aAlpha);
+            aAlpha.Invert();
+        }
         // return combined result
         return BitmapEx(aRetval, aAlpha);
     }

Reply via email to