Chapter 5. Advanced Graphics Programming with Core Surface and Layer Kit

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 Layer Kit framework is referred to as Core Animation on the Leopard desktop. Layer Kit provides the underlying classes for managing the content of UIView 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, ...

Get iPhone Open Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.