EMF import, diagram obscured by full page rectangle

Bug #1243937 reported by David Mathog on 2013-10-23
This bug affects 1 person
Affects Status Importance Assigned to Milestone
David Mathog

Bug Description

Some EMF files seen in the wild draw normally except that at the very end they draw a page sized rectangle over everything, obscuring the diagram. The cause of this has now been ascertained (at least for all the test files on hand) and the attached patch resolves the issue.

What happens, apparently, is that some graphics application write this sort of record at the end of the file, just before closing it:

U_EMR_BITBLT record: 2086 type: 76 offset: 87720 size: 100
   rclBounds: {0,0,634,803}
   Dest: {0,0}
   cDest: {635,804}
   dwRop : 0x00AA0029
   Src: {0,0}
   xformSrc: {1.000000,0.000000.0.000000,1.000000,0.000000,0.000000}
   crBkColorSrc: {0,0,0}
   iUsageSrc: 0
   offBmiSrc: 0
   cbBmiSrc: 0
   offBitsSrc: 0
   cbBitsSrc: 0

The rectangular area corresponds to the entire draw surface, and the ROP 0x00AA0029 corresponds to "D" = "destination", meaning, basically, that whatever was already present in the graphic should still be there. My best guess at this point is that this is the GDI equivalent of an fflush(). The problem is that Inkscape tries to do its best to draw bitblts as rectangle objects, so even if it is not exactly right, the end user can tell that the program tried to draw something of that shape. That is not the appropriate thing to do here. The patch cuts in early on BITBLT and related records, and when it sees one with this ROP value, it just ignores it.

David Mathog (mathog) wrote :
David Mathog (mathog) wrote :

This example illustrates the problem. Prior to the patch #1 a large white rectangle is drawn over everything. After the post is applied that rectangle is entirely omitted.

David Mathog (mathog) wrote :

Should have been "patch is applied"

su_v (suv-lp) on 2013-10-23
tags: added: emf importing
su_v (suv-lp) on 2013-10-23
Changed in inkscape:
assignee: nobody → David Mathog (mathog)
importance: Undecided → Medium
status: New → In Progress
su_v (suv-lp) wrote :

Patch tested with r12715 on OS X 10.7.5 and fix confirmed using test files from these reports:
- Bug #217231 (Figure10.emf),
- Bug #382420 (Line Graph.emf)
- Bug #382421 (Percentage Graph.emf)
- Bug #383180 (Shape Graph.emf)
- Bug #481242 (sh1.emf)

(list of test files taken from the list here:

su_v (suv-lp) wrote :

Fix committed in r12720 - thx for the patch!

Changed in inkscape:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers


Bug attachments