Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
Hey,

There is not much info that I can find about NSRectClip.
I have a NSRect given to me by
Code:
- (void)drawRect:(NSRect)rect
In this rect, I determine my own NSRect to draw in, which works fine. But after this I want to make extra drawings in the larger "rect". So I am looking for an undo for NSRectClip, or some way to set the drawingarea back to its original area.

Is this possible?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
The documentation does appear to be sparse. Have you tried saving the Graphics Context state and restoring it.

So something like:

Code:
NSGraphicsContext *context = [NSGraphicsContext currentContext];
[context saveGraphicsState];

// Do your NSRectClip and drawing....

[context restoreGraphicsState];

// Do more drawing

Note I'm on a PC at work so can't test this...


Edit to add: that should work. It is actually in the conceptual documentation!
 

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
The documentation does appear to be sparse. Have you tried saving the Graphics Context state and restoring it.

So something like:

Code:
NSGraphicsContext *context = [NSGraphicsContext currentContext];
[context saveGraphicsState];

// Do your NSRectClip and drawing....

[context restoreGraphicsState];

// Do more drawing

Note I'm on a PC at work so can't test this...


Edit to add: that should work. It is actually in the conceptual documentation!

Thanks, that works.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.