EMF path rendering issues

Bug #1027144 reported by David Mathog on 2012-07-20
This bug affects 1 person
Affects Status Importance Assigned to Milestone
David Mathog

Bug Description

Porting inkscape to run on libUEMF is going great - but it has turned up some problems with Inkscape path rendering.

The first problem concerns EMR_ENDPATH om emf-win32-inout.cpp. In the EMR_ENDPATH case it contains:

            tmp_path << "\"";

this must be changed to

            if(!d->path->empty()){ tmp_path << "\""; } // only terminate path if it is not empty

or the attached emf file is toxic since the trunk version results in that EMF file being converted to malformed SVG. (Sorry,
my code is so vastly diverged from trunk at this point that I can't generate a patch.)

Once that problem is fixed the next, and deeper, problem shows up. This concerns how and when Inkscape actually renders
paths, which it is doing in a manner not consistent with Windows Preview. The attached file path_test.emf does for each of
the 32 and 16 bit draw routines a series of 3 sets. These sets are, left to right:

   beginpath | drawoperation | endpath | strokeandfill

   drawoperation | strokeandfill


Images of path_test.emf from inkscape and Windows preview are attached. Differences between them are:

1. Columns 3,4,5 (from the left): Preview closes the path before stroke, Inkscape does not. Preview is correct as the
documentation for EMR_STROKEANDFILL says that it is to close the current path before drawing.

2. Column 15, top row, Inkscape fills the shape, Preview does not. That apparent difference between what happens
on the top row and the bottom row in Inkscape is because for the former the next record is EMR_BEGINPATH
whereas for the latter is is EMR_ENDEOF.

The general issue here is that the decisions for:

1. when/if to close path
2. when/if to draw

are somewhat ad hoc in Inkscape. Microsoft's EMF documentation is more than a little vague on some of these issues, and I have opened a thread in Stackoverflow asking for help in sorting out the rules. No response there yet though: http://stackoverflow.com/questions/11571044/emf-file-how-to-determine-when-to-stroke-fill

Related branches

David Mathog (mathog) wrote :
David Mathog (mathog) wrote :
jazzynico (jazzynico) on 2012-07-24
tags: added: emf importing
David Mathog (mathog) wrote :

Resolved with some compliated logic. See Bug 988601 post 12.

Kris (kris-degussem) on 2013-08-16
Changed in inkscape:
importance: Undecided → Low
status: New → In Progress
assignee: nobody → David Mathog (mathog)
su_v (suv-lp) wrote :
Changed in inkscape:
milestone: none → 0.49
status: In Progress → Fix Committed
Bryce Harrington (bryce) on 2015-02-23
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers