Re: Creating drag images from NSView snapshots
Re: Creating drag images from NSView snapshots
- Subject: Re: Creating drag images from NSView snapshots
- From: Dorian Johnson <email@hidden>
- Date: Sun, 1 Jul 2007 14:51:21 -0500
On Jul 1, 2007, at 10:12 AM, Dominik Pich wrote:
I'd say for transpranecy you gotta DRAW for real!?
If not, plz, enlighten me :)
Regards,
Dominik
Yes (as far as I know). Here's the category I use for this purpose.
Simple but saves a lot of duplicate code.
@implementation NSImage (DJAdditions)
- (NSImage *)imageWithFraction:(float)fraction
{
NSImage *newImage = [[[NSImage alloc] initWithSize:[self size]]
autorelease];
[newImage lockFocus]; {
[self drawAtPoint:NSZeroPoint fromRect:(NSRect){NSZeroPoint, [self
size]} operation:NSCompositeSourceOver fraction:fraction];
} [newImage unlockFocus];
return newImage;
}
@end
- Dorian
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden