Grabbing a view into an image (NSView->General)In your NSView subclass:[self lockFocus]; NSBitmapImageRep *bits; bits = [[NSBitmapImageRep alloc] initWithFocusedViewRect: [self bounds]]; [self unlockFocus];Then you can add it to anNSImageor 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 anNSPDFImageRep. Avoid theNSEPSImageRepsince it makes a trip throughNSPDFImageRepalong with a slow PS to PDF conversion. (Thanks to Peter Hosey for the PDF hint)