[cairo] Clipping and stroking

Owen Taylor otaylor at redhat.com
Tue May 10 18:17:34 PDT 2005

On Fri, 2005-04-29 at 19:25 -0400, Owen Taylor wrote:

> To make them usefully pixel aligned and in device coordinates 
> you want to do something like:
>  cairo_save (cr);
>  cairo_identity_matrix (cr);
>  cairo_stroke_extents (cr, &x1, &x2, &y1, &y2);
>  cairo_restore()
>  x1 = floor (x1);
>  x2 = ceiling (x2);
>  y1 = floor (y1);
>  y2 = ceiling (y2);

Turns out that this doesn't quite work. Stroking is different, since
the line width is interpreted relative to the CTM.

Given cairo_stroke_to_path(), you could do that and then 
cairo_fill_extents().... other than that, you'd need to do
some approximations.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050510/02e43314/attachment.pgp

More information about the cairo mailing list