Quartz Composer
Encyclopedia
Quartz Composer is a node-based visual programming language
Visual programming language
In computing, a visual programming language is any programming language that lets users create programs by manipulating program elements graphically rather than by specifying them textually. A VPL allows programming with visual expressions, spatial arrangements of text and graphic symbols, used...

 provided as part of the Xcode
Xcode
Xcode is a suite of tools, developed by Apple, for developing software for Mac OS X and iOS. Xcode 4.2, the latest major version, is available on the Mac App Store for free for Mac OS X 10.7 , and on the Apple Developer Connection website for free to registered developers Xcode is a suite of tools,...

 development environment
Development environment
In hosted software development, a development environment refers to a server tier designated to a specific stage in a release process....

 in Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

 for processing and rendering
Rendering (computer graphics)
Rendering is the process of generating an image from a model , by means of computer programs. A scene file contains objects in a strictly defined language or data structure; it would contain geometry, viewpoint, texture, lighting, and shading information as a description of the virtual scene...

 graphical data.

Quartz Composer uses OpenGL
OpenGL
OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL...

 (including GLSL
GLSL
OpenGL Shading Language , is a high-level shading language based on the syntax of the C programming language...

), OpenCL
OpenCL
OpenCL is a framework for writing programs that execute across heterogeneous platforms consisting of CPUs, GPUs, and other processors. OpenCL includes a language for writing kernels , plus APIs that are used to define and then control the platforms...

 (only in Mac OS X 10.6 and later), Core Image
Core Image
Core Image is a pixel-accurate, near-realtime, non-destructive image processing technology in Mac OS X. Implemented as part of the QuartzCore framework of Mac OS X 10.4 and later, Core Image provides a plugin-based architecture for applying filters and effects within the Quartz graphics rendering...

, Core Video
Core Video
Core Video is the video processing model employed by Mac OS X. It links the process of decompressing frames from a video source to the rest of the Quartz technologies for image rendering and composition...

, JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

, and other technologies to build an API and a developer tool around a simple visual programming paradigm. Apple has embedded Quartz technologies deeply into the operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

. Compositions created in Quartz Composer can be played standalone in any QuickTime
QuickTime
QuickTime is an extensible proprietary multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. The classic version of QuickTime is available for Windows XP and later, as well as Mac OS X Leopard and...

-aware application (although only on Mac OS X 10.4 and later), as a system Screen Saver
Screensaver
A screensaver is a type of computer program initially designed to prevent phosphor burn-in on CRT and plasma computer monitors by blanking the screen or filling it with moving images or patterns when the computer is not in use...

, as an iTunes Visualizer, from inside the Quartz Composer application, or can be embedded into a Cocoa
Cocoa (API)
Cocoa is Apple's native object-oriented application programming interface for the Mac OS X operating system and—along with the Cocoa Touch extension for gesture recognition and animation—for applications for the iOS operating system, used on Apple devices such as the iPhone, the iPod Touch, and...

 or Carbon
Carbon (API)
Carbon is one of Apple Inc.'s procedural application programming interfaces for the Macintosh operating system. It provides C programming language access to Macintosh system services...

 application via supplied user interface
User interface
The user interface, in the industrial design field of human–machine interaction, is the space where interaction between humans and machines occurs. The goal of interaction between a human and a machine at the user interface is effective operation and control of the machine, and feedback from the...

 widgets. Because Quartz Composer makes extensive use of hardware acceleration
Hardware acceleration
In computing, Hardware acceleration is the use of computer hardware to perform some function faster than is possible in software running on the general-purpose CPU...

 and pixel shaders, it is recommended to have a graphics card with at least 32MB of VRAM. While Quartz Composer is included with the iPhone SDK, there is currently no way of running Quartz Compositions on iOS devices.

Patches

