Core Graphics Framework
The Core Graphics framework (CoreGraphics.framework
) contains the interfaces for the Quartz 2D drawing API. Quartz is the same advanced, vector-based drawing engine that is used in Mac OS X. It provides support for path-based drawing, anti-aliased rendering, gradients, images, colors, coordinate-space transformations, and PDF document creation, display, and parsing. Although the API is C based, it uses object-based abstractions to represent fundamental drawing objects, making it easy to store and reuse your graphics content.
Quartz 2D is an advanced, two-dimensional drawing engine available for iOS application development and to all Mac OS X application environments outside of the kernel. Quartz 2D provides low-level, lightweight 2D rendering with unmatched output fidelity regardless of display or printing device. Quartz 2D is resolution- and device-independent; you don’t need to think about the final destination when you use the Quartz 2D application programming interface (API) for drawing.
The Quartz 2D API is easy to use and provides access to powerful features such as transparency layers, path-based drawing, offscreen rendering, advanced color management, anti-aliased rendering, and PDF document creation, display, and parsing.
The Quartz 2D API is part of the Core Graphics framework, so you may see Quartz referred to as Core Graphics or, simply, CG.
Quartz Core Framework
The Quartz Core framework (QuartzCore.framework
) contains the Core Animation interfaces. Core Animation is an advanced animation and compositing technology that uses an optimized rendering path to implement complex animations and visual effects. It provides a high-level Objective-C interface for configuring animations and effects that are then rendered in hardware for performance. Core Animation is integrated into many parts of iOS, including UIKit classes such as UIView
, providing animations for many standard system behaviors. You can also use the Objective-C interface in this framework to create custom animations.
The Quartz Core framework (QuartzCore.framework
) implements two important system technologies for graphics and imaging, Core Animation and Core Image.
Core Animation
Core Animation is a set of Objective-C classes for doing sophisticated 2D rendering and animation. Using Core Animation, you can create everything from basic window content to carousel–style user interfaces (such as Front Row’s), and achieve respectable animation performance without having to tune your code using OpenGL or other low-level drawing routines. This performance is achieved using server-side content caching, which restricts the compositing operations performed by the server to only those parts of a view or window whose contents actually change.
At the heart of the Core Animation programming model are layer objects, which are similar in many ways to Cocoa views. As with views, you can arrange layers in hierarchies, change their size and position, and tell them to draw themselves. Unlike views, layers do not support event-handling, accessibility, or drag and drop.
You can manipulate the layout of layers in more ways than the layout of traditional Cocoa views. In addition to positioning layers using a layout manager, you can apply 3D transforms to layers to rotate, scale, skew, or translate them in relation to their parent layer. In Mac OS X v10.7 and later, you can create a layer tree in one process and display it in another.
Layer content can be animated implicitly or explicitly depending on the actions you take. Modifying specific properties of a layer, such as its geometry, visual attributes, or children, typically triggers an implicit animation to transition from the old state to the new state of the property. For example, adding a child layer triggers an animation that causes the child layer to fade gradually into view. You can also trigger animations explicitly in a layer by modifying its transformation matrix.
You can manipulate layers independent of, or in conjunction with, the views and windows of your application. Cocoa applications can take advantage of the Core Animation’s integration with the NSView
class to add animation effects to windows. Layers can also support the following types of content:
-
-
-
Quartz and Cocoa drawing content
-
OpenGL content
-
Quartz Composer compositions
-
Core Image filter effects
-
-
For information about Core Animation, see Animation Overview.
Core Image
Core Image extends the basic graphics capabilities of the system to provide a framework for implementing complex visual behaviors in your application. Core Image uses GPU-based acceleration and 32-bit floating-point support to provide fast image processing and pixel-level accurate content. Its plug-in–based architecture lets you expand the capabilities of Core Image through the creation of image units, which implement the desired visual effects.
Core Image includes built-in image units that allow you to:
-
-
-
Crop, composite, blur, and sharpen images
-
Correct color, including perform white-point adjustments
-
Apply color effects, such as sepia tone
-
Warp the geometry of an image by applying an affine transform or a displacement effect
-
Generate color, checkerboard patterns, Gaussian gradients, and other pattern images
-
Add transition effects to images or video
-
Provide real-time control, such as color adjustment and support for sports mode, vivid mode, and other video modes
-
Apply linear lighting effects, such as spotlight effects
-
-
You can use both the built-in and custom image units in your application to implement special effects and perform other types of image manipulations. Beginning in Mac OS X v10.7, Core Image supports face detection; this feature detects faces in an image, yielding for each found face its bounds within the image and eye and mouth positions.
For information about how to use Core Image or how to write custom image units, see Core Image Programming Guide and Core Image Reference Collection. For information about the built-in filters in Core Image, see Core Image Filter Reference.
Introduction to Core Image Programming Guide
Core Image is an image processing technology built into Mac OS X v10.4 and iOS 5.0 that leverages programmable graphics hardware whenever possible to provide near real-time processing. The Core Image application programming interface (API) provides access to built-in image filters for both video and still images and provides support for creating custom filters.
Important Although this document is included in the reference library, it has not been updated in detail for iOS 5.0. A forthcoming revision will detail the differences in Core Image on iOS. In particular, the key difference is that Core Image on iOS does not include the ability to create custom image filters.To use Core Image in Xcode, you need to import the Quartz Core framework.
Quartz
The Quartz umbrella framework includes the following subframeworks. You should not link directly with any of the subframeworks; instead link with (and import) Quartz.framework
.
Image Kit
The Image Kit framework is an Objective-C framework that makes it easy to incorporate powerful imaging services into your applications. This framework takes advantage of features in Quartz, Core Image, OpenGL, and Core Animation to provide an advanced and highly optimized development path for implementing the following features:
-
-
-
Displaying images
-
Rotating, cropping, and performing other image-editing operations
-
Browsing for images
-
Taking pictures using the built-in picture taker panel
-
Displaying slideshows
-
Browsing for Core Image filters
-
Displaying custom views for Core Image filters
-
-
For more information on how to use Image Kit, see Image Kit Programming Guide and Image Kit Reference Collection
PDF Kit
PDF Kit is a Cocoa framework for managing and displaying PDF content directly from your application’s windows and dialogs. You can embed a PDFView
object in your window and give it a PDF file to display. The PDF view handles the rendering of the PDF content, handles copy-and-paste operations, and provides controls for navigating and setting the zoom level. Other classes let you get the number of pages in a PDF file, find text, manage selections, add annotations, and specify the behavior of some graphical elements, among other actions.
For more information on PDF Kit, see PDF Kit Programming Guide.
Quartz Composer
The Quartz Composer framework (QuartComposer.framework
) provides programmatic support for dealing with Quartz Composer compositions. It enables applications to load, play, and control compositions, including those in Core Animation layers.
For more information, see Quartz Composer Programming Guide.
Quick Look UI
The Quick Look UI framework (QuickLookUI.framework
), introduced in Mac OS X v10.6, defines an interface for implementing a Quick Look preview panel, which displays the preview of a list of items. In Mac OS X v10.7, the framework added the capability for embedding a preview inside a view.
For an example of an application that implements Quick Look preview panels, see QuickLookDownloader.
Quartz Core
The Quartz Core framework (QuartzCore.framework
) implements two important system technologies for graphics and imaging, Core Animation and Core Image.
Core Animation
Core Animation is a set of Objective-C classes for doing sophisticated 2D rendering and animation. Using Core Animation, you can create everything from basic window content to carousel–style user interfaces (such as Front Row’s), and achieve respectable animation performance without having to tune your code using OpenGL or other low-level drawing routines. This performance is achieved using server-side content caching, which restricts the compositing operations performed by the server to only those parts of a view or window whose contents actually change.
At the heart of the Core Animation programming model are layer objects, which are similar in many ways to Cocoa views. As with views, you can arrange layers in hierarchies, change their size and position, and tell them to draw themselves. Unlike views, layers do not support event-handling, accessibility, or drag and drop.
You can manipulate the layout of layers in more ways than the layout of traditional Cocoa views. In addition to positioning layers using a layout manager, you can apply 3D transforms to layers to rotate, scale, skew, or translate them in relation to their parent layer. In Mac OS X v10.7 and later, you can create a layer tree in one process and display it in another.
Layer content can be animated implicitly or explicitly depending on the actions you take. Modifying specific properties of a layer, such as its geometry, visual attributes, or children, typically triggers an implicit animation to transition from the old state to the new state of the property. For example, adding a child layer triggers an animation that causes the child layer to fade gradually into view. You can also trigger animations explicitly in a layer by modifying its transformation matrix.
You can manipulate layers independent of, or in conjunction with, the views and windows of your application. Cocoa applications can take advantage of the Core Animation’s integration with the NSView
class to add animation effects to windows. Layers can also support the following types of content:
-
-
-
Quartz and Cocoa drawing content
-
OpenGL content
-
Quartz Composer compositions
-
Core Image filter effects
-
-
For information about Core Animation, see Animation Overview.
Core Image
Core Image extends the basic graphics capabilities of the system to provide a framework for implementing complex visual behaviors in your application. Core Image uses GPU-based acceleration and 32-bit floating-point support to provide fast image processing and pixel-level accurate content. Its plug-in–based architecture lets you expand the capabilities of Core Image through the creation of image units, which implement the desired visual effects.
Core Image includes built-in image units that allow you to:
-
-
-
Crop, composite, blur, and sharpen images
-
Correct color, including perform white-point adjustments
-
Apply color effects, such as sepia tone
-
Warp the geometry of an image by applying an affine transform or a displacement effect
-
Generate color, checkerboard patterns, Gaussian gradients, and other pattern images
-
Add transition effects to images or video
-
Provide real-time control, such as color adjustment and support for sports mode, vivid mode, and other video modes
-
Apply linear lighting effects, such as spotlight effects
-
-
You can use both the built-in and custom image units in your application to implement special effects and perform other types of image manipulations. Beginning in Mac OS X v10.7, Core Image supports face detection; this feature detects faces in an image, yielding for each found face its bounds within the image and eye and mouth positions.
For information about how to use Core Image or how to write custom image units, see Core Image Programming Guide and Core Image Reference Collection. For information about the built-in filters in Core Image, see Core Image Filter Reference.
QuickTime Kit
The QuickTime Kit (QTKit.framework
), or QTKit, is an Objective-C framework for manipulating QuickTime-based media. This framework lets you incorporate movie playback, movie editing, export to standard media formats, and other QuickTime behaviors easily into your applications.