Created
March 19, 2009 19:51
-
-
Save danielpunkass/82016 to your computer and use it in GitHub Desktop.
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
@implementation NSImage (RSShading) | |
- (NSImage *) tintedImage | |
{ | |
NSImage* newImage = [[[NSImage alloc] initWithSize:[self size]] autorelease]; | |
NSRect imageRect = {NSZeroPoint, [self size]}; | |
NSColor *color = [NSColor blackColor]; | |
[newImage lockFocus]; | |
[[color colorWithAlphaComponent: 0.25] set]; | |
[self compositeToPoint:NSZeroPoint operation:NSCompositeCopy]; | |
NSRectFillUsingOperation (imageRect, NSCompositeSourceOver); | |
[newImage unlockFocus]; | |
return (newImage); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment