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

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.