Drawing images "selected"
Drawing images "selected"
- Subject: Drawing images "selected"
- From: Steve Gehrman <email@hidden>
- Date: Thu, 14 Mar 2002 07:31:51 -0800
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
_______________________________________________
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.