[cairo] Proper invocation of cairo_clip()?

Owen Taylor otaylor at redhat.com
Tue Mar 15 13:40:05 PST 2005


On Tue, 2005-03-15 at 13:50 -0600, Bob Jamison wrote:
> Thanks for the reply!
> 
> Owen Taylor wrote:
> 
> 
> >Well, it shouldn't segfault ... so file a bug in bugzilla.
> 
> Never mind.  The width param was 0.0, resulting in no traps.
>  (Maybe the function should check this?)

If you get cairo to segfault, 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.)
> >
> 
> Here is what I am trying to do: take a subrect of the drawing
> surface and use it in vacuo of the rest of the drawing, like
> a virtual drawing surface:
> 
> http://troi.hous.es3.titan.com/inkscape/files/clip-n-translate.png
> 
> Am I trying to do something out of bounds?  Maybe cairo_copy()
> has a purpose?

cairo_copy() certainly isn't related here. If you just want to
draw on a subportion of your drawable (x,y,width,height) with

 clipping to that rectangle 
 (0,0) at the upper left of that rectangle

Then your code was basically right other than the sign of 
cairo_translate() being backwards. (Think of cairo_translate
as moving the axes)

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


More information about the cairo mailing list