• 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
NSTableView and NSImageCell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView and NSImageCell


  • Subject: NSTableView and NSImageCell
  • From: David Dauer <email@hidden>
  • Date: Mon, 12 Apr 2004 09:13:17 +0200

Hello,

I want to draw a badge over and image that I load into my table. The strange
thing is, that when I do [NSImageView setImage:myImageWithBadge];
(myimageBithBadge created in awakeFromNib) it displays the image WITH badge
correctly. In my tableview datasource I use "return myImageWithBadge", I
only get the image without the overlayed badge image.

The code:

@implementation NSImage (NSImageAdditions)

- (void)applyBadge:(NSImage *)badge withAlpha:(float)alpha
{
NSImage *badgeImage;
badgeImage = [[badge copy] autorelease];

[self lockFocus];

[[NSGraphicsContext currentContext]
setImageInterpolation:NSImageInterpolationHigh];

[badgeImage drawAtPoint:NSMakePoint([self size].width - [badgeImage
size].width,0)
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:alpha];

[self unlockFocus];
}

@end

- (void)awakeFromNib
{
tempImage = [[NSImage imageNamed:@"normalImage"] copy];
[tempImage applyBadge:[NSImage imageNamed:@"badge"] withAlpha:0.75];
[theImageView setImage:tempImage];
}

Thanks for any suggestion

David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSTableView and NSImageCell
      • From: Fritz Anderson <email@hidden>
    • Re: NSTableView and NSImageCell
      • From: Stéphane Sudre <email@hidden>
  • Prev by Date: Safe way to read/write plist
  • Next by Date: Getting started with cocoa
  • Previous by thread: Re: Safe way to read/write plist
  • Next by thread: Re: NSTableView and NSImageCell
  • Index(es):
    • Date
    • Thread