Re: darkening an NSIMage
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.