• 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: Applying color to template images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applying color to template images


  • Subject: Re: Applying color to template images
  • From: Mitchell Livingston <email@hidden>
  • Date: Sun, 30 Aug 2009 10:53:00 -0400

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 (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


_______________________________________________

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


References: 
 >Applying color to template images (From: Mitchell Livingston <email@hidden>)
 >Re: Applying color to template images (From: Brandon Walkin <email@hidden>)

  • Prev by Date: Async NSURLConnection + Concurrent NSOperation = Not possible under Mac OS X 10.6?
  • Next by Date: Re: Async NSURLConnection + Concurrent NSOperation = Not possible under Mac OS X 10.6?
  • Previous by thread: Re: Applying color to template images
  • Next by thread: Testing localizations in 10.6
  • Index(es):
    • Date
    • Thread