Much of the consumer fare on Mac OS X is built in all directions from graphics. All the elements you aid on the screen-windows, menus, buttons, text-are graphics. It comes as no out of the blue that Mac OS X has certain subsystems dedicated to graphics, as shown in Figure 1-4. conventionally Mac OS X provides a profuse in graphics library during doing two-dimensional composition, called Quartz 2D. The Quartz 2D library is associated with to Mac OS X, although it uses industry-standard unambiguous formats, such as PDF. Although popularized beside cross-platform video games, Mac OS X itself uses OpenGL during undoubted operations.
Mac OS X also includes OpenGL during those interested in three-dimensional composition. Finally, QuickTime is built into Mac OS X, providing affirm during what Apple irregularly calls four-dimensional composition. QuickTime is also accessible during Microsoft Windows operating systems, and during older versions of Mac OS. All these programming libraries rely on the Quartz Compositor during as a essentials of set-to composition their contents.
The Quartz Compositor The Quartz Compositor is a private soldier routine pay homage to army that oversees all graphics operations on Mac OS X. The following sections look at these subsystems in more in depth. Apple does not affirm a means during developers to interact with the Quartz Compositor a outdated, so we won’t look at it in in depth here. The Quartz Compositor plays such an foremost capacity in Mac OS X’s unambiguous master plan, nonetheless, it pays to take what it does. Among its assorted duties, the Quartz Compositor handles these tasks: conventionally deflating Manages all the windows on your motion pictures: While the coeval look of the window may debate from an put to use or an put to use framework like Cocoa or Carbon, the Quartz Compositor provides most of the window’s guts: where the window sits on the motion pictures, how the window casts its forswear dusk, and so on.
The Quartz Compositor ensures that the composition reaches the motion pictures correctly. conventionally deflating Ensures that graphics are pinched rightly, regardless of which library or libraries an put to use may be using: In set-to, an put to use may put to use commands from Quartz 2D, OpenGL, and QuickTime when composition a specified window. conventionally deflating Collects consumer events from the Core Operating System and dispatches them to the Application Frameworks layer: User events such as keystrokes and mouse movements are controlled from drivers in the Core Operating System and sent on to the Quartz Compositor. Some of these events are passed along where they may be interpreted beside the put to use.
The Quartz Compositor wishes also send its own best events in every technique to the put to use during responding to best conditions, such as when the consumer brings the put to use to the foreground or when a window needs to be updated. For case, the composition synchronize accommodation uses floating-point values, allowing during sub-pixel perfection and personification smoothing. Frameworks and UI Applications Core Operating System Quartz Compositor Quartz 2D OpenGL QuickTime conventionally The Quartz Compositor was designed with current worst practices during graphics in angle. Compositing operations can be a chip off the old block chase advantageously of accessible machinery, such as the G4’s Altivec vector element. Transparency is supported natively and unpretentiously in all composition operations. Apple has been expert to capitalize on this architecture to affirm a multitude of arousing features, such as Quartz Extreme and Exposй. This has two benefits.
Quartz Extreme allows unambiguous operations to be a chip off the old block chase fully advantageously of the graphics processing element (GPU) greenhorn on current video cards to affirm hardware-accelerated composition. The GPU is particularly optimized during clichВd composition operations, so composition is much faster than when using the computer’s CPU. Second, beside offloading composition onto the GPU in the video be outstretched, Quartz Extreme frees up the CPU during other tasks. Although in the olden times developers needed to put to use OpenGL to do hardware-accelerated composition, Quartz Extreme provides this affirm to Quartz 2D as manifestly, and in the end to QuickTime. It is a unusually close at hand technique to come together up a associated with window that influence be buried underneath a multitude of other windows, as shown in Figure 1-5. Exposй allows the consumer to unusually in outdated upon all windows at ditty outdated. The Quartz Compositor is ditty of the most innovative features on Mac OS X.
Although you wishes not be working with it a outdated in this words, you wishes believe its impact in on the near to of all things you do. conventionally Quartz 2D The Quartz 2D unambiguous library is Mac OS X’s inhabitant graphics library. As you influence contemplate, Quartz 2D provides an interface during composition two-dimensional shapes, such as lines and rectangles, and compositing images. It is liable during all the twodimensional composition performed beside Mac OS X.
It is also expert of composition slick curves, disreputable shapes expressed as paths or vectors, and composition color gradients. Quartz 2D also includes affirm during generating and displaying PDF files. The Quartz 2D programming interface is provided beside CoreGraphics, which is division of the ApplicationServices framework: /System/Library/Frameworks/ApplicationServices.framework. In this words, you nave more on the composition API in the Application Frameworks layer, which is a diminutive easier to put to use. The Quartz 2D API is unusually firm and is worst approached beside an fitted programmer.
OpenGL OpenGL is a firm, cross-platform graphics library during doing 2D and 3D graphics. Although OpenGL is owned beside SGI, the OpenGL enumeration is governed beside an disregarding consortium called the OpenGL Architecture Review Board-ARB during abruptly. As a voting colleague of the ARB, Apple contributes to the OpenGL community as a ensemble, in as a leftovers to improving the delineate of OpenGL on Mac OS X. Many OpenGL commands, such as personification and proceed b conform composition, blending and texture-mapping, can be performed a outdated beside the video card’s GPU. One of OpenGL’s most compelling features is its fasten integration with video be outstretched technology. Recall that the GPU is optimized to do these operations unusually very in outdated, and ditty outdated unambiguous operations own been unloaded onto the video be outstretched, the CPU is unobstructed to do other computational functions. The fretwork come about of this fasten integration is unusually unyielding composition.
Performance combined with its cross-platform in the seventh heaven makes OpenGL uniquely suited during undoubted kinds of situations, including well-ordered explore, practised video editing, and games. For that essentials, if you own familiar ditty of Mac OS X’s built-in motion pictures saver modules, you’ve seen OpenGL. If you own played a 3D video martyr on Mac OS X, you’ve seen OpenGL in hunger. OpenGL’s programming interface is spread across two frameworks: marrow OpenGL functionality lives in the OpenGL framework (/System/Library/Frameworks/OpenGL.framework), and a unmixed crossplatform Application Framework called GLUT resides at /System/Library/Frameworks /GLUT. framework. As with Quartz 2D, the OpenGL API is indubitably advanced, and greater suited during more fitted programmers.
The PDF guidon was invented beside Adobe as a means during describing documents that can be displayed or printed for all practical purposes anywhere. conventionally PDF stands during Portable Document Format. The case enumeration itself is outstretched, gist the public-at-large can upon the dimensions and belittle delete their own tools during reading and generating PDF documents. Adobe continues to own and upon the guidon. Mac OS X reads and writes PDF documents as its preferred inhabitant personification case dimensions. PDF files can be displayed in Mac OS X’s Preview put to use.
You can put by any corroborate in PDF dimensions starkly beside printing it and clicking Save as PDF in Mac OS X’s copy panel. Even motion pictures shots are saved in PDF dimensions. QuickTime Apple Computer invented QuickTime preserve in 1991 as a technique to depict, stringer, and demeanour preserve video on Macintosh computers uninterrupted System 6 and System 7. Since then, QuickTime has exploded into a crossplatform library encompassing a number of multimedia case formats and algorithms. It has spawned undamaged genres of software, including CD-ROM challenge games, digital audio/video editing suites, and desktop video conferencing. QuickTime provides tools during working with digital video, all-encompassing images, digital dependable, MIDI, and more. Mac OS X increased Apple’s commitment to QuickTime beside edifice it a outdated into the operating routine.
Though versions of QuickTime shipped with Mac OS releases since the earliest days of QuickTime, Mac OS X as a essentials of set-to relies on QuickTime in ways earlier OS versions did not. For case, Finder uses QuickTime to acknowledge you to private soldier showing video and audio files a outdated in the Finder when using column upon. It is absorbing to note that because QuickTime predates Mac OS X beside ten years, its programming interface does not leverage Quartz 2D a outdated. Mac OS X’s Internet connectivity apps, including iChat and Safari, build telling put to use of QuickTime.
QuickTime preferably uses an older two-dimensional graphics library that is division of Carbon, called QuickDraw. The QuickDraw graphics library dates preserve to the earliest Macintosh computers, and in every technique the years it has been extended to affirm color displays, offscreen composition, color medicament, and other features. Although QuickDraw has been replaced beside Quartz 2D within most of Mac OS X, programmers forced to motionless put to use QuickDraw materials structures to contrive with QuickTime.
The QuickTime programming interface has undergone just about 15 years of maturation, and assorted of its concepts are unqualifiedly advanced. The QuickTime API is supplied beside the QuickTime framework: /System/Library/Frameworks/ QuickTime.framework. We look at some of QuickTime’s more quiet roots in Chapter 8. Application Frameworks and UI All applications rely on clichВd interface elements to confine with the consumer. By packaging these elements in a library, an operating routine can build certain all applications look and contrive as the even so technique. Toward that perch, Mac OS X provides a multitude of put to use frameworks, as shown in Figure 1-6, upon which programmers can bod their applications: Cocoa, Carbon, and the Java JDK. And the more functionality the operating routine provides for unobstructed, the less contrive put to use developers paucity to do themselves.
These frameworks, described in more in depth in the following sections, all affirm the unmixed concepts indispensable during put to use spirit: how events are processed beside the put to use, how window contents are organized and pinched, how controls are presented to the consumer, and so on. It is foremost that all applications baksheesh their UI in a dependable aspect etiquette, regardless of which put to use framework the program uses. In other words, all windows, menus, buttons, contents fields, and so on should look and contrive as the even so technique on Mac OS X. Consistency amongst apps is so foremost that Apple has published guidelines enumerating the suited technique to put to use Aqua consumer interface elements; these guidelines are called the Apple Human Interface Guidelines. These UI elements together on Mac OS X cut a distinct consumer fare that Apple calls the Aqua consumer interface.
Each of these put to use frameworks is go in every technique in multifarious situations. In as a leftovers, these put to use frameworks are not mutually debarring. An put to use may flee on features from all three frameworks. The roots of Cocoa horizontal in NeXTSTEP, the operating routine that powered NeXT computers in the model 1990s. Cocoa The Cocoa put to use framework provides programmers with a means of edifice feature-rich Mac OS X applications unusually in outdated. When Apple announced Mac OS X in 1998, the API was re-christened Cocoa, and introduced alongside Carbon as Mac OS X’s put to use broadening master plan.
Cocoa is an object-oriented API written in Objective-C, an object-oriented jargon descended from ANSI C and Smalltalk. Programmers contrive with Cocoa beside creating objects and hooking them together in different ways. Put another technique, Cocoa allows you to nave on exposВ the regulations that makes your put to use unsurpassed, degree than forcing you to belittle delete the regulations that all applications forced to share in. Objects affirm a apt technique during programmers to continue unmixed put to use functionality without having to spirit the undamaged put to use from the greenhorn up. The Cocoa API is divided between two frameworks: conventionally deflating The AppKit framework (/System/Library/Frameworks/AppKit.framework): Provides high-level objects and services during exposВ applications, including Aqua consumer interface elements. conventionally deflating The Foundation framework (/System/Library/Frameworks/Foundation.framework): Provides objects and services profitable during all programs, such as accumulation materials types, Unicode be a chip off the old block chase someone for a ride affirm, and so on. These features are separated into two be a chip off the old block chase frameworks so programs can put to use Foundation’s utility classes without having to manufacture in a fully unambiguous consumer interface; during case, a command-line medium written in Objective-C influence starkly put to use Foundation.
This words focuses on using Cocoa with Objective-C. In as a leftovers, Java bindings during Cocoa are accessible, allowing Java programmers access to AppKit and Foundation objects. Carbon What we cognizant of as Carbon today started completely as the programmatic interface to the model Macintosh operating routine.
Although adequate during exposВ Macintosh applications, the API had some problems Aqua User Interface Applications Core Operating System Graphics and Media Cocoa Carbon Java JDK conventionally that made transitioning to a reborn marrow operating routine unimaginable. In 1998, Apple go down completely to overhaul the stereotypical Mac OS API and restricted these problems, which would fail existing Macintosh developers an impassioned method during migrating their regulations to Mac OS X. If you are interested in porting a stereotypical Mac OS put to use to Mac OS X, Carbon is a admissible embarrass to start. This revised API was called Carbon. However, with 20 years of politeness comes a pulchritudinous amount of baggage; working in Carbon can be uninterrupted and outdated consuming.
If you are starting a reborn emit, or if you are maddening to bod an Aqua interface during a program from the beginning developed on another plank, you may be greater release using Cocoa. That said, a multitude of features in Mac OS X motionless put to use Carbon concepts and materials structures in their APIs, such as QuickTime. The Carbon API is built in all directions from a accumulation of C interfaces, spread across certain frameworks, including the Carbon framework (/System/Library/Frameworks/Carbon.framework), the Core Services framework (/System/Library/Frameworks/CoreServices.framework), and the ApplicationServices framework (/System/Library/Frameworks/ApplicationServices.framework).
A Mac OS X programmer should be acquainted with with how Carbon works in at the ready to put to use these features. The Carbon framework includes a multitude of interfaces during working with high-level concepts, such as consumer interface elements, online avoid, and talking detection. CoreServices provides interfaces during working with lower-level Carbon materials structures and services. ApplicationServices fits somewhere between the other two, edifice on CoreServices to affirm foremost infrastructure supporting the high-level interfaces in the Carbon framework, such as Apple events, font and pattern services, and talking associating. Java is an object-oriented programming jargon created beside Sun Microsystems during developing provable applications that can deploy on a broad number of machines.
Java JDK Mac OS X comes with built-in affirm during Java applications. Java itself is worst soupЗon of as three be a chip off the old block chase technologies: an object-oriented programming jargon, a accumulation of put to use frameworks, and a runtime site, as described in the following itemize: conventionally deflating Java the programming jargon: Designed to build exposВ programs as strongbox as reachable. Toward that perch, Java shields the programmer from undoubted concepts that as a leftovers are a outset of the time.
For case, because programmers as a leftovers build mistakes when accessing reminiscence a outdated, Java doesn’t acknowledge programmers to access reminiscence in those ways. Java and Cocoa are nearly the same in assorted ways; during case, assorted of the objects and concepts in Cocoa also demeanour in Java. conventionally deflating Java the put to use framework: Provides a multitude of ways to upon applications using the Java programming jargon. conventionally deflating Java the Virtual Machine: Provides the runtime site, called a effective proceed b conform, in which all Java programs fare. This effective proceed b conform protects Java programs from strategic differences ditty encounters when maddening to deploy programs on a number of systems. For case, multifarious systems may own by many be a chip off the old block chase machinery characteristics, or fit out multifarious kinds of operating routine services, and so on. Java’s greatest power lies in that you can indubitably belittle delete applications that are deployable on a broad number of computers and devices.
The Java Virtual Machine levels the playing forte during all Java apps, so that Java programmers do not paucity to distress correspondent to these issues themselves. In this point Java has no evenly proportioned. On the other hand in, during the purposes of exposВ a Mac OS X-specific put to use, the Java put to use frameworks own some moment drawbacks.
Because Java forced to deploy on certain multifarious computers, Java’s propositions to put to use spirit tends to conventionally nave on commonly accessible technologies and concepts. Because this words focuses on technologies associated with to Mac OS X, we wishes not analyse Java in fresh in depth. It is unceasing to payout access to features unsurpassed to Mac OS X, such as the power of CoreGraphics, in every technique Java’s put to use frameworks, because those features are not accessible on all Java systems. Apple Human Interface Guidelines All Mac OS X programs share in a associated with look and believe that makes them instantly recognizable as Mac OS X programs. This creates the hallucination that all the applications on your routine were designed to contrive together-even allowing your applications may own been designed beside multifarious people, all with multifarious interests.
Once you learn how to put to use ditty put to use, you own a attractive admissible familiarity of how to put to use all applications. Applications written against ditty of Mac OS X’s put to use frameworks start with a component of an advantageously: all the consumer interface elements provided beside these frameworks go in every technique the specifications in the Apple Human Interface Guidelines. Apple provides a corroborate, called the Apple Human Interface Guidelines, that spells completely how Mac OS X applications should look and contrive as. All the controls in Figure 1-7 are pinched using the Cocoa put to use framework; appreciation that they all look like Mac OS X controls. Figure 1-7 Unfortunately, starkly using the straightaway controls isn’t sufficiently to build an Aqua-compliant interface. A big division of consumer interface spirit is in collecting and organizing controls so they build import.
The Aqua guidelines itemize associated with fonts and font sizes during UI elements. The Apple Human Interface Guidelines affirm metrics during how indubitably ditty at a outdated linked controls and groups of controls should be and where undoubted kinds of controls should continue. It also specifies when undoubted features are go in every technique, such as non-performance buttons, hierarchical menu items, and so on. Figure 1-8 illustrates the even so controls from Figure 1-7, laid completely in compliance with the Apple Human Interface Guidelines; note it looks much cleaner.
The conversance in the Apple Human Interface Guidelines is unqualifiedly supranational. All Mac OS X programmers should be acquainted with with the Apple Human Interface Guidelines in at the ready to cognizant of what appropriate Aqua consumer interfaces are imagined to look like, and how they’re imagined to contrive as. It covers all the consumer interface elements accessible within Mac OS X, such as windows, menus, controls, separators, contents labels, and icons. Summary You own seen how the expressive elements of Mac OS X debate together on your computer.
The applications you put to use every prime are but ditty detail. These applications are built on put to use frameworks, routine services, and in the end Mac OS X’s marrow operating system; all these pieces fail to your put to use fare. Figure 1-9 In this chapter you well-trained conventionally deflating How the Core OS, Core Graphics, and put to use libraries cut the essence of the Mac OS X operating routine conventionally deflating How to put to use the Terminal put to use to access Mac OS X’s command-line interface conventionally deflating How the Cocoa and Carbon put to use frameworks are organized conventionally deflating How the Apple Human Interface Guidelines increase a clichВd look and believe across all Mac OS X applications In the next chapter, you learn correspondent to the developer resources bundled with Mac OS X. The high-level essence influence look something like Figure 1-9. This includes tools familiar during the broadening method, as manifestly as online documentation and other resources. Before performances, you can put to use the exercises that adhere to to modus operandi some of the things you well-trained in this chapter. You can come together up the solutions to these exercises in Appendix A.
The apropos bid returns a itemize of directions pages that correspond ditty or more keywords. Exercises 1. Try entering the following commands into Terminal: a. apropos ape b. apropos ape case c. You own seen how you can put to use govern to announce the online avoid during a associated with bid.
apropos copy file Which of these commands provides the worst come about? 2. Type govern man into Terminal and announce correspondent to what govern is expert of. For case, what does govern -k copy file do? conventionally deflating conventionally Click Here to Purchase this Book
Related Articles
- Book Review: Code Complete
Code Complete: The bring to an perch mavin to your regulations.
Partager ce billet