title: NSView's Drawing Context
body: <p>Is it safe to get a NSView's CGContext from <code>-drawRect:</code> and use it to later perform more drawing? In a simple test like this one:</p>
  
  <pre><code>CGContextRef context = NULL;
  
  - (void)drawRect:(NSRect)r
  {
      if (!context)
          context = [[NSGraphicsContext currentContext] graphicsPort];
  }
  
  - (void)drawSomething
  {
      CGContextSetRGBFillColor(context, 1, 0, 0, 1);
      CGContextFillRect(context, CGRectMake (0, 0, 100, 100));
      CGContextFlush(context);
  }
  </code></pre>
  
  <p>everything seems to work when <code>-drawSomething</code> is called, but is it guaranteed that the context won't change?</p>
  
  <p>As you can see and might guess, I'm trying to bypass the standard way of drawing using <code>-drawRect:</code>. It works just nicely for a myriad of occasions, but a more procedural way of drawing would make life easier in my particular case.</p>