• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating drag images from NSView snapshots
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Creating drag images from NSView snapshots
      • From: Ken Tozier <email@hidden>
References: 
 >Re: Creating drag images from NSView snapshots (From: Ron Fleckner <email@hidden>)
 >Re: Creating drag images from NSView snapshots (From: Ken Tozier <email@hidden>)
 >Re: Creating drag images from NSView snapshots (From: Dominik Pich <email@hidden>)

  • Prev by Date: Re: Adding Images to a Cocoa Application in XCode
  • Next by Date: Cross NIB connections in IB
  • Previous by thread: Re: Creating drag images from NSView snapshots
  • Next by thread: Re: Creating drag images from NSView snapshots
  • Index(es):
    • Date
    • Thread