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

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.

References: 
 >Drawing images "selected" (From: Steve Gehrman <email@hidden>)

  • Prev by Date: Re: Advice on offscreen drawing.
  • Next by Date: Re: Why the name Cocoa?
  • Previous by thread: Drawing images "selected"
  • Next by thread: Re: Why the name Cocoa?
  • Index(es):
    • Date
    • Thread