I used the NSGradient method -drawFromCenter: radius: toCenter: radius: options: to draw a gradient in an NSView subclass' drawRect: method. When I do this, the drawing is correctly clipped to the subclass' rect. This works when I'm drawing to the screen or printing but when I save the document to a file, getting an image from the view's superview, the gradient is not clipped to my NSView's rect. I have to draw the gradient instead using -drawInRect: relativeCenterPosition: instead to make it clip correctly. I was surprised to see this because I thought that Cocoa would correctly clip the drawing to the current context for me automatically.Why would this happen?