• 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: darkening an NSIMage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: darkening an NSIMage


  • Subject: Re: darkening an NSIMage
  • From: Stephane Sudre <email@hidden>
  • Date: Tue, 6 Jan 2004 11:16:24 +0100

Other code:

+ (NSImage *) darkenImage:(NSImage *) inImage
{
NSImage * tImage;
NSRect tRect;

tRect.size=[inImage size];

tImage=[[NSImage alloc] initWithSize:tRect.size];

[tImage lockFocus];

[[NSColor colorWithDeviceWhite:0.0f alpha:0.5f] set];

tRect.origin=NSZeroPoint;

[inImage compositeToPoint:NSZeroPoint operation:NSCompositeCopy fraction:1.0f];

NSRectFillUsingOperation(tRect,NSCompositeSourceAtop);

[tImage unlockFocus];

return [tImage autorelease];
}

On Tuesday, January 6, 2004, at 06:42 AM, Nicholas Francis wrote:

Hi guys... a really dumb question here:

I would like to draw a darkened version of an image (like ButtonCells do when they are highlighted). How do I do this? I just can't find the function...

Do I really have to go in and fiddle around with the pixel values in order to respect the image's alpha channel?

TIA
Nicholas
_______________________________________________
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.
_______________________________________________
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.

References: 
 >darkening an NSIMage (From: Nicholas Francis <email@hidden>)

  • Prev by Date: Re: NSPro UI clone?
  • Next by Date: TableColumn identifiers
  • Previous by thread: Re: darkening an NSIMage
  • Next by thread: Re: Red button close
  • Index(es):
    • Date
    • Thread