That does the trick. Thanks!

On Aug 29, 2009, at 11:35 PM, Brandon Walkin wrote:

I have a category on NSImage that should do what you need:

- (NSImage *)tintedImageWithColor:(NSColor *)tint
{
        NSSize size = [self size];
        NSRect imageBounds = NSMakeRect(0, 0, size.width, size.height);

        NSImage *copiedImage = [self copy];
        
        [copiedImage lockFocus];
        
        [tint set];
        NSRectFillUsingOperation(imageBounds, NSCompositeSourceAtop);
        
        [copiedImage unlockFocus];

        return [copiedImage autorelease];
}

Brandon

On 2009-08-29, at 2:36 PM, Mitchell Livingston wrote:

Hello,

I want to use NSImage's built-in template images, but want to replace the black color with different colors, such as gray or orange. I feel like I'm missing something obvious, but I can't seem to figure this out. Could someone point me in the right direction.

Thanks,
Mitch
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/bwalkin%40gmail.com

This email sent to bwal...@gmail.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to