GNOME Bugzilla – Bug 308710
Brush outlines have large gaps
Last modified: 2008-01-15 12:57:16 UTC
The brush outlines have gaps that occasionally can be quite large. For instance the outlines of large circular brushes have large gaps at the diagonal directions. A pathological case is the diamond brush: At angle 0, its outline doesn't really show at all, which is kinda surprising given the simple form of the brush. I will attach a patch that greatly improves this. In most cases the outline is now drawn solid without gaps, although for some complex brushes there still are gaps. Actually, after this patch the brush outline might even be said to look *too* solid. For complex brushes with holes, it might be a good idea not to draw the holes, just the outermost boundary. I will try that.
Created attachment 48184 [details] [review] Suggested patch
There should be a local non-const variable for bound_segs. Otherwise we get a compiler warning about freeing a const variable (and we actually change a const variable which is probably worse). The outline does indeed turn out to too solid after your patch applied. I also had the impression that the rendering is slower for large and detailed brushes. This will probably need more work but if you want to get your changes into CVS, feel free to commit intermediate versions w/o approval.
Created attachment 48190 [details] [review] Improved patch I add a new GimpCanvasStyle GIMP_CANVAS_STYLE_XOR_DOTTED that uses one-pixel on-off dashes (instead of the default four-pixel dashes that XOR_DASHED uses). I draw the brush outline using XOR_DOTTED, and using gimp_canvas_draw_lines() instead of draw_segments(). The brush outline is now nicely dotted.
Hole in a brush shouldn't be neglected when drawing the outline - for really odd-shpaed "hollow" brushes, it is important to know where the holes are when you use them from stamping.
Patch committed to HEAD. 2005-06-24 Tor Lillqvist <tml@novell.com> * app/display/gimpcanvas.h: Add new GimpCanvasStyle value, GIMP_CANVAS_STYLE_XOR_DOTTED. * app/display/gimpcanvas.c (gimp_canvas_gc_new): Implement it like GIMP_CANVAS_STYLE_XOR_DASHED, except that we set the dash pattern to a single-pixel on-off one. * app/tools/gimpdrawtool.c (gimp_draw_tool_draw_boundary): Sort the boundary so that we can draw each connected group of segments using gimp_canvas_draw_lines(). (Even if we would still use gimp_canvas_draw_segments(), the boundary would have to be sorted so that the XOR drawing and GDK_CAP_NOT_LAST cooperate properly.) Use GIMP_CANVAS_STYLE_XOR_DOTTED so the outline doesn't look too heavy. Remove the dubious code snippet that offset some segments by one pixel. It didn't do what the comment claimed, and why one would need to do what the comment said, or what it actually did, is unclear. Now brush outlines shouldn't have gaps any longer. (#308710)