Skip to content

Instantly share code, notes, and snippets.

@Uncommon
Created October 11, 2013 21:09
Show Gist options
  • Save Uncommon/6942068 to your computer and use it in GitHub Desktop.
Save Uncommon/6942068 to your computer and use it in GitHub Desktop.
Tinted image
- (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];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment