Re: darkening an NSIMage
Re: darkening an NSIMage
- Subject: Re: darkening an NSIMage
- From: James Chen <email@hidden>
- Date: Tue, 6 Jan 2004 17:04:27 +0800
hi,
try this
NSImage *darkImage = [image copy];
NSSize imageSize = [darkImage size];
[darkImage lockFocus];
NSRectFillUsingOperation(NSMakeRect(0, 0, imageSize.width,
imageSize.height), NSCompositeSourceIn);
[darkImage unlockFocus];
[darkImage drawInRect:targetRect fromRect:srcRect
operation:NSCompositeSourceOver fraction:1.0];
[image drawInRect: targetRect fromRect: srcRect
operation:NSCompositeSourceOver fraction:.6666];
[darkImage release];
Maybe there's another way more straightforward but it works anyway,
hope this helps,
James
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On Jan 6, 2004, at 1:42 PM, 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.