[cairo] Drawing diagonal lines with antialiasing off

Carl Worth cworth at cworth.org
Tue Oct 18 11:38:02 PDT 2005


On Wed, 28 Sep 2005 15:46:55 -0400, wrote:
> Quoting Behdad Esfahbod <behdad at cs.toronto.edu>:
> > On Wed, 28 Sep 2005, Bill Spitzak wrote:
> >
> > > Using linewidth of 0 for hairlines is well established by
> > PostScript,
> > > OpenGL, PDF, and many other graphics API's.

A linewidth of "0" giving a non-zero width result will not happen. I
don't want magic like that in cairo. That kind of thing can lead to
scaling an image down only to have lines suddenly "pop-out" again when
after they have "disappeared".

Cairo should draw precisely what it is told to draw.

> > I like having hairlines in cairo too.
> 
> I also think hairlines would be good to have.

Obviously, there's interest in a feature here. What would the
specification of the feature be? If it's "a single-device-pixel-wide
line", that's easy to get with:

	cairo_save (cr);
	cairo_set_line_width (cr, 1.0);
	cairo_stroke (cr);
	cairo_restore (cr);

If it's "a single-device-pixel-wide line, unless that's too small, in
which case it should be some real-world size instead", then there's
just a little appropriate logic needed in place of the 1.0 in the code
above.

If it's "a single-device-pixel-wide line, unless that's too small, in
which case it should be some real-world size instead, and oh, the
stroked result should always align with device-pixel boundaries", then
I think this really belongs as an application-level feature, rather
than in cairo.

If there's some other specification that I'm missing, that would
make sense in cairo, please let me know what it is.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20051018/9de25a71/attachment.pgp


More information about the cairo mailing list