Chapter 19. Graphics: Quartz, Core Animation, and OpenGL

 

This chapter covers

As we saw in the last chapter, creating and displaying images often isn’t enough. In games and other more complex programs, you’ll also want to manipulate those images in various ways at runtime. The iPhone OS offers two major ways to do this.

The first is through Quartz 2D, a two-dimensional drawing library that allows for complex line drawings, much as Canvas did on the web. It’s also the heart of the Core Graphics frameworks. We already touched upon Quartz in the previous chapter, when we drew images straight to the CALayer of a UIView; it’ll be the focus of the majority of this chapter. Quartz also supports Core Animation functions, which we’ll address somewhat more briefly.

The second major way to manipulate images is through the OpenGL ES API. This cross-platform API, originally developed by Silicon Graphics, could be the topic of its own book, so we’ll just show you how to get started with it.

But most of this chapter is going to be about Quartz, a topic that we’re going to dive into immediately.

19.1. An introduction to Quartz 2D

Quartz 2D is a two-dimensional drawing library that’s tightly integrated into the iPhone OS. It works well with all the relevant iPhone frameworks, including Core Animation, OpenGL ES, and the UIKit.

19.2. The Quartz context

19.3. Drawing paths

19.4. Setting the graphic state

19.5. Advanced drawing in Quartz

19.6. Drawing on a picture: an example

19.7. An introduction to Core Animation

19.8. An introduction to OpenGL

19.9. Summary

sitemap