EMF import, diagram obscured by full page rectangle
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Medium
|
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,
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.
Related branches
tags: | added: emf importing |
Changed in inkscape: | |
assignee: | nobody → David Mathog (mathog) |
importance: | Undecided → Medium |
status: | New → In Progress |
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.