Attatched WMF file is not shown correctly.

Bug #1774430 reported by Hidekazu TOZAKI
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Undecided
Unassigned

Bug Description

I got some WMF files from http://www.newviewgraphics.com/dna/dna.zip and got attached file B_DNA.wmf.
This file and other ones are not shown correctly, that means it looks different on mspaint.exe on Windows. On mspaint, I see many ellipses drawn in 4 colors, gray, yellow, blue and red, however in Inkscape 0.92.3 on Windows 7 (64bit) and 0.91 r13725 on macOS High Sierra 10.13.4, only they are all in black.

Revision history for this message
Hidekazu TOZAKI (a246246) wrote :
Revision history for this message
Alvin Penner (apenner) wrote :

confirmed on Windows 10, Inkscape 0.92.3 (2405546, 2018-03-11)

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Hidekazu TOZAKI (a246246) wrote :

So far as I could try, only mspaint and NewView Graphics File Viewer (http://www.newviewgraphics.com/viewer/viewer.htm ) --- it is free but no source is open --, can see this file in color.
LibreOffice (6.0.4) and EMF explorer (http://frazmitic.free.fr/emfexplorer/overview.htm ) shows it in black and white.

I checked B_DNA.wmf had find it has palette.
From parameter of CREATEPALETTE, it has the following 7 colors: #5f5f5f, #0000ff, #ff0000, #ffff00, #ff9900, #ff7c80, #000000, and I see many parameter patterns for CREATEBRUSHINDIRECT like [0, 0, 3, 0, 0, 1, 0, 0], [0, 0, 2, 0, 0, 1, 0, 0].
I do not know the spec of WMF in detail, but it looks yellow ellipses are written with the brush of [0, 0, 3, 0, 0, 1, 0, 0], red one are [0, 0, 2, 0, 0, 1, 0, 0] etc.
So I guess the param of CEATEBRUSHINDIRECT are treated as index color in mspaint, but as far as I see the spec of WMF https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-WMF/[MS-WMF].pdf, the ColorRef part of this operand (Brush Object (2.2.1.1)), should be a ColorRef Object (2.2.2.8) when BrushStyle (2.1.1.4) is BS_SOLID (0x0000).

Apparently, [3, 0, 0, 1] is treated as 3rd color in palette in mspaint. If I change it to [3, 0, 0, 0] (and other operand of the same kind as well), using perl (comes from MSYS2),

$ perl -pe '$/=undef; s/(\xfc\x02\x00\x00[\x01-\x03]\x00\x00)\x01\x00\x00/$1\x00\x00\x00/g;' < B_DNA.wmf > tmp.wmf

mspaint.exe and NewView.exe shows the result wmf almost in black and white, [3, 0, 0] is treated as RGB, it is almost black. (Note that as I did not change the gray ellipses in the command above, so it stays.) Though I do not know it is a spec of WMF or undocumented feature. The 4th value of the part might be DIB_PAL_COLORS (= 1) or DIB_RGB_COLORS (= 0) of LOGBRUSH https://msdn.microsoft.com/ja-jp/library/windows/desktop/dd145035(v=vs.85).aspx (Also I do not understand the spec when the palette should be used.)

I hope this will be the help.

PS: In the original file [0, 0, 255, 255, 255, 0, 0] is also used as a operand of CREATEBRUSHINDIRECT but I'm not sure where it is used.
I have no other files I could test the other operator like CREATEPENINDIRECT that takes ColorRef as a parameter as well.

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

I checked how this file is displayed with MS Office for Mac.
The results are the same (not shown correctly, whole DNA is black).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.