Bug With stroke-linecap round and stroke-dasharray
Posted: 2014-12-08T10:07:09-07:00
I'm having an issue with drawing lines, arcs, rectangles, with dotted lines.
I have tried different versions of imagemagick, back to 6.7.7, and while the bug works a little differently, it appears in older versions as well. The only difference is at what point the round linecaps quit being drawn.
Using the latest version (6.9.0), built from source, on a Debian machine, I get these results:
command: convert -size 220x220 xc:black -draw "fill none stroke-linecap round stroke-width 4 stroke green stroke-dasharray 1,10 arc 10,10 200,200 0,360" out1.png
resulting image:
You can see that the round linecaps aren't drawn in the lower right of the image.
The bug does seem to manifest itself in the lower areas of an image. Here's a command where I draw several lines, and they look correct until I draw 128 pixels down from the top. If you change that draw command so that it draws from 10,127 to 200,127 (instead of 10,128 200,128), the round linecaps work fine.
command: convert -size 220x220 xc:black -draw "fill none stroke-linecap round stroke-width 4 stroke green stroke-dasharray 1,10 line 10,10 200,10 line 10,100 200,100 line 10,120 200,120 stroke red line 10,128 200,128 line 10,180 200,180 " out2.png
resulting image:
I did manually overlay the two images above, and it's interesting that the bug seems to start at what looks to be the same x/y point (128 from the left,128 from the top)
I would guess that this bug is somewhere in magick/draw.c, but my C skills are pretty rusty, and I didn't see anything obvious.
Any help would be appreciated.
I have tried different versions of imagemagick, back to 6.7.7, and while the bug works a little differently, it appears in older versions as well. The only difference is at what point the round linecaps quit being drawn.
Using the latest version (6.9.0), built from source, on a Debian machine, I get these results:
command: convert -size 220x220 xc:black -draw "fill none stroke-linecap round stroke-width 4 stroke green stroke-dasharray 1,10 arc 10,10 200,200 0,360" out1.png
resulting image:
You can see that the round linecaps aren't drawn in the lower right of the image.
The bug does seem to manifest itself in the lower areas of an image. Here's a command where I draw several lines, and they look correct until I draw 128 pixels down from the top. If you change that draw command so that it draws from 10,127 to 200,127 (instead of 10,128 200,128), the round linecaps work fine.
command: convert -size 220x220 xc:black -draw "fill none stroke-linecap round stroke-width 4 stroke green stroke-dasharray 1,10 line 10,10 200,10 line 10,100 200,100 line 10,120 200,120 stroke red line 10,128 200,128 line 10,180 200,180 " out2.png
resulting image:
I did manually overlay the two images above, and it's interesting that the bug seems to start at what looks to be the same x/y point (128 from the left,128 from the top)
I would guess that this bug is somewhere in magick/draw.c, but my C skills are pretty rusty, and I didn't see anything obvious.
Any help would be appreciated.