Created attachment 138713 [details] Test EMF+ file in dual EMF/EMF+ format. I'm a software developer and recently added transparency support to my app using GDI+ which requires EMF+ for transparency support when exporting. Although my EMF+ images appear fine in MS Office, they aren't rendered properly in LibreOffice 5.4.4.2. I later installed 6.0 and although some issues were fixed, some things were made much worse. 1. Prior to 6.0, rotated text was rendered as horizontal text. In 6.0, the rotated text doesn't appear at all. 2. 5.4 properly renders colors with transparency. 6.0 renders colors with transparency as totally opaque. I've cobbled together some source code from MSDN that demonstrates the problems. I was originally testing the code against 5.4 so some issues have already been fixed in 6.0. Metafile metafile(L"test.emf", hdc, EmfTypeEmfPlusDual, NULL); { Graphics graphics(&metafile); SolidBrush solidBrush(Color(255, 0, 0, 255)); SolidBrush transparentBrush(Color(128, 0, 0, 255)); // 6.0 renders as opaque Pen bluePen(Color(255, 0, 0, 255)); Pen greenPen(Color(255, 0, 255, 0)); // Issue #1: 5.4 can't render bezier spline. Fixed in 6.0 graphics.DrawBezier(&bluePen, 30, 20, 80, 60, 120, 180, 140, 50); // Issue #2: 5.4 draws text but won't rotate it. 6.0 renders nothing. // Add some text (drawn with antialiasing) to the metafile. FontFamily fontFamily(L"Arial"); Gdiplus::Font font(&fontFamily, 24, FontStyleRegular, UnitPixel); graphics.SetTextRenderingHint(TextRenderingHintAntiAlias); graphics.DrawString(L"Transparent Text", 16, &font, PointF(50.0f, 50.0f), &transparentBrush); graphics.RotateTransform(30.0f); graphics.DrawString(L"Rotated Text", 12, &font, PointF(50.0f, 50.0f), &solidBrush); graphics.ResetTransform() ; GraphicsPath clip; clip.AddRectangle(Rect(150, 10, 20, 50)); graphics.SetClip(&clip); // Add an ellipse (drawn with antialiasing) to the metafile. graphics.SetSmoothingMode(SmoothingModeHighQuality); graphics.FillEllipse(&transparentBrush, Rect(150, 10, 25, 75)); graphics.ResetClip(); // Issue #3: 5.4 doesn't support ResetClip() so the following will be clipped out. Fixed in 6.0. // Avoided problem by using Save/Restore of graphics state instead. // Add a rectangle and an ellipse to the metafile. graphics.DrawRectangle(&greenPen, Rect(50, 10, 25, 75)); graphics.DrawEllipse(&greenPen, Rect(100, 10, 25, 75)); }
Hello. I am new in Windows developer, as I normally use Ubuntu. Could you please describe setup of environment step by step? Also attaching MS project will be very useful.
To be honest, I don't think it's important that you be able to run my example as the EMF file demonstrates the problem. I just provided the code to show that the problem could be produced by using basic drawing routines which is why I used Microsoft's example code rather than my own. But if you insist, I took a GDI+ project I found on codeproject.com, made minor fixes s o that the project can be built, and added the metafile creation code I provided earlier. Please note that where I placed the metafile creation code is not the proper place to do it. I just took the easy way out. I used Visual Studio 2008 on Windows 10 to create the project. I do have VS 2017 installed but haven't migrated to it yet. Just open the .sln file in Visual Studio, build it, then run it.
Created attachment 138733 [details] Visual Studio project that demonstrates problem This is a simple project that demonstrates the bug. Please note that where I placed the metafile creation code is not the correct place for it. I just wanted to demonstrate the problem with the minimal amount of effort so I took an existing project I found on codeproject.com and modified it.
Confirmed with LibreOffice 6.0.1 Could you please create multiple, small .emf files. With every file, only one issue will be visible. For example: - rotated_text.emf - transparent_text.emf I have some spare time now, and I could fix it, but it will be much easier for me, to have only one issue at file.
I've included several EMF files. rotated_text.emf --> just EMF rotated_text_plus.emf --> just EMF+ rotated_text_dual.emf --> both EMF and EMF+ transparent_text_plus --> just EMF+ transparent_text_dual.emf --> both EMF and EMF+ There is no plain EMF file for transparent text because of course plain EMF doesn't support transparency. The plain EMF file for rotated text does render properly in LibreOffice. I originally made the comment that in LibreOffice 6.0, rotated text doesn't appear at all. I don't know what's happened to my setup since I made that comment because it does appear now, it's just not rotated. I haven't updated LibreOffice since I first posted the bugs. FWIW, you can use just WordPad to see how the EMF+ files are properly rendered. Here's the updated code with all cruft removed: Metafile metafile(L"test.emf", hdc, EmfTypeEmfPlusDual, NULL); { Graphics graphics(&metafile); SolidBrush solidBrush(Color(255, 0, 0, 255)); SolidBrush transparentBrush(Color(128, 0, 0, 255)); // 6.0 renders as opaque // Add some text (drawn with antialiasing) to the metafile. FontFamily fontFamily(L"Arial"); Gdiplus::Font font(&fontFamily, 24, FontStyleRegular, UnitPixel); graphics.SetTextRenderingHint(TextRenderingHintAntiAlias); graphics.DrawString(L"Transparent Text", 16, &font, PointF(50.0f, 50.0f), &transparentBrush); graphics.RotateTransform(30.0f); graphics.DrawString(L"Rotated Text", 12, &font, PointF(50.0f, 50.0f), &solidBrush); graphics.ResetTransform() ; }
Created attachment 140255 [details] rotated text in dual EMF/EMF+ format.
Created attachment 140256 [details] rotated text in just EMF format.
Created attachment 140257 [details] rotated text in just EMF+ format.
Created attachment 140258 [details] transparent text in just EMF+ format.
Created attachment 140259 [details] transparent text in dual EMF/EMF+ format.
Review proposal for FillEllipse figures (still I need to fix unit tests): https://gerrit.libreoffice.org/#/c/50609/ I need one more file, to make sure that transparency is working correctly. Could you please create EMF+ image with FillEllipse and transparency set to some extreme values value, like: SolidBrush transparentBrush(Color(20, 0, 0, 255)); SolidBrush transparentBrushAlmostOpaque(Color(200, 0, 0, 255)); I would like to check if transparency is working correctly (Corner cases: 0 for completely transparent to 0xFF for completely opaque) Thanks.
Created attachment 140292 [details] transparent ellipses in just EMF+ format 4 ellipses with opacity of 0, 20, 200, 255 (fully opaque) from left to right.
Created attachment 140293 [details] Screeshot from displaying EMF+ files, with patches applied from Review In attachment you could find screenshot of sample EMF+ files, rendered using patched version of LO.
(In reply to Bartosz from comment #13) > Created attachment 140293 [details] > Screeshot from displaying EMF+ files, with patches applied from Review > > In attachment you could find screenshot of sample EMF+ files, rendered using > patched version of LO. Great! Is text rotation going to be fixed too?
Hi. Currently I'm working on rotation support. I need help to accomplish that. Could you please create EMF+ files, with rotated and transparent DrawDriverString record? I would like to use it for testing purposes.
Bartosz Kosiorek committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=2afdea17162731888ad8f09fae2bb50e4246d7e9 tdf#114738 Add support for transparency for EMF+ records It will be available in 6.1.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Bartosz Kosiorek committed a patch related to this issue. It has been pushed to "libreoffice-6-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=aee1904446cd0508cdf06fd23155373b5018dfed&h=libreoffice-6-0 tdf#114738 Add support for transparency for EMF+ records It will be available in 6.0.4. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to Bartosz from comment #15) > Hi. Currently I'm working on rotation support. > I need help to accomplish that. > Could you please create EMF+ files, with rotated and transparent > DrawDriverString record? > I would like to use it for testing purposes. Sorry, I got busy at work and almost forgot about this. However, I already created and uploaded rotated and transparent text test cases.
A polite ping to Bartosz Kosiorek: Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing? Thanks
There is still missing rotation support. I have added transparency support.
Bartosz Kosiorek committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/+/cd7054b5e49f435349860d55bcff5a78d14a5f67%5E%21 tdf#55058 tdf#106084 tdf#114738 EMF+ Add rotation support for String drawing It will be available in 6.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.
Hello @bugreporter70. All issues which you reported were already resolved in LO 6.2 If you are experiencing same other problems, please report new bug report. Thanks
Review for this issue: https://gerrit.libreoffice.org/#/c/62814/
Bartosz Kosiorek committed a patch related to this issue. It has been pushed to "libreoffice-6-1": https://git.libreoffice.org/core/+/1f308f95f88eeea3cbb46c78c39678c0f3860d0b%5E%21 tdf#55058 tdf#106084 tdf#114738 EMF+ Add rotation support for String drawing It will be available in 6.1.4. 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.