SameBoy/Cocoa/GBTintedImageCell.m

21 lines
428 B
Mathematica
Raw Normal View History

2022-10-30 12:42:54 +00:00
#import "GBTintedImageCell.h"
@implementation GBTintedImageCell
- (NSImage *)image
{
if (!self.tint || !super.image.isTemplate) {
return [super image];
}
NSImage *tinted = [super.image copy];
[tinted lockFocus];
[self.tint set];
NSRectFillUsingOperation((NSRect){.size = tinted.size}, NSCompositeSourceIn);
[tinted unlockFocus];
tinted.template = false;
return tinted;
}
@end