Re: Cocoa replacement for Carbon CompositeIconRef() for Snow Leopard 64-bit apps?
Re: Cocoa replacement for Carbon CompositeIconRef() for Snow Leopard 64-bit apps?
- Subject: Re: Cocoa replacement for Carbon CompositeIconRef() for Snow Leopard 64-bit apps?
- From: Graham Cox <email@hidden>
- Date: Wed, 28 Oct 2009 17:00:15 +1100
On 28/10/2009, at 4:49 PM, Peter N Lewis wrote:
So in order to convert from using IconRef to using NSImage for
everything (after loading the IconRef), I need to know how to:
a) composite two images, preferably while keeping the different
resolutions of the icon
b) how to dim an image similarly to kTransformDisabled
Any suggestions?
Google didn't find much useful for either NSImage & compositing or
NSImage & kTransformDisabled.
I'm unclear what you mean by a), but certainly compositing NSImage
into another one or into a view/context is trivial.
On b), you'd probably have to experiment but I would bet that a
straightforward combination of the compositing operation and the alpha
value would achieve this. It's been a good long while since I wrote
anything in Carbon, but I seem to recall that the disabled look was a
lowered contrast, semi-grayed appearance. If that's the case, you can
easily get that using the above.
In both cases the method to use is -
drawInRect:fromRect:operation:fraction:
Once you've determined the magic numbers, it would be easy to add an
NSImage category to draw them using the same icon drawing constants
used for IconRefs.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden