Leopard Developer Graphics & Media Overview

Mac OS X Leopard provides developers with an unsurpassed collection of cutting-edge graphics, imaging, and media technologies. This comprehensive set of tools allows you to create applications that amaze and intrigue your users with a high level of sophistication. The all-new Core Animation and Image Kit frameworks, the substantially enhanced QTKit and Quartz Composer, and the powerful technologies of Quartz 2D, Core Image and OpenGL all allow you to quickly and easily create rich user experiences in your applications.

When you take advantage of the graphics and media technologies in Leopard and integrate them into your application, you are able to add an extra dimension of detail that takes your application from normal to extraordinary. With Leopard, you can add the latest features to your application more easily, more quickly and with greater consistency. Furthermore, by creatively using these technologies, you’ll be able to further set your application apart from your competition.

32F1206B-286A-400C-8575-AA6742848D4C.jpg

This article, part of the Leopard Technology Series for Developers, provides an overview of Leopard’s graphics and media technologies from top to bottom. First, we’ll take a look at the higher-level frameworks, including Core Animation, Image Kit and QTKit, as well as the improvements to Quartz Composer. Then, we’ll consider the foundations of Leopard’s graphics and media capabilities that the higher-level frameworks are built on, so you can think in terms of accessing these technologies at a lower level for even more control.

Building Graphics Technologies into Your Application

Leopard gives you easy and powerful access to its graphics and media capabilities from your application through several high-level frameworks. Brand new in Leopard are the Core Animation and Image Kit frameworks, both of which can enrich your application with a high level of sophistication. As well, the QTKit framework and Quartz Composer feature several improvements. Let’s first take a look at the Core Animation framework.

Core Animation

Core Animation lets you create groundbreaking user experiences and data visualizations by combining and animating layers of graphics, text, and video. With Core Animation you can use common motion graphics techniques, such as keyframes, transformations, and transitions, to animate your application’s visual content and user interface elements. It allows you to create interfaces with high production values while offering an easy programming model for both Cocoa and Quartz 2D-based applications.

89AE1FEB-7EB9-4C57-93BF-FFE6F2B775B3.jpg

Core Animation is highly efficient. Animations, once set in motion, are controlled by a separate thread from the application’s main run loop. As a result, your application is free to process further events even as an animation is running. If an animation’s properties are changed while it is in flight, the Core Animation framework seamlessly retargets the animation to its new state.

Using Core Animation, your application can effortlessly provide a cinematic user experience to your users. You are able to smoothly move user interface elements around the screen, fade them in and out, and add effects with just a few lines of code. In addition to Quartz and Core Image, you can also leverage Core Video and Quartz Composer to achieve a wide range of visual results.

Image Kit

The Image Kit framework in Leopard is designed to give your application the ability to browse, view, adjust, and process images efficiently. It provides a platform-optimized set of image handling components, including a browser that can handle thousands of images without adversely affecting the memory consumption of your application. Image Kit attends to the details of handling large sets of images in your application, freeing you to focus on adding features that make your application unique.

E8EE6830-B431-4465-BAE6-E5B906B25245.jpg

The Image Kit browser supports multiple image selection, keyboard navigation, and drag and drop. Integration of the image browser into an application is straightforward. You can add the image browser component to your user interface using Interface Builder, and then you simply need to provide a set of callback methods that lets the image browser determine how many images it will display and fetch a particular image. Once you have provided the callback methods, the image browser can display the images you want and allow the user to work with them.

To work with individual images, Image Kit provides an image viewer that allows a user to resize, crop, and rotate images. Along with the image viewer comes an Image Edit panel that allows for many common image adjustments, such as exposure, saturation, contrast, and brightness.

6D4194E0-188D-4BCE-8D0B-62445E8BF675.jpg

Image Kit also provides components for capturing and presenting images. For example, there is a a picture taker component that lets your application access an iSight camera and grab images from it, just like iChat and PhotoBooth.

QTKit

QTKit provides a modern, object-oriented interface to QuickTime, Apple’s multimedia handling framework. Introduced in Mac OS X Tiger, QTKit in Leopard now provides a much more comprehensive set of tools for working with QuickTime in Cocoa.

One of its major new features is the QTKit Capture API that lets you capture video from DV cameras, HDV cameras, FireWire IIDC devices, and USB VDC cameras. It supports the ability to capture and record from multiple devices and can output to multiple devices, as well as directly to QuickTime movie files. The new capture classes are built on a framework that provides frame-accurate capture with timecodes and A/V synchronization. It provides access to the transport controls, such as fast-forward and rewind on a camcorder. And, it can write captured QuickTime data to a file while providing an onscreen preview.

Another key benefit of QTKit in Leopard is the ability to run in 64-bit mode. In fact, it’s the only way to access QuickTime in 64-bit applications. The 64-bit QTKit API is identical to the 32-bit API, with some restrictions on data types. The current C-based QuickTime API will only be supported in 32-bit applications.

Quartz Composer

Quartz Composer, the groundbreaking graphical development environment introduced in Tiger, has been significantly updated for Leopard. Quartz Composer allows you to easily work with units of graphics functionality, called patches, which are similar to subroutines in a text-based programming environment. The patches can be connected together to create a composition. Compositions can then be run in a variety of ways. You can execute them as part of your application in a QCView, in a web page via QuickTime, and in Dashboard widgets.

15DEAA5A-6BFC-40B1-A826-ED551DB9C633.jpg

The Quartz Composer development tool in Leopard introduces a wide assortment of new patches and improved versions of old ones. In Leopard, exciting examples include an expanded patch for programming Core Image filters, an improved JavaScript patch, and an all-new patch for creating OpenGL shaders. With the QC Plugin API, you can go even further and create your own custom patches by using Xcode. Leopard also includes a system-wide repository of motion graphics compositions, image filters, and image transitions, which your application can discover and use.

Relying on Deep Foundations

Mac OS X’s graphics and media capabilities are powered by some incredibly powerful foundation technologies including Quartz 2D, Core Image, Core Video, OpenGL, Core Audio, and QuickTime. These technologies power the Mac OS X user experience and the frameworks upon which Mac OS X applications are built. They are also available for your application to tap into directly. This means that in addition to taking advantage of top level frameworks like Core Animation, you can go directly down into the stack as low as needed in order to make your application work the way you want it to.

1252083D-A24D-4D91-8C60-A63D75363054.jpg

In Leopard, Quartz 2D features an opt-in hardware acceleration layer which offloads more of the work of screen drawing onto the GPU in modern video cards. This can result in impressive increases in drawing performance for your application. Quartz 2D also features a new 16-bit color depth pipeline which joins the existing 8-bit and floating-point pipelines. This pipeline is perfect for applications looking to take advantage of Leopard’s enhanced precision printing capability.

D5BC69F1-64C3-4CCF-BBC5-1E5266618A17.jpg

Core Image in Leopard has been optimized for faster performance and increased multi-core scalability. It now can support the application of hundreds of filters to an image. Filters can also be turned into a macro using the new CIFilterGenerator class. There’s a new automated user interface for browsing and applying filters to an image. As well, Core Image gains access to RAW processing functionality for processing RAW format images from professional digital cameras.

The OpenGL framework in Leopard can provide a dramatic increase in OpenGL performance by offloading processing onto a separate thread which can run on a different CPU core. In essence, this means that instead of performing OpenGL processing synchronously in the run loop of your application, the OpenGL framework quickly returns control of the run loop back and does the majority of its processing in a background thread while your application responds to the next user event. This means that your application quickly gets back to responding to user input and that the OpenGL framework can do everything possible to keep the GPU rendering pipeline efficiently filled.

In addition to performance improvements, the OpenGL framework now features full 64-bit support making a perfect platform for scientific visualization of extremely large data sets.

All of these improvements to Leopard’s graphics and media foundation translate into concrete improvements in the user experience of your application.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: