Re: Drawing images "selected"
Re: Drawing images "selected"
- Subject: Re: Drawing images "selected"
- From: David Remahl <email@hidden>
- Date: Thu, 14 Mar 2002 16:43:07 +0100
>
I'm trying to draw an image (an icon) with a selected look. I was able
>
to get something working, but the results don't look as good as the
>
Finder. The icon is drawn gray, but the details of the icon are made
>
fuzzy.
>
>
Anyone know the optimal way of doing this? I think there is a Carbon
>
call to do this. Is there a Cocoa way?
>
>
Here's the code I'm using now.
>
>
{
>
NSSize iconSize = [icon size];
>
NSRect iconRect = {NSZeroPoint, iconSize};
>
id im = [[NSImage alloc] initWithSize: iconSize];
>
>
[im lockFocus];
>
>
[icon drawInRect:iconRect fromRect:NSZeroRect
>
operation:NSCompositeCopy fraction:1.0];
>
[[[NSColor grayColor] colorWithAlphaComponent:0.7] set];
>
NSRectFillUsingOperation(iconRect, NSCompositeSourceAtop);
>
>
[im unlockFocus];
>
>
return im;
>
}
>
>
-steve
Allow me to point you to this thread:
<
http://cocoa.mamasam.com/COCOADEV/2001/07/2/3930.php>
/ 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.