[cairo] Proper invocation of cairo_clip()?

Bob Jamison rjamison at titan.com
Tue Mar 15 14:04:45 PST 2005


Owen Taylor wrote:

>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
>
>  
>
I filed the bug (if it's a bug).

And removing the '-' worked great.
I had assumed it was shifted the other way, from the old days
of using OpenGL.  Bad habits.

All is working fine now.  Thanks!


Bob




More information about the cairo mailing list