Bug 70710 - [WMF/EMF/EMF+] FILEOPEN Filled areas are not filled for WMF images
Summary: [WMF/EMF/EMF+] FILEOPEN Filled areas are not filled for WMF images
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
3.6.0.4 release
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:emf, preBibisect, regression
Depends on: 142864
Blocks: EMF-WMF
  Show dependency treegraph
 
Reported: 2013-10-21 06:39 UTC by Ulrich Windl
Modified: 2022-06-16 22:52 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Example WMF (51.74 KB, application/x-msmetafile)
2013-10-21 06:39 UTC, Ulrich Windl
Details
Comparing the presentation of the example image in LibreOffice 6.1 with Inkscape 0.91 (48.23 KB, image/png)
2019-07-02 06:21 UTC, Ulrich Windl
Details
convert wmf in irfanview to emf file (557.75 KB, image/x-emf)
2020-03-10 21:10 UTC, paulystefan
Details
WMF file with removed 'ESCAPE' records (8.76 KB, image/x-wmf)
2021-05-15 00:18 UTC, Valek Filippov
Details
EMF file reconstructed from ESCAPPE records of the WMF file (42.72 KB, image/x-emf)
2021-05-15 00:18 UTC, Valek Filippov
Details
EMF file reconstructed from ESCAPPE records of the WMF file with EMF+ records removed (41.36 KB, image/x-emf)
2021-05-15 01:25 UTC, Valek Filippov
Details
WMF recuced to headers/eof and ESCAPE records (43.02 KB, image/x-wmf)
2021-05-15 01:40 UTC, Valek Filippov
Details
Screenshot of "not-so-pure EMF" rendered by LO 7.2 (9.74 KB, image/png)
2021-05-15 02:03 UTC, Valek Filippov
Details
Screenshot of "pure EMF" rendered by LO 7.2 (10.78 KB, image/png)
2021-05-15 12:51 UTC, Valek Filippov
Details
EMF sample with few first EMF+ records removed (42.02 KB, image/x-emf)
2021-05-15 13:34 UTC, Valek Filippov
Details
Updated example WMF (52.05 KB, image/x-wmf)
2021-05-16 18:42 UTC, Ulrich Windl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Windl 2013-10-21 06:39:44 UTC
Created attachment 87908 [details]
Example WMF

This is new as compared to LibreOffice 3.6: When creating filles rectangles in Draw, exporting them as WMF, and importing them in Writer, the filled areas are not filled. Did not see this in LibreOffice 3. I'll attach an example.
I found the problem with Windows/XP (32-bit)...
Comment 1 Ulrich Windl 2013-10-21 06:43:36 UTC
When double-clicking the WMF file in Windows, the filled areas are displayed, so I guess it's a bug in Writer, and not in Draw.
Comment 2 Andras Timar 2014-01-19 20:21:57 UTC
Bug is not reproducible, when EMF_PLUS_DISABLE environment variable is set, therefore it is a bug in EMF+ handling.
Comment 3 Timur 2014-11-27 17:59:12 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2015-12-20 16:12:39 UTC Comment hidden (obsolete)
Comment 5 Aron Budea 2016-08-22 04:16:56 UTC
Areas are still not filled in v5.2.0.4 (Windows 7 and Linux).

Adding regression-related keywords, as it's correct in v3.5.0.3, incorrect in v3.6.0.4.
Comment 6 Bartosz 2017-05-09 01:10:38 UTC
It's looks like SetPageTransform record is not using Pixels as an unit.
Comment 7 Timur 2017-08-30 16:25:58 UTC Comment hidden (obsolete)
Comment 8 Buovjaga 2018-06-28 12:57:08 UTC
The areas are not filled in the oldest commit in Linux 43all repo. I tried advancing to the 3.5.0 release period, going forward with
git log --reverse --pretty=%H latest | grep -A 1 $(git rev-parse HEAD) | tail -n1 | xargs git checkout

..with grep -A having various steps such as 10. The areas were never filled in the 3.5.0 commits.
Comment 9 QA Administrators 2019-06-29 02:58:39 UTC Comment hidden (obsolete)
Comment 10 Ulrich Windl 2019-07-02 06:21:51 UTC
Created attachment 152497 [details]
Comparing the presentation of the example image in LibreOffice 6.1 with Inkscape 0.91

