Bug 75703 - FILEOPEN EMF: Missing transparency in STRETCHDIBITS image, when background SETBKMODE = Transparent
Summary: FILEOPEN EMF: Missing transparency in STRETCHDIBITS image, when background SE...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
(earliest affected)
3.5.0 release
Hardware: Other All
: medium minor
Assignee: Bartosz
Whiteboard: NoRepro:
Keywords: preBibisect, regression
Depends on:
Blocks: EMF-WMF
  Show dependency treegraph
Reported: 2014-03-03 10:58 UTC by Nicolas Mailhot
Modified: 2022-05-30 07:42 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:

Testcase (28.50 KB, application/ms-excel)
2014-03-03 10:58 UTC, Nicolas Mailhot
Extracted emf+ image with transparency issue (165.19 KB, image/x-emf)
2017-04-25 07:36 UTC, Bartosz
Test file in 5.4.3 and 6.0 alpha (303.66 KB, image/png)
2017-11-16 00:53 UTC, Gabor Kelemen (allotropia)
EMF Mask extracted from EMF file (Image removed) (7.43 KB, image/emf)
2022-05-30 07:42 UTC, Bartosz

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Mailhot 2014-03-03 10:58:28 UTC
Created attachment 95018 [details]

In the attached testcase, calc fails to apply transparency to the bottom right logo (black background instead of white). The same file opens fine in Excel 2007
Comment 1 tommy27 2014-03-04 06:26:52 UTC
confirmed on and as well under Win7x64.
so it's not a new issue... we should look for possible duplicates in the database.
please post a screenshot of the file under MS Excel showing correct transparency
Comment 2 Nicolas Mailhot 2014-03-13 14:32:22 UTC
there is an official sample of this company logo there
Comment 3 retired 2014-03-25 09:41:32 UTC Comment hidden (obsolete)
Comment 4 Nicolas Mailhot 2014-03-26 08:09:20 UTC Comment hidden (obsolete)
Comment 5 Joel Madero 2014-11-06 00:16:28 UTC Comment hidden (obsolete)
Comment 6 Buovjaga 2014-11-16 13:05:30 UTC
Reproduced the black bg.

Win 7 64-bit Version:
Build ID: b021b5983c62e266b82d9f0c5c6d8d8900553827
TinderBox: Win-x86@39, Branch:master, Time: 2014-11-12_01:10:08

Ubuntu 14.10 64-bit Version:
Build ID: 3cf226622a3d8c09d655034dbcc81695f1662b87
TinderBox: Linux-rpm_deb-x86_64@46-TDF-dbg, Branch:master, Time: 2014-11-15_23:24:22
Comment 7 Alex Thurgood 2015-01-03 17:38:49 UTC Comment hidden (no-value)
Comment 8 Buovjaga 2015-01-12 17:57:07 UTC
No repro on 3.3.0.
Repro on 3.5.0.

So it's a regression, but not bibisectable.

Ubuntu 14.10 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-

LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735
Comment 9 Andras Timar 2015-06-20 21:25:35 UTC
The embedded picture is in EMF+ format. It is displayed correctly with EMF_PLUS_DISABLE=1, so the EMF+ part causes the problem.
Comment 10 Robinson Tryon (qubit) 2015-12-14 05:50:51 UTC Comment hidden (obsolete)
Comment 11 Bartosz 2017-04-25 07:36:58 UTC
Created attachment 132818 [details]
Extracted emf+ image with transparency issue
Comment 12 Gabor Kelemen (allotropia) 2017-11-16 00:53:02 UTC
Created attachment 137797 [details]
Test file in 5.4.3 and 6.0 alpha

Seems to open fine now with the current master branch.
Comment 13 tommy27 2017-11-16 06:18:50 UTC
thanks 4 feedback. RESOLVED WORKSFORME
Comment 14 Bartosz 2022-05-30 07:06:29 UTC
Reopened as still reproducible with:

Version: / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 12; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.3~rc2-0ubuntu0.20.04.1~lo1
Calc: threaded

Most propably it is dependent from the Operating System/VCL
Comment 15 Bartosz 2022-05-30 07:42:29 UTC
Created attachment 180464 [details]
EMF Mask extracted from EMF file (Image removed)

In sample image the STRETCHDIBITS record contains two images:
- first with transparency mask (it is used to check what needs to be transparent and what not)
- the image to display.

It seems that Raster Operation (ROP) is wrongly applied there (the transparency mask is displayed as a standard bitmap), which is causing display issues