[GRASS-dev] Re: broken polygon fills with d.vect render=l
Glynn Clements
glynn at gclements.plus.com
Wed Jun 13 11:21:08 EDT 2007
Hamish wrote:
> > I just threw up some new screenshots showing broken polygon fills with
> > d.vect render=l. What should not be filled, is partially filled.
> >
> > Look near the end of the page:
> >
> > http://bambi.otago.ac.nz/hamish/grass/bugs/d.vect/
> >
> > from those pics, and assuming we have to use the display library and
> > not the old libgis render functions, it appears that "c" would be a
> > nicer pick than "l", if the two bands of white at the edges could be
> > corrected.
>
> Another d.vect issue, in 6.3cvs the new D_line_width() forces the
> minimum line width to 1, which creates ugly jagged line output vs a line
> width of 0.
>
> This patch makes it nice again:
>
> Index: lib/display/draw2.c
> ===================================================================
> RCS file: /home/grass/grassrepository/grass6/lib/display/draw2.c,v
> retrieving revision 1.11
> diff -u -r1.11 draw2.c
> --- lib/display/draw2.c 8 Apr 2007 18:03:29 -0000 1.11
> +++ lib/display/draw2.c 13 Jun 2007 09:58:05 -0000
> @@ -847,8 +847,8 @@
> int w = round(d);
> double m;
>
> - if (w < 1)
> - w = 1;
> + if (w < 0)
> + w = 0;
>
> R_line_width(w);
I suggest:
if (w < 0)
w = 0;
R_line_width(w);
if (w < 1)
w = 1;
Otherwise, D_line_width(0) will set a clip/cull margin of zero.
> .. something is funny here. As seen in the screenshots linked above
> there is a real difference, at least in the XDRIVER output.
Notes:
1. X doesn't specify exactly which pixels are plotted when drawing
lines. In practice, the definition may be "whichever pixels the video
chip's line-drawing hardware decides to plot". IOW, the result can
vary depending upon your video hardware.
2. There can be significant differences in the behaviour of
XDrawLine() etc depending on whether the line width is zero.
Essentially, a line width of 1 results in a "thick" line while 0
results in a "thin" line. Thick lines are treated as defining a filled
area centred on the line, e.g. if a polyline intersects itself, the
intersection will only be drawn once (which is significant if using
e.g. the GXxor function).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list