• 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
Drawing images "selected"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Drawing images "selected"
      • From: David Remahl <email@hidden>
  • Prev by Date: Re: preventWindowOrdering
  • Next by Date: Re: Why the name Cocoa?
  • Previous by thread: Re: Why the name Cocoa?
  • Next by thread: Re: Drawing images "selected"
  • Index(es):
    • Date
    • Thread