On Thu, 2006-09-14 at 18:02 +0200, Michael Duelli wrote:
Hi all, recently I wrote to this list about pstricks output support. Then Rob McDonald advised me to try the MetaPost and now I actually used it a lot already. And for almost all cases it is more than sufficient (except images but I found that this is not easy solve in general with MetaPost and pixel images, this is also why I am still convinced that I somewhen will try to get pstricks to work more correctly.) Recently I stumbled across two bugs in metapost plugin, both visualized in the attached PDF file which shows three different dia figures exported to metapost. The dia files can be found in the attached tar file. The easier bug has to do with line width setting. As you can see in each of the first three figures the arrows are quite ugly when you set a line width of 0.65 and an arrowhead size of 1.20 or so. This bug comes from the plug-in using the current line width of the arrows line for the arrowhead which results in rounded edges of the arrowheads. I already wrote a patch for this which I will send to this list. It simply remembers at the end of each function whether it is going to draw a line or to fill an area in the function render_metapost.c::end_draw_op.
Shouldn't you be setting the corner style, too, to avoid rounded corners on non-filled arrows (see attached file)?
With this patch the second bug is not visible at all, but I strongly beliebe that there is a logical problem in the export plug-in which I currently don't understand. The problem occurs only if there is a thick-lined line (or arrow) as you can see that it doesn't happen in figure 4.From dia's view figure 1 and 2 only differ in bringing the firstrectangle into foreground and the second into background or vice versa. The one in the foreground has bubbles on the edges. Somehow it depends on the foreground-background order whether the plugin draws the red-filled rectangle correctly or with bubbles on the edges which then again come from a wrong line width setting used to fill the rectangle. My point is that this should not happen at all as it doesn't for the special case of figure 3 when both rectangles are in the background. Can anybody point me to where the problem could be or how background-foreground ordering comes into play in the export plugin?
So the problem is that the bubbles appear at all? I guess maybe if the line width isn't correctly reset between drawing the arrow and drawing the rectangle corners using that, we could see this effect. The order does come into play in that it determines what should be drawn on top of what, which is normally handled in lib/diagramdata.c in layer_render, but the plugin can do it itself if it wants to. If anything, it's the same or a related bug as #1, involving correct setting of line width -- or maybe some rendering functions don't do the linecap correctly. It might behoove the metapost plugin to define its own rendering for rounded rectangle, I would think it can do it better than the default (which uses quarter-arcs). -Lars
Attachment:
arrows.dia
Description: application/dia-diagram