Re: Capturing portion of an NSView for drag-and-drop image
Re: Capturing portion of an NSView for drag-and-drop image
- Subject: Re: Capturing portion of an NSView for drag-and-drop image
- From: Andrew Platzer <email@hidden>
- Date: Fri, 18 May 2001 12:38:00 -0700
On Friday, May 18, 2001, at 09:34 , Brad Werth wrote:
I'm trying to implement drag-and-drop functionality between two
NSMatrixes. I would like to take a "snapshot" of the visual state of a
NSCell to use as the dragging image. I couldn't find a way to just get
an NSImage * from anything, but it seemed like one of the following
methods of NSView would do it for me:
Usual way:
NSImage* image;
NSBitmapImageRep* rep;
[view lockFocus];
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[view bounds]];
[view unlockFocus];
image = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease];
[image addRepresentation:rep];
[rep release];
Andrew
__________________________________________________________________
A n d r e w P l a t z e r
A p p l i c a t i o n F r a m e w o r k s
A p p l e