Chapter 12. Drawing Offscreen

There are many reasons your application might need to draw into an offscreen graphics environment. Perhaps the most common is to create a cache containing a complex drawing. Using the cache, the complex drawing can be drawn to the screen quickly many times over. With a rasterization-based drawing library like Quartz 2D, another popular reason is to create a pixel-based representation of a drawing.

Quartz 2D includes several techniques for drawing offscreen:

  • You can create a graphics metafile using the PDF file format.

  • An application can create an offscreen pixel map and a bitmap graphics context to draw on it.

  • You can use a Quartz object known as a CGLayer to cache drawings offscreen.

The discussion of creating Quartz ...

Get Quartz 2D Graphics for Mac OS X® Developers 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.