Introduction to Quartz Composer Custom Patch Programming Guide
A patch is one of the basic elements of the Quartz Composer development tool. Similar to routines in traditional programming languages, patches are base processing units. They execute and produce a result. In OS X v10.4, all patches were built-in to Quartz Composer. Starting in OS X v10.5, you can create custom patches and package them as a Quartz Composer plug-in. After a plug-in is installed in the appropriate directory, the patches contained in it are available to use in the Quartz Composer workspace and by most Quartz Composer clients, and can be used in the same manner that you use built-in patches.
This document shows how to create custom patches and package them as Quartz Composer plug-ins. You’ll see how to code a variety of patches from a simple string-processing patch to one that renders using OpenGL.
Anyone who uses the Quartz Composer development tool and wants to create a custom patch should read this document. To get the most out of this document, you’ll need to be familiar with Quartz Composer User Guide. You’ll also need to know how to use Xcode to create an Objective-C project. Although Quartz Composer uses OpenGL when it renders, you don’t need to know OpenGL to write a custom patch unless you want to create a custom patch that renders on the GPU. This document shows how to write both non-rendering and rendering custom patches.
You can use the properties feature of Objective-C 2.0 when creating a custom patch. If you are unfamiliar with properties, you’ll want to read about them before you start writing custom patches. This feature is a time saver that eliminates the need to write accessor methods. All the examples in this document use properties. See The Objective-C Programming Language.
Organization of This Document
This document is organized into the following chapters:
“The Basics of Custom Patches” describes how the patches that appear in Quartz Composer relate to the code that generates a custom patch. It provides an overview of the tasks needed to create a custom patch and package it as a plug-in. It also describes the Xcode templates that you can use to write custom patches.
“Writing Processor Patches” shows how to write three patches that process data—one that processes a string, another that converts a numeric value to a color, and another that shows how to configure a parameter that can’t be represented by one of the standard port data types.
“Writing Image Processing Patches” describes how to use input and output image protocols to create a patch that produces an image by operating on two input images.
“Writing Consumer Patches” discusses how to use OpenGL in a custom patch and provides instructions for writing a patch that renders a quad that you can animate.
The following resources are valuable to anyone writing a custom patch and packaging it as a Quartz Composer plug-in:
Several of the sample code projects in
/Developer/Examples/Quartz Composer/Pluginsare custom patch projects.
Quartz Composer User Guide describes the development tool and how to use it to create compositions.
Quartz Composer Programming Guide shows how to perform programming tasks using the Quartz Composer framework.
Quartz Composer Reference Collection describes all the classes and protocols in the Quartz Composer API. You’ll need to refer to this documentation as you write Quartz Composer custom patches.
Key-Value Coding Programming Guide contains valuable information for anyone who is unfamiliar this mechanism for getting and setting values.
© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-03-24)