Created attachment 190062 [details] sample file
Steps to reproduce: 1. Open attached document -> The logo has no fill. See comparison Reproduced in Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 0c4913e03e8427a576138601958f2dbf13b8c37b CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3 Locale: es-ES (es_ES.UTF-8); UI: en-US Calc: threaded [Bug found by office-interoperability-tools]
Created attachment 190063 [details] comparison before and after
Regression introduced by: author Noel Grandin <noelgrandin@gmail.com> 2021-04-16 20:33:10 +0200 committer Noel Grandin <noel.grandin@collabora.co.uk> 2023-07-25 08:38:12 +0200 commit 81994cb2b8b32453a92bcb011830fcb884f22ff3 (patch) tree ae1750e92421ad2e0ec3f50351c3be6581841598 parent dabedcaf27b0af1e38a611b8d8e48444f848e01d (diff) Convert internal vcl bitmap formats transparency->alpha (II) Bisected with: bibisect-linux64-24.2 Adding Cc: to Noel Grandin
Created attachment 190064 [details] another example affected by the same issue
Confirmed. Might be the same as bug 157502.
One possible commonality in the recent wave of semi-transparent image bugs is that they are images in MS Office formats (both OOXML and pre-OOXML formats). I don't have any familiarity with loading those file formats but my first guess is that MS Office stores transparency instead of alpha in its image masks. I will see if I can find the code where images are loaded from MS Office. I would think that if I can find that point, I might be able to add an AlphaMask::Invert(). We definitely need to commit 81994cb2b8b32453a92bcb011830fcb884f22ff3 to properly render .png images in ODF files or loaded directly so I think the AlphaMask::Invert() will need to be done immediately after loading.
I have narrowed down the cause of this bug for all of the attached and linked documents with the following debug patch. This debug patch works but it might affect other cases since it is so late in the rendering process so I need find where the AlphaMask is constructed for these images and apply the invert there: diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 2c3521ace0dd..d194febbdf28 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -476,6 +476,9 @@ void VclProcessor2D::RenderPolygonHairlinePrimitive2D( void VclProcessor2D::RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate) { BitmapEx aBitmapEx(rBitmapCandidate.getBitmap()); + AlphaMask aMask = aBitmapEx.GetAlphaMask(); + aMask.Invert(); + aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aMask); const basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rBitmapCandidate.getTransform());
Thanks Patrick for narrowing down the search a whole bunch. Fix here: https://gerrit.libreoffice.org/c/core/+/157824
*** Bug 157570 has been marked as a duplicate of this bug. ***
Noel Grandin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/3622404f09448b82c095256140afe6240b522ece tdf#157636 FILEOPEN: PPT: Images have no background It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/e9374f74385d7dfe77d1902d3d82af20143bc775 tdf#157636: sd_png_export: Add unittest It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.