Quartz programming through Quartz Composer works by implementing and connecting patches. Similar to routines in traditional programming languages, patches are base processing units. They execute and produce a result. For better performance, patch execution follows a lazy evaluation
Lazy evaluation
In programming language theory, lazy evaluation or call-by-need is an evaluation strategy which delays the evaluation of an expression until the value of this is actually required and which also avoids repeated evaluations...

 approach, meaning that patches are only executed when their output is needed. There are three types of patches: Consumers, Processors, and External Input patches that can receive and output mouse clicks, scrolls, and movements; MIDI and audio; keyboard; or other movements. A collection of patches can be melded into one, called a macro. Macros can be nested and their subroutines also edited.

To control the order of rendering, each renderer is assigned a layer, indicated in its upper-right corner. Layers are rendered sequentially, lowest to highest. Renderers can be enabled or disabled, essentially turning on or off that particular layer. Turning off unused layers often results in better performance, since fewer upstream patches need to be evaluated.

Some patches can have subpatches, which allows for global parameter changes to just the included subpatches. This is useful for lighting, 3D transformation, and GLSL
GLSL
OpenGL Shading Language , is a high-level shading language based on the syntax of the C programming language...

 shaders, among other things. Subpatch support is indicated by square corners on a patch, rather than the typical rounded corners.

With Version 3.0, it became possible to turn compositions into Virtual Patches. These allow the user to reuse functionality without having to store duplicate copies in each composition. The Quartz Composer Editor allows the user to save a "flattened" copy (with the virtual patches fully expanded inside), for easy distribution. Version 4.0 extended this functionality even more, and automatically includes "flattened" copies of virtual patches for use as a fallback if the desired virtual patch isn't installed on the host system. This greatly simplifies composition distribution.

Network functionality was greatly improved with the release of Leopard. It became possible to transmit data and synchronize over a network interface, and it also added support for Open Sound Control transmission and reception.

Plugins

Also new in Version 3.0 was the possibility to write custom patch plugins, using an Xcode
Xcode
Xcode is a suite of tools, developed by Apple, for developing software for Mac OS X and iOS. Xcode 4.2, the latest major version, is available on the Mac App Store for free for Mac OS X 10.7 , and on the Apple Developer Connection website for free to registered developers Xcode is a suite of tools,...

 template, and the notion of a "safe mode", where plugins and other unsafe patches fail to load. This prevents malicious compositions from performing dangerous or insecure operations. Custom patches using Apple's Xcode template are always considered unsafe.

It was possible to develop custom patch plugins for Version 2.0, but the API was undocumented and private, and was never supported by Apple. Eventually, templates were released to simplify this procedure.

Hidden Options

In the Quartz Composer editor, holding the option key
Option key
The Option key is a modifier key present on Apple keyboards. It is located between the Control key and Command key on a typical Mac keyboard. There are two option keys on modern Mac desktop and notebook keyboards, one on each side of the space bar....

 while selecting "Preferences..." from the menu adds 3 additional tabs of options for the user to configure. These options include System settings, Editor settings, and QuickTime integration settings. Notable options include expanded tooltips, software rendering, and uncapped framerate rendering. Multisampling was added as a hidden option on supported GPUs in version 4.0, allowing for antialiasing inside the QC Editor.

Native Datatypes

Data inside QC can be one of the following types:
  • Boolean
    Boolean datatype
    In computer science, the Boolean or logical data type is a data type, having two values , intended to represent the truth values of logic and Boolean algebra...

     - a boolean value, 0 or 1
  • Index - a positive integer between 0 and 2147483647
  • Number - a double precision
    Double precision
    In computing, double precision is a computer number format that occupies two adjacent storage locations in computer memory. A double-precision number, sometimes simply called a double, may be defined to be an integer, fixed point, or floating point .Modern computers with 32-bit storage locations...

     floating point number
  • String - a unicode
    Unicode
    Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

     string
  • Color - an RGBA or CMYK quartet, or a Grayscale
    Grayscale
    In photography and computing, a grayscale or greyscale digital image is an image in which the value of each pixel is a single sample, that is, it carries only intensity information...

     value
  • Image - a 2D image of arbitrary (possibly infinite) dimensions
  • Structure - a named or ordered collection of objects, including nested structures
  • Virtual - any of the above


Two additional types were introduced in version 4.0:
  • Mesh - a collection of vertices, and per-vertex normals, texture coordinates, and colors in 3-space.
  • Interaction - a valueless type used to associate user input with user-interactive elements of the composition.

Type Conversion

Data can usually be converted to other types transparently. In Quartz Composer 3.0, the connections between patches change color to indicate conversions that are taking place. Yellow connections mean no conversion is taking place, Orange indicates a possible loss of data from conversion (Number to Index), and Red indicates a severe conversion; Image to Boolean, for example.

Compositions

Quartz Composer documents are called Compositions. Compositions are Binary Property Lists
Property list
In the Mac OS X, iOS, NeXTSTEP, and GNUstep programming frameworks, property list files are files that store serialized objects. Property list files use the filename extension .plist, and thus are often referred to as p-list files....

 (though XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

 versions are also supported) with a filename extension
Filename extension
A filename extension is a suffix to the name of a computer file applied to indicate the encoding of its contents or usage....

 .qtz, and a com.apple.quartz-​composer-composition UTI
Uniform Type Identifier
A Uniform Type Identifier is a text string used on software provided by Apple Inc. to uniquely identify a given class or type of item...

. Patches, their connections, and their input port states are saved in the composition file. Images can be stored inside a composition as well, making for self-contained compositions with embedded graphics. By dragging a movie file into the Quartz Composer editor, a reference to the movie file is created, providing a changing image that can be connected to a renderer.

Compositions also store metadata
Metadata
The term metadata is an ambiguous term which is used for two fundamentally different concepts . Although the expression "data about data" is often used, it does not apply to both in the same way. Structural metadata, the design and specification of data structures, cannot be about data, because at...

 such as composition author, copyright
Copyright
Copyright is a legal concept, enacted by most governments, giving the creator of an original work exclusive rights to it, usually for a limited time...

, and description. The user can also add arbitrary metadata items, if desired.

A wide variety of image formats are supported, including JPEG
JPEG
In computing, JPEG . The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. JPEG typically achieves 10:1 compression with little perceptible loss in image quality....

, JPEG2000, GIF
GIF
The Graphics Interchange Format is a bitmap image format that was introduced by CompuServe in 1987 and has since come into widespread usage on the World Wide Web due to its wide support and portability....

, PNG, TIFF, TGA
Truevision TGA
Truevision TGA, often referred to as TARGA, is a raster graphics file format created by Truevision Inc. . It was the native format of TARGA and VISTA boards, which were the first graphic cards for IBM-compatible PCs to support Highcolor/truecolor display...

, OpenEXR
OpenEXR
OpenEXR is a high dynamic range imaging image file format, released as an open standard along with a set of software tools created by Industrial Light and Magic , released under a free software license similar to the BSD license....

, BMP, ICO
ICO (icon image file format)
The ICO file format is an image file format for computer icons in Microsoft Windows. ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately...

, PDF, PICT
PICT
PICT is a graphics file format introduced on the original Apple Macintosh computer as its standard metafile format. It allows the interchange of graphics , and some limited text support, between Mac applications, and was the native graphics format of QuickDraw.The original version, PICT 1, was...

, ICNS
Apple Icon Image
The Apple Icon Image format is the icon format used in Apple Inc.'s Mac OS X. It supports icons of 16×16, 32×32, 48×48, 128×128, 256×256 and 512×512 pixels, with both 1- and 8-bit alpha channels and multiple image states...

, and some raw digital camera types. Images are maintained in their native form for as long as possible before rasterizing for display. This means that it will keep vector images as vectors when cropping, scaling, rotating, or translating. This allows it to work with very large logical image dimensions without consuming large amounts of memory or processing time. Such functionality is most apparent when working with text-based images, or PDFs.

Version 3.0 added the ability to add annotations to areas of the composition, called notes. These notes parallel comments
Comment (computer programming)
In computer programming, a comment is a programming language construct used to embed programmer-readable annotations in the source code of a computer program. Those annotations are potentially significant to programmers but typically ignorable to compilers and interpreters. Comments are usually...

 in other programming languages. Notes can be yellow, red, green, blue, or gray, and can overlap other notes.

Composition Protocols

In Version 3.0, the concept of Composition Protocols was introduced. Protocols provide a template of required and optional inputs and outputs to qualify conforming compositions for various purposes. The following protocols are available by default:
  • Graphic Animation - These don't have required inputs or outputs, but are required to render to the screen. Graphic Animations are useful for animated backgrounds in applications such as Keynote.
  • Image Filter - Modifies an image using filters. No renderers are allowed in Image Filters, unless they are inside of a Render In Image environment.
  • Graphic Transition - Generates a transition from a source image to a destination image over a fixed time interval.
  • RSS Visualizer - Parses and Displays an RSS
    RSS
    -Mathematics:* Root-sum-square, the square root of the sum of the squares of the elements of a data set* Residual sum of squares in statistics-Technology:* RSS , "Really Simple Syndication" or "Rich Site Summary", a family of web feed formats...

     Feed.
  • Screen Saver - Integrates with Finder for animated screen savers.
  • Music Visualizer - Integrates with iTunes
    ITunes
    iTunes is a media player computer program, used for playing, downloading, and organizing digital music and video files on desktop computers. It can also manage contents on iPod, iPhone, iPod Touch and iPad....

     for audio visualization.


One new protocol was added in version 4.0:
  • Mesh Filter - deforms an input mesh.


There is no officially supported way to add additional protocols to Quartz Composer. However, there are some undocumented methods that may make this possible in the future.

Composition Runtimes

In addition to protocols, compositions can also conform to different runtimes where Quartz Composer is available. In Leopard, there are runtimes for Tiger (32-bit), as well as 32-bit and 64-bit versions of the Leopard Quartz Composer runtime. The editor can also indicate used patches that are unsafe, or unavailable in Tiger to aid in making compatible compositions.

Composition Repository

A System-wide Composition Repository is available as of Version 3.0. This allows applications to share and make use of common compositions for effects and processing. It is also possible for applications to query the repository for compositions that match certain criteria, such as protocol conformance.

The Repository is spread across 3 file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

 locations:
  • /System/Library/Compositions - core system compositions (the user typically doesn't modify these)
  • /Library/Compositions - compositions available for all users
  • /Users/username/Library/Compositions - compositions available for only this user


Adding compositions to the repository is as simple as adding the composition file to one of these locations.

Comparing Compositions

It became possible to compare compositions in Quartz Composer 3.0. This feature allows the user to compare inputs, rendered output, and graph appearance of any two compositions.

Related Software

Quartz Composer has many similarities to Max/MSP or Vvvv
Vvvv
vvvv is a general purpose toolkit with a special focus on real time video synthesis and programming large media environments with physical interfaces, real-time motion graphics, audio and video...

 although its primary usage is for graphical rather than audio processing. The ability to construct interactive video compositions that react to audio or MIDI signals but which can be played from any QuickTime
QuickTime
QuickTime is an extensible proprietary multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. The classic version of QuickTime is available for Windows XP and later, as well as Mac OS X Leopard and...

-aware application has caused a great deal of interest in Quartz Composer from VJ
VJ (video performance artist)
VJing is a broad designation for realtime visual performance. Characteristics of VJing are the creation or manipulation of imagery in realtime through technological mediation and for an audience, in synchronization to music. VJing often takes place at events such as concerts, nightclubs, music...

s.

Quartz Composer Visualizer

A developer tool called Quartz Composer Visualizer was released with Quartz Composer 3.0 that allows compositions to be rendered across multiple screens on a single machine, or even spanned across several machines and displays.

Automator Support

Support for some Automator actions were added with the release of Leopard.
  • Apply Quartz Composition Filter to Image Files
  • Convert Quartz Compositions to QuickTime Movies
  • Render Quartz Compositions to Image Files

History

Pierre-Olivier Latour originally developed the predecessor to Quartz Composer under the name PixelShox Studio.

Books


Tutorials and Documentation


Mailing List


Compositions


Custom Patches / Plugins


Images and Videos

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK