[cairo] Proper invocation of cairo_clip()?

Owen Taylor otaylor at redhat.com
Tue Mar 15 10:58:29 PST 2005


On Tue, 2005-03-15 at 12:39 -0600, Bob Jamison wrote:
> Hi, all.
> 
> I have been wondering how to properly call cairo_clip().
> Maybe someone could tell me what dumb mistake I am making.
> Here is where I want to grab a rect from the drawing area,
> and move it to 0,0, coding it similarly to test/clip-twice.c.
> It -seems- simple enough:
> 
> 
>     cairo_save(cairo);
>     //clip and move to 0,0
>     cairo_new_path(cairo);
>     cairo_rectangle(cairo, x, y, width, height);
>     cairo_clip(cairo);
>     cairo_translate(cairo, -x, -y);
>     //do my drawing
>     cairo_restore(cairo);
> 
> It is segfaulting 

Well, it shouldn't segfault ... so file a bug in bugzilla. 

But it probably doesn't what you want... (not exactly
sure what that is, but that call establishes a clip 
of [x,y,width,height] in device space, so after that call
"do my drawing" is going to have to draw at 2*x, 2*y to
not be clipped.)

Regards,
					Owen

-------------- 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/20050315/6d1cfb05/attachment.pgp


More information about the cairo mailing list