O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Custom Drawing

For your first foray into custom drawing, you will start small by drawing a gray background for the DieView and a green line that bisects the view diagonally. (Figure 17.6).

Figure 17.6  Drawing with NSColor and NSBezierPath

Drawing with NSColor and NSBezierPath

Your drawing will be done in three steps:

  • Set the color. The color is an instance of NSColor. NSColor can specify colors in the RGB, HSV, CMYK, and grayscale color spaces.

  • Construct the path. The path specifies the line, curve, or shape that you want to draw. The path is an instance of NSBezierPath. (If you need to draw the same path multiple times, you can store an instance of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required