Skip to content

Instantly share code, notes, and snippets.

@steveatinfincia
Last active August 29, 2015 14:07
Show Gist options
  • Save steveatinfincia/9c4a281d1432594152e8 to your computer and use it in GitHub Desktop.
Save steveatinfincia/9c4a281d1432594152e8 to your computer and use it in GitHub Desktop.
Codepoints 1.0.4
-(void)drawBackgroundInRect:(NSRect)dirtyRect {
// if cellBackground does not exist, create it
if (!cellBackground) {
// NSImage ivar
cellBackground = [[NSImage alloc] initWithSize:dirtyRect.size];
[cellBackground lockFocus];
//cellGradient created elsewhere, just a basic gradient
[cellGradient drawInRect:dirtyRect angle:270];
[cellBackground unlockFocus];
}
// now actually draw the NSImage into the background rect
[cellBackground drawInRect:dirtyRect
fromRect:NSZeroRect
operation:NSCompositeCopy
fraction:1.0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment