Re: How to highlight an image with transparency [SOLUTION]
Re: How to highlight an image with transparency [SOLUTION]
- Subject: Re: How to highlight an image with transparency [SOLUTION]
- From: Andrew Platzer <email@hidden>
- Date: Wed, 16 Jan 2002 13:23:10 -0800
On Monday, January 14, 2002, at 05:10 , John Blackburn wrote:
With Andrew's instruction, here's a working result:
...
-(void)drawImage:(NSImage*)theImage atPoint:(NSPoint)where
asSelected:(BOOL)selected
{
On Monday, January 14, 2002, at 01:04 PM, Andrew Platzer wrote:
On Monday, January 14, 2002, at 12:25 , John Blackburn wrote:
What's the proper composite for highlighting an image which contains
transparency? NSCompositePlusDarker seems the logical choice, but it
draws black for transparent pixels in the image. I've tried all of the
combinations of the composite modes I can think of, but none work
exactly right. I just want to highlight arbitrarily-shaped image just
as Finder does with icons.
Try NSCompositeSourceAtop with black at 50% alpha.
I would suggest keeping the darkened image around between calls to
drawRect: since creating a cached image rep involves creating an offscreen
window, drawing, etc. A lot of overhead that can be avoided.
Andrew