tailieunhanh - Lập trình iPhone part 12
Tất cả các ứng dụng mà chúng tai đã xây dựng cho đến nay đã được xây dựng từ nhìn và điều khiển cung cấp cho chúng ta như là một phần của framwork UIKit. Bạn có thể làm một awful nhiều phần với các thành phần này, và nhiều giao diện ứng dụng tuyệt vời có thể được xây dựng chỉ sử dụng các đối tượng từng phần | .12 Chap Drawing with Quartz and OpenGL very application we ve built so far has been constructed from views and controls provided to us as part of the UlKit framework. You can do an awful lot with these stock components and a great many application interfaces can be constructed using only these stock objects. Some applications however can t be fully realized without looking further. For instance at times an application needs to be able to do custom drawing. Fortunately for us 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 and 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 such as the iPhone hence the letters ES . In this chapter we ll explore both of these powerful graphics environments. We ll build sample applications in both and try to get a sense of which environment to use when. 361 362 CHAPTER 12 Drawing with Quartz and OpenGL Two Views of a Graphical World Although Quartz and OpenGL overlap a lot there are distinct differences between them. Quartz is a set of functions datatypes and objects designed to let you draw directly into a view or to an image in memory. Quartz treats the view or image that is being drawn into as a virtual canvas and follows what s called a painter s model which is just a fancy way to say that that drawing commands are applied in much the same way as paint is applied to a canvas. If a painter paints an entire canvas red and then paints the bottom half of the canvas blue the canvas will be half red and half either blue or purple. Blue if the paint is opaque purple if the paint is semitransparent. Quartz s virtual canvas works the same way. If you paint the whole view red and then paint the bottom half of the view blue you ll have a view that s half red and half either blue or .
đang nạp các trang xem trước