Still present in 6.1 at least.
Comment 11 BogdanB 2019-12-10 06:11:27 UTC
The same in Version: 6.3.3.2 (x64). No fill.
Build ID: a64200df03143b798afd1ec74a12ab50359878ed
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: ro-RO (ro_RO); UI-Language: en-US
Calc: threaded
Comment 12 Chris Sherlock 2019-12-18 05:47:24 UTC Comment hidden (obsolete)
Comment 13 Xisco Faulí 2019-12-18 12:54:39 UTC
(In reply to Chris Sherlock from comment #12)
> I have a feeling I may have fixed this recently:
> 
> https://git.libreoffice.org/core/commit/
> e356b371373ed6d047efac9913bc69cb2bfa0105
> 
> Needs to be tested.

The issue is still reproducible in

Version: 6.5.0.0.alpha0+
Build ID: fb1eac64df88baae9f211d052793773686c0e180
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

thus, the mentioned commit doesn't fix it
Comment 14 paulystefan 2020-03-10 21:10:14 UTC
Created attachment 158573 [details]
convert wmf in irfanview to emf file

workaround

save wmf as emf

in irfanview or other convertors

emf import is ok like in inkscape.


workaround solution for programmers in LO

convert wmf in emf with internal tool and libs and than import emf in LO
Comment 15 paulystefan 2020-03-10 21:12:22 UTC
import emf successful in LO 6.4.1.2 x64 in win 10-64
Comment 16 paulystefan 2020-06-20 19:40:11 UTC
not resolved in 7.0.0beta2x64 in win 10x64

emf is ok but fonts are not clear
Comment 17 Justin L 2021-01-16 08:14:53 UTC
No visible work done in the past year. Removing assignment statuses.
Comment 18 Valek Filippov 2021-05-15 00:18:00 UTC
Created attachment 172012 [details]
WMF file with removed 'ESCAPE' records
Comment 19 Valek Filippov 2021-05-15 00:18:39 UTC
Created attachment 172013 [details]
EMF file reconstructed from ESCAPPE records of the WMF file
Comment 20 Valek Filippov 2021-05-15 01:25:11 UTC
Created attachment 172014 [details]
EMF file reconstructed from ESCAPPE records of the WMF file with EMF+ records removed
Comment 21 Valek Filippov 2021-05-15 01:40:29 UTC
Created attachment 172015 [details]
WMF recuced to headers/eof and ESCAPE records
Comment 22 Valek Filippov 2021-05-15 02:02:23 UTC
Original file is a WMF with 6 ESCAPE records at the start of the file.
Those ESCAPE records embed EMF content into WMF.
The EMF itself has bunch of EMF+ records and according to the EmfPlusHeader in the first of them it's supposed to be "EMF/EMF+ dual" file, hence content should be the same in EMF and EMF+ records.

For the analysis the following files were created from original (#0) file:
- #1 "pure WMF" with all ESCAPE records removed
- #2 EMF/EMF+ extracted from ESCAPE records
- #3 "pure EMF" with EMF+ records removed from #2
- #4 WMF with ESCAPE records only


Observed behavior of MS Paint and PowerPoint (mac):
#0 -- all colors are presented
#1 -- all colors are presented
#2 -- all colors are missed
#3 -- all colors are presented
#4 -- empty picture

Conclusions part A:
- there is something wrong with EMF+ part inside of EMF inside of WMF
- MS Paint and PowerPoint (mac) ignore EMF/EMF+ part of the WMF file (no rendering of "ESCAPE only" #4 file, no problem with original #0 file)

Observed behavior of LO 7.2 master (May 11, 2021):
#0 -- all colors are missed
#1 -- all colors are presented
#2 -- all colors are missed
#3 -- all colors are presented except those at the bottom
#4 -- all colors are missed

Conclusions part B:
- LO tries to use (presumably superior) EMF and (presumably superior) EMF+ in it, which leads to missing colors in #0, #2 and drawing colorless image in #4
- there is another unidentified bug that prevents LO from rendering some colors for #3 ("pure EMF") file

Suggestions:
- validate behavior with those files in other MS implementations (MSO on win etc)
- change LO to ignore EMF/EMF+ in WMF files
- investigate the smaller problem with #3
Comment 23 Valek Filippov 2021-05-15 02:03:47 UTC
Created attachment 172016 [details]
Screenshot of "not-so-pure EMF" rendered by LO 7.2
Comment 24 Valek Filippov 2021-05-15 12:51:54 UTC
Created attachment 172020 [details]
Screenshot of "pure EMF" rendered by LO 7.2

My bad...
There is no problem with "pure EMF" in LO 7.2 -- I was looking into partially cleared sample.
Comment 25 Valek Filippov 2021-05-15 13:34:19 UTC
Created attachment 172021 [details]
EMF sample with few first EMF+ records removed

MS Paint/PowerPoint seems to ignore EMF+ records if EmfPlusHeader is missed, LO uses these records.
Comment 26 Valek Filippov 2021-05-15 13:39:11 UTC
Comment on attachment 172016 [details]
Screenshot of "not-so-pure EMF" rendered by LO 7.2

EmfPlusHeader is missed. There are some 'GetDC' and "FillPolygon' EMF+ records which seem to negatively impact rendering in LO.
Comment 27 Ulrich Windl 2021-05-16 18:42:07 UTC
Created attachment 172068 [details]
Updated example WMF

I noticed that a somewhat newer export of the same file (dated "Freitag, ‎25. ‎Oktober ‎2013, ‏‎20:39:42", can't remember how it had been created) opens correctly in LO Draw 7.0.4.2 (and almost correctly in GIMP 2.10.24 and Microsoft Paint (all Windows 10).
Comment 28 paulystefan 2021-05-17 13:16:49 UTC
updated WMF also ok in 7.1.3.2 win64 

workaround WMF to EMF in Irfanview is also ok.

original WMF also in 7.1.3.2 with the same limitations as before.
Comment 29 paulystefan 2021-08-06 01:21:48 UTC
updated WMF is also ok in 7.2.0.2 win64 

workaround WMF to EMF in Irfanview is also ok.

original WMF also in 7.2.0.2 with the same limitations as before.
Comment 30 Chris Sherlock 2021-08-14 21:00:39 UTC
Valet, if EmfPlusHeader is missed, should we also be ignoring the EMF+ records due to presumed corruption?
Comment 31 paulystefan 2022-06-16 22:52:00 UTC
Version: 7.3.4.2 (x64) / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL

same like in 7.2.0.2

updated WMF is also ok in 7.3.4.2 win64 

workaround WMF to EMF in Irfanview is also ok.

original WMF also in 7.3.4.2 with the same limitations as before.