objective c - Image of NSView with background -
I'm trying to get an image of a scene, so I'll call it I am using the How can I get an image of the whole scene, because it looks on the screen with background-color etc? NSImageView .
NSView s
bitmapImageRepForCachingDisplayInRect: method.
However, this method only returns the contents of the scene, without the window background.
Current code
- (NSImage *) imageOfView: (NSView *) View {NSiBITMAPIMJARP * Representative = [View BitMapExpressionFirstingDisplay: see.bound]; [See cache displayline: view: frame to bitmap image: representative]; Return [[NSImage alloc] initWithCGImage: [Representative CGImage] Size: view.bounds.size]; }
/ * This statement from CGDirectDisplayID Get index for display selected from array * / NSInteger displayIndex = [menu item tag]; / * Create a snapshot image of the current display. * / CGImageRef image = CGDisplayCreateImage (displays [displaysIndex]);
Comments
Post a Comment