O'Reilly logo

iPhone Open Application Development, 2nd Edition by Jonathan Zdziarski

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 5. Advanced Graphics Programming with Core Surface and Quartz Core

Core Surface is a C-based framework used for building video buffers in which raw pixel data can be written directly to a screen layer. The framework is used when more advanced rendering is needed than basic graphics files, and is designed for applications that draw their own graphics, created while the program is running. Many different types of pixel formats are supported, and because surfaces have a direct interface to a screen layer, drawing is much faster than using higher-level image classes.

The Quartz Core framework, formerly known as Quartz Core, provides the underlying classes for manipulating layers within view objects. It is also used to glue a Core Surface buffer to an object on the screen and to create 3-D transformations of 2-D objects for stunning animations and effects.

This chapter will introduce you to both frameworks and illustrate how the two can interoperate to manipulate screen surfaces and deliver different effects.

Understanding Layers

A layer is a low-level object found in many displayable classes. Layers act like a sheet of poster board to which an object’s contents are affixed. It acts as a flexible backing for the object’s display contents and can bend or contort the object in many ways on the screen. Every object that is capable of rendering itself—namely, those derived from the UIView class—has at least one layer to which its contents are glued.

For example, the UIImageView class ...

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