Revision: 58806
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 3, 2012 10:44 by cphoover
Initial Code
// Save the current graphics state first so we can restore it.
[[NSGraphicsContext currentContext] saveGraphicsState];
// Change the pattern phase.
[[NSGraphicsContext currentContext] setPatternPhase:
NSMakePoint(0,[self frame].size.height)];
// Stick the image in a color and fill the view with that color.
NSImage *anImage = [NSImage imageNamed:@"bricks"];
[[NSColor colorWithPatternImage:anImage] set];
NSRectFill([self bounds]);
// Restore the original graphics state.
[[NSGraphicsContext currentContext] restoreGraphicsState];
Initial URL
Initial Description
Initial Title
Correct way to draw background using a pattern image
Initial Tags
Development
Initial Language
Objective C