Bug 101639 - [EMF] FILEOPEN Missing hatch style implementation (=pattern) (Comment 19)
Summary: [EMF] FILEOPEN Missing hatch style implementation (=pattern) (Comment 19)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: interoperability
Keywords: bibisected, bisected, filter:emf
Depends on:
Blocks: EMF-WMF
  Show dependency treegraph
 
Reported: 2016-08-21 15:42 UTC by Oliver Sander
Modified: 2024-02-23 03:14 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
The .doc file in question (74.00 KB, application/msword)
2016-08-21 15:42 UTC, Oliver Sander
Details
File as rendered by MS Office (25.58 KB, application/pdf)
2016-08-21 15:43 UTC, Oliver Sander
Details
The file as rendered by LO 5.2.0.4 (525.36 KB, application/pdf)
2016-08-21 15:45 UTC, Oliver Sander
Details
.doc file with inserted .emf image (181.50 KB, application/msword)
2016-09-21 08:27 UTC, Ákos
Details
Image with wrong pattern extracted from .doc file. (13.77 KB, image/emf)
2018-08-27 11:49 UTC, Bartosz
Details
Pattern selection in LibreOffice Writer (46.16 KB, image/png)
2019-12-22 08:55 UTC, Bartosz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Sander 2016-08-21 15:42:26 UTC
Created attachment 126939 [details]
The .doc file in question

I have a .doc file which contains an image (some sort of WMF, if I am not mistaken).  Instead of this image, only a purplish rectangle is shown by LibreOffice 5.2.0.4.
Comment 1 Oliver Sander 2016-08-21 15:43:46 UTC
Created attachment 126940 [details]
File as rendered by MS Office
Comment 2 Oliver Sander 2016-08-21 15:45:09 UTC
Created attachment 126941 [details]
The file as rendered by LO 5.2.0.4
Comment 3 Aron Budea 2016-08-22 04:20:25 UTC
There are two parts to this issue:

1. Rectangle is displayed instead of WMF.

Reproduced in v4.4.0.3, looks more or less okay (see 2.) in v4.3.0.4 / Windows 7. => regression


2. Dotted pattern is not shown in the last column.

This was never correct (the whole document does not open correctly in v3.3, and does in v3.5, but the patterns are not shown).


There might be duplicate reports on either of these, but it's quite difficult to track them down.
Comment 4 Alex Thurgood 2016-08-22 08:36:58 UTC
I believe Chris Sherlock did some work on some of the other EMF bugs, he might have an idea.
Comment 5 Xisco Faulí 2016-08-27 13:15:25 UTC
Purple rectangle regression introduced in range 4011b74eb7650a0eeb99d3acebb9ef60b0fcaab9..274b628a2b523eb45e297352a85f0177c6e747f0
Comment 6 Aron Budea 2016-09-01 04:06:44 UTC Comment hidden (bibisection)
Comment 7 Aron Budea 2016-09-01 04:13:22 UTC
Since both of the commits are related to Michael Stahl, CC-ing him.
Michael, please take a look.

The commits don't look much related, but the bibisection/bisection clearly points there.

Commits:
"SchLayoutTabPage: that ctor wants a pointer"
https://cgit.freedesktop.org/libreoffice/core/commit/?id=2d226f4c0b3f95bfdfe7bdcd3fd0ab87a806f4c3

"Repository.mk: cluster the mobile-only stuff together"
https://cgit.freedesktop.org/libreoffice/core/commit/?id=8d3fc64066b157d2e24df57635000f121915793a
Comment 8 Michael Stahl (allotropia) 2016-09-01 08:57:09 UTC
reading comment #7 it must be caused by one of these then:

commit 6ca69fc429c45890f23e622b3591b81074d3d9ba
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Sat Jul 19 22:12:04 2014 +0200

    bnc#881024 test font size at world transform
    
    Change-Id: If9b09b69ccd890e45d963422ccedb711585f6434

commit a34e2e08b6976613253a6caa737dbc191b56e372
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Sat Jul 19 21:57:19 2014 +0200

    emf+: recognise some more object types
    
    Change-Id: I33fec62e4bc38eeaf014eeb1210db2904af033f6

commit f97c5397f0784ab6e4dd3b8f59bcffd21f13d1af
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Sat Jul 19 21:52:09 2014 +0200

    emf+: emulate hatch with color blend
    
    Change-Id: I2ac8f790c79c269d4c1fa650e703c3645c567ca4

commit cd3bffed33db9e847b4db99cc1220aa6f25f65ec
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Sat Jul 19 21:50:27 2014 +0200

    xmlwriter: set indent and always write utf8 xml document
    
    Change-Id: I1477833e696edbac2dc375329e7b26a7105d1593

commit 501f6b050b8309f54e2842a26f6a3d95a859ffb7
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Sat Jul 19 21:48:46 2014 +0200

    Support color related MTF actions in mtfxmldump
    
    Change-Id: I5deac7f096866a8f149acfd0d11bbc0963238e88


commit 816f4be79c3847fac8d31bf0b63180e1468c7109
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Fri Jul 18 13:36:59 2014 +0200

    bnc#881024 Handle 0 font height just like outdev & drawinglayer
    
    Change-Id: I80055e4101873e0ddd408ac1f0ee9c75cc3bf6b3

commit 8f705df1221c3f92d8cde68bdf726a7c3ce8fe1b
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Fri Jul 18 13:36:13 2014 +0200

    bnc#881024 Don't world transform font size in WMF/EMF import
    
    Change-Id: Ia865b84ee2b159ff7251ab5a769a2b635dd2a1ea

commit 88d1d90fb785093bee448353d2978e86bb953b2f
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Fri Jul 18 10:19:16 2014 +0200

    Also add xmlwriter's "content" method to the header file
    
    Change-Id: Ic3e13e89480e3b18f84c3a8fd1a88627bd465d6a

commit cef094efd7641dc3b6c1984fd701cd133d44067f
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Fri Jul 18 10:15:10 2014 +0200

    emf+: Log type name instead of the type number
    
    Change-Id: I5c4f7c5713a559815bd46328907673d114fee011

commit 317f154de7cf26a88e82008c895dbb0a840d5646
Author:     Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
AuthorDate: Fri Jul 18 10:09:14 2014 +0200

    Extend metafile to xml dump testing tool with more MFT actions
    
    Change-Id: I819de476c6a615b8cf27a6a26d41a6e9ac25ef85
Comment 9 Ákos 2016-09-21 08:27:39 UTC Comment hidden (obsolete)
Comment 10 Ákos 2016-09-21 08:56:52 UTC Comment hidden (obsolete)
Comment 11 Xisco Faulí 2016-09-26 15:09:40 UTC Comment hidden (obsolete)
Comment 12 Oliver Sander 2016-10-21 18:14:32 UTC
Reproduced in

LibreOfficeDev 5.3.0.0.alpha1 f4ca1573fcf445164c068c1046ab5d084e1b005f
Comment 13 Patrick Jaap 2017-03-16 08:20:36 UTC Comment hidden (obsolete)
Comment 14 Patrick Jaap 2017-03-16 08:22:52 UTC Comment hidden (obsolete)
Comment 15 Bartosz 2017-05-08 23:22:52 UTC
Hello Patrick.
Do you know where I could find missing pattern which needs to be implemented?
Comment 16 Patrick Jaap 2017-05-09 06:03:25 UTC
Hi Bartosz!

The missing hatch style (=pattern) implementation is found in 
cppcanvas/source/mtfrenderer/emfplus.cxx Line 335 etc.

The EMF+ Documentation 
https://msdn.microsoft.com/en-us/library/cc230724.aspx (keyword: "hatchstyle")
does not tell you how the patterns should look exactly, unfortunately.

I hope this helps a little :)

Regards,
Patrick
Comment 17 Bartosz 2017-05-15 22:08:36 UTC
Hi Patrick.
Unfortunately I cannot notice any mentioned issues which was described.
Could you please create some screenshot, and mark the difference between MS Office and LibreOffice 5.4alpha?

It will help resolving that bug.
Comment 18 Patrick Jaap 2017-05-16 07:58:36 UTC
Hi Bartosz,

I just opened the .doc file with the latest 5.4alpha build (Build-ID 666901bc82fab69f9a80b564f97b5456d0ef684e) from 05/16. 

The last EMF picture still looks exactly the same as the render from LO 5.2.0.4: There is just a pink rectangle shown. If you apply my suggestion

https://gerrit.libreoffice.org/#/c/34274/

you will see the actual EMF image. My patch causes wrong information in most cases, therefore it is not accepted by reviewers.
Comment 19 Patrick Jaap 2017-08-24 08:49:21 UTC
With the new EMF+ Renderer the purple rectangle bug is fixed in current master! The 4 charts are now completely visible.

Missing patterns are still not correctly implemented. They are currently replaced by a little brighter color.
Comment 20 QA Administrators 2018-08-26 02:39:07 UTC Comment hidden (obsolete)
Comment 21 Patrick Jaap 2018-08-27 10:44:07 UTC
The bug is still present. The emf-plus renderer rewrite resolved the bug that the last image was not shown at all. 

Situation now is a missing pattern in the last picture. Currently, LO "emulates" the pattern by shifting the color a bit into gray. 

Since I cannot find any detailed specification about the patterns to be drawn, I cannot implement this feature. 

Code needs to be implemented in drawinglayer/source/tools/emfphelperdata.cxx:548 pp (it will be ported to "emfio" module in the future, I have this still on my TODO list)
Comment 22 Bartosz 2018-08-27 11:49:13 UTC
Created attachment 144479 [details]
Image with wrong pattern extracted from .doc file.
Comment 23 Chris Sherlock 2019-12-21 19:50:46 UTC
I know this might seem odd, but this is sort of working. The reason that this is a purplish background is because we are actually blending the colours to create the hatch. 

The hatch being used in the EMF is HatchStyle70Percent. According to the EMF+ specs, in actual fact this is "HatchStyle70Percent: Specifies a 70-percent hatch, which is the ratio of foreground color to background color equal to 70:100."

Nevertheless, I wouldn't consider this fully fixed yet, because in fact we haven't implemented any hatches other than the blending hatches. 

The code in question will need to be implemented in EmfPlusHelperData::EMFPPlusFillPolygon(). The best way of implementing it would be as a drawinglayer 2D primitive.
Comment 24 Bartosz 2019-12-22 08:55:10 UTC
Created attachment 156727 [details]
Pattern selection in LibreOffice Writer

The patterns are fully supported by LibreOffice (see attached screenshot), so the implementation could be reused. The only question how to access to it, to be able to display it properly.
Comment 25 Chris Sherlock 2019-12-25 01:47:10 UTC
I have a partial solution - doesn't deal with the blending issue (that will be for later when I work out how to create hatch primitives!). But I have fixed the non-hatching or horizontal, vertical, forward diagnoal, backward diagonal, large grid and diagonal cross. 

Still needs polish, but submitting early for review.
Comment 26 Chris Sherlock 2019-12-25 01:48:55 UTC
Oh... forgot that gerrit was down. Will submit this when it is back.
Comment 27 Chris Sherlock 2019-12-25 10:45:49 UTC
See https://gerrit.libreoffice.org/c/core/+/85669 for partial implementation of hatch fills.
Comment 28 Xisco Faulí 2020-07-22 15:24:21 UTC Comment hidden (obsolete)
Comment 29 Bartosz 2021-05-11 20:21:45 UTC
Information how to create HatchPrimitive is here: https://docs.libreoffice.org/drawinglayer.html
Comment 30 QA Administrators 2024-02-23 03:14:43 UTC
Dear Oliver Sander,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug