Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 28, 2007, 03:00 AM   #1
MrFusion
macrumors 6502a
 
Join Date: Jun 2005
Location: West-Europe
NSRectClip

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?

Last edited by MrFusion; Feb 28, 2007 at 03:06 AM. Reason: Accidently hit post
MrFusion is offline   0 Reply With Quote
Old Feb 28, 2007, 04:01 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
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!
robbieduncan is offline   0 Reply With Quote
Old Feb 28, 2007, 05:32 AM   #3
MrFusion
Thread Starter
macrumors 6502a
 
Join Date: Jun 2005
Location: West-Europe
Quote:
Originally Posted by robbieduncan View Post
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.
MrFusion is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

All times are GMT -5. The time now is 02:59 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC