Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Beginning iOS5 Development.pdf
Скачиваний:
7
Добавлен:
09.05.2015
Размер:
15.6 Mб
Скачать

562

CHAPTER 15: Grand Central Dispatch, Background Processing, and You

Grand Central Dispatch, Over and Out

This has been a pretty heavy chapter, with a lot of new concepts thrown your way. Not only have you learned about a complete new feature set Apple added to the C language, but you’ve also discovered a new conceptual paradigm for dealing with concurrency without worrying about threads. We also demonstrated some techniques for making sure your apps play nicely in the multitasking world of iOS. Now that we’ve gotten some of this heavy stuff out of the way, let’s move on to the next chapter, which focuses on drawing. Pencils out, let’s draw!

www.it-ebooks.info

Chapter16

Drawing with Quartz and OpenGL

Every application we’ve built so far has been constructed from views and controls that are part of the UIKit framework. You can do a lot with the UIKit stock components, and a great many applications can be constructed using only these objects. Some applications, however, can’t be fully realized without going beyond what the UIKit stock components offer.

Sometimes, an application needs to be able to do custom drawing. Fortunately, we have not one, but two separate libraries we can call on for our drawing needs:

Quartz 2D, which is part of the Core Graphics framework

OpenGL ES, which is a cross-platform graphics library

OpenGL ES is a slimmed-down version of another cross-platform graphic library called OpenGL. OpenGL ES is a subset of OpenGL, designed specifically for embedded systems (hence the letters ES), such as the iPhone, iPad, and iPod touch.

In this chapter, we’ll explore these powerful graphics environments. We’ll build sample applications in both, and give you a sense of which environment to use and when.

Two Views of a Graphical World

Although Quartz 2D and OpenGL ES overlap a lot in terms of what you can accomplish with them, there are distinct differences between them.

Quartz 2D is a set of functions, datatypes, and objects designed to let you draw directly into a view or an image in memory. Quartz 2D treats the view or image that is being drawn into as a virtual canvas. It follows what’s called a painter’s model, which is just a fancy way of saying that the drawing commands are applied in much the same way as paint is applied to a canvas.

D.Mark et al., Beginning iOS 5 Development

©Dave Mark, Jack Nutting, Jeff LaMarche 2011

www.it-ebooks.info

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]