O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

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

Chapter 4. Drawing and Imaging

The Application Kit has a diverse set of graphics classes. These classes range from NSQuickDrawView, which lets developers use legacy graphics code based on the QuickDraw APIs in their Cocoa application, to NSOpenGLView, which provides a way to display OpenGL-based 3D graphics. The focus of this chapter, however, is on the 2D drawing and imaging classes that provide a high-level interface to Mac OS X’s graphics system, Quartz. Table 4-1 enumerates the classes discussed in this chapter.

Table 4-1. Application Kit drawing and imaging classes

Class

Description

NSAffineTransform

Defines an interface for creating and applying affine transforms that map points in one coordinate space to another

NSBezierPath

Draws PostScript-style lines and curves that enable the construction of arbitrary paths

NSBitmapImageRep

Interprets bitmapped image data, such as those stored as TIFF, BMP, GIF, JPEG, or PNG file types

NSCachedImageRep

Stores image data as a cached representation

NSColor

Represents a color as an object with support for several color spaces and color calibration

NSCustomImageRep

An image representation that allows the client to determine how the image is rendered

NSEPSImageRep

An image representation subclass that represents PostScript (EPS) formatted image data

NSGraphicsContext

Represents configurations for Quartz’s graphics rendering engine and allows the client to determine how characteristics of graphics objects, such as Bezier paths, are rendered

NSImage

Stores and draws an image to screen

NSImageRep

Lets NSImage simultaneously represent an image’s data in several formats defined by its six concrete subclasses

NSPDFImageRep

Represents image data stored as a PDF

NSPICTImageRep

Represents image data in Macintosh PICT format

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