On 02/10/2009, at 6:39 AM, David Alter wrote:

*I have an NSImage that I would like to make a transparent version for
dragging. I have used - (void)dissolveToPoint:(NSPoint)aPoint
fraction:(CGFloat)delta to do this in the past. That appears to be getting deprecated and I would like to update my code. What is the suggested way of
doing things. I still need to support 10.4 and up.


To make a drag image from an existing image is pretty easy - just instantiate a new image of the same size and copy the first into the second, applying a value < 1.0 for fraction:


- (NSImage*)    dragImageFromImage:(NSImage*) inImage
{
        NSImage* dragImage = [[NSImage alloc] initWithSize:[inImage size]];

        [dragImage lockFocus];
[inImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:0.5];
        [dragImage unlockFocus];

        return [dragImage autorelease];
}


(warning: typed into Mail)

--Graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to