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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to