In your NSView subclass:[self lockFocus]; NSBitmapImageRep *bits; bits = [[NSBitmapImageRep alloc] initWithFocusedViewRect: [self bounds]]; [self unlockFocus];Then you can add it to an
NSImageor save it to a file, or whatever.
If you want to retain the vectoritude of the drawing, you can use
[self dataWithPDFInsideRect: [self bounds]], and then make an
NSPDFImageRep. Avoid the
NSEPSImageRepsince it makes a trip through
NSPDFImageRepalong with a slow PS to PDF conversion. (Thanks to Peter Hosey for the PDF hint)