Skip navigation.
 
mlRe: NSBezierPath clipRect confusion
FROM : R. Scott Thompson
DATE : Wed Nov 03 23:00:00 2004

> I'm trying to use NSBezierPath's clipRect method to help me draw
> within a rectangle, it works OK, but I can't seem to turn off the
> clipping path so I can continue drawing as normal.
>
> I've used
> [NSBezierPath clipRect:ClipRect];
>  to create the path, I do my drawing, this works nicely, but then I
> want to continue drawing outside the clipping path, which I can't
> figure out how to do.
>
> I've tried wrapping the clipped drawing bit in save/restore graphics
> state, but no joy.
>
> Can anyone point out a good example of how to turn the clipping path
> off?


The right way to do it is with the save and restore:

[NSGraphicsContext saveGraphicsState];
[NSBezierPath clipRect: clipRect];

... additional drawing here ...
[NSGraphicsContext restoreGraphicsState];

... non-clipped drawing here ...

If the save and restore are not working for you then perhaps we should
see a larger snippet of your code.

Scott

Related mailsAuthorDate
mlNSBezierPath clipRect confusion Moray Taylor Nov 3, 21:57
mlRe: NSBezierPath clipRect confusion R. Scott Thompson Nov 3, 23:00
mlRe: NSBezierPath clipRect confusion Moray Taylor Nov 3, 23:20