Created
October 11, 2013 21:09
-
-
Save Uncommon/6942068 to your computer and use it in GitHub Desktop.
Tinted image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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