[cairo] Drawing diagonal lines with antialiasing off

Carl Worth cworth at cworth.org
Tue Oct 18 11:41:14 PDT 2005


On Tue, 27 Sep 2005 10:55:37 +0200, Øyvind Kolås wrote:
> On 9/27/05, Jordi Mas <jordi at ximian.com> wrote:
> >
> > When turning off the antialiasing (CAIRO_ANTIALIAS_NONE) and drawing a
> > vertical line, it gets rendered as two pixel width instead of one.
> > Is there any way using a cairo function to override this behaviour?
> >
> > I'm attaching a very simple case to reproduce the issue and the
> > generated image.
> 
> Your issue is very related to the first entry in the FAQ[1]. Changing
> your code to:
> 
>   ...
>   cairo_move_to (cr, 5.0, 5.5);
>   cairo_move_to (cr, 10.0, 10.5);
>   ...
> 
> Will render the image you expect.

I think there's another issue here. The rounding rules for
rasterization of trapezoids to an A1 mask should yield a 1-pixel-wide
result even with the original code.

I think that details of non-antialiased rendering just haven't been
dealt with very carefully yet. (Personally, I've been leaving the work
to improve the quality of that drawing to those who care more about
it.)

-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/aee4b1d7/attachment.pgp


More information about the cairo mailing list