Comment 27 for bug 1405292

Revision history for this message
David Mathog (mathog) wrote :

I don't have time to work on this now. However, if somebody else wants to have a look, I think
that this may indicate a mismatch between the way the first clipping path is defined from EMF in inkscape and in Windows applications. In the file emf-print.cpp at line 1064 there is:

   rec = U_EMR_SELECTCLIPPATH_set(U_RGN_OR);

When Inkscape sees that on input it reads it as creating a new clip path (OR path with nothing is path). Perhaps EMF on windows is assuming an existing clip path at the outermost bounding rectangle for a new DC (drawing context). So in that environment the OR would do nothing, which would be consistent with the observed behavior. Perhaps U_RGN_AND is needed instead. If that is true then Inkscape's input logic will need to be special cased, so that if it sees a selectclippath record on input, and there is no existing clipping defined, AND and would define one (and for compatibility, OR would do nothing). There are 5 options in total (AND, OR, XOR, DIFF, and COPY)
defined in section 2.1.29 of the EMF manual. These are with respect to "the current clipping region". The definition for selectclippath is:

This record defines the current path as a clipping region for the
playback device context, combining the new region with any existing clipping region using the
specified mode.

I had read "any existing" to imply that one had to be explicitly created. Perhaps not, perhaps there is always clipping at the outer edges of the DC. Let me ask my contact in MS documentation and get back to you on that.

EMF clipping support in Inkscape is pretty recent and many of the possible variations are either not implemented or have not been tested well. Basically all that is supported for output conversion is a relatively simple clipping path (perhaps a join of several via OR) applied to some draw operation. It would not surprise me if I have some of the details messed up. (I'm pretty sure that the REGION mode of clipping is not working right, for instance.)