Mac Developer Library

Developer

Quartz Composer Reference Collection QCComposition Class Reference

Options
Deployment Target:

On This Page
Language:

QCComposition

The QCComposition class represents a Quartz Composer composition that either:

  • comes from the system-wide composition repository (/Library/Compositions and ~/Library/Compositions) where it can be accessed by any application through the methods of the QCCompositionRepository class

  • is created from an arbitrary source (typically a file on disk) using one of its methods

This class cannot be subclassed.

A QCComposition object has the following information associated with it and that you can obtain by using the appropriate method of the QCComposition class:

  • Attributes include the name and description of the composition, copyright information, and whether or not its provided by OS X (built-in).

  • The protocols that the composition conforms to. A composition protocol defines a set of required and optional input parameters and output results.

Many methods of the QCRenderer, QCCompositionLayer, and QCView classes take a QCComposition object as a parameter.

  • Returns a composition object initialized with a Quartz Composer composition file.

    Declaration

    + (QCComposition*) compositionWithFile:(NSString*)path;

    Parameters

    path

    A path to a file created with the Quartz Composer developer tool (.qtz extension).

    Return Value

    A Quartz Composer composition object or nil if there is an error.

  • Returns a composition object initialized with the contents of a Quartz Composer composition file.

    Declaration

    + (QCComposition*) compositionWithData:(NSData*)data;

    Parameters

    data

    The contents of a file created with the Quartz Composer developer tool.

    Return Value

    A Quartz Composer composition object or nil if there is an error.

  • Returns the attributes of the composition.

    Declaration

    - (NSDictionary*) attributes

    Return Value

    A dictionary of composition attributes. See “Attribute Keys” for the attributes that can be returned.

  • Returns the list of protocols to which the composition conforms.

    Declaration

    - (NSArray*) protocols

    Return Value

    A list of protocols. See “Standard Protocols”.

  • Returns the unique and persistent identifier for the composition from the composition repository.

    Declaration

    - (NSString*) identifier

    Return Value

    The unique identifier for the composition if it comes from the composition repository; nil otherwise.

  • Returns an array listing the keys that identify the input ports of the root patch of the composition.

    Declaration

    - (NSArray*) inputKeys

    Return Value

    An array of input keys.

  • Returns an array listing the keys that identify the output ports of the root patch of the composition.

    Declaration

    - (NSArray*) outputKeys

    Return Value

    An array of output keys.

  • Attributes of a composition.

    Declaration

    extern NSString* const QCCompositionAttributeNameKey; extern NSString* const QCCompositionAttributeDescriptionKey; extern NSString* const QCCompositionAttributeCopyrightKey; extern NSString* const QCCompositionAttributeBuiltInKey; extern NSString* const QCCompositionAttributeTimeDependentKey; extern NSString* const QCCompositionAttributeHasConsumersKey; extern NSString* const QCCompositionAttributeCategoryKey;

    Constants

    • QCCompositionAttributeNameKey

      The key for the composition name. The associated value is an NSString object.

    • QCCompositionAttributeDescriptionKey

      The key for the composition description. The associated value is an NSString object.

    • QCCompositionAttributeCopyrightKey

      The key for composition copyright information. The associated value is an NSString object.

    • QCCompositionAttributeBuiltInKey

      The key for the composition origin. The associated value is an NSNumber object that contains a Boolean value. YEStrue indicates the composition is built-in (provided by OS X).

    • QCCompositionAttributeTimeDependentKey

      The key for the composition time dependency. The associated value is an NSNumber object that contains a Boolean value. YEStrue indicates that the composition is time dependent.

    • QCCompositionAttributeHasConsumersKey

      The key for a composition that has consumer patches. The associated value is an NSNumber object that contains a Boolean value. YEStrue indicates that the composition has consumers.

    • QCCompositionAttributeCategoryKey

      The composition category. The associated value is a category constant. See Composition Categories.

  • Categories for compositions.

    Declaration

    extern NSString* const QCCompositionCategoryDistortion; extern NSString* const QCCompositionCategoryStylize; extern NSString* const QCCompositionCategoryUtility;

    Constants

    • QCCompositionCategoryDistortion

      A composition that produces a distortion effect.

    • QCCompositionCategoryStylize

      A composition that produces a stylize effect.

    • QCCompositionCategoryUtility

      A utility composition.

  • Input ports of a composition.

    Declaration

    extern NSString* const QCCompositionInputImageKey; extern NSString* const QCCompositionInputSourceImageKey; extern NSString* const QCCompositionInputDestinationImageKey; extern NSString* const QCCompositionInputRSSFeedURLKey; extern NSString* const QCCompositionInputRSSArticleDurationKey; extern NSString* const QCCompositionInputPreviewModeKey; extern NSString* const QCCompositionInputXKey; extern NSString* const QCCompositionInputYKey; extern NSString* const QCCompositionInputScreenImageKey; extern NSString* const QCCompositionInputAudioPeakKey; extern NSString* const QCCompositionInputAudioSpectrumKey; extern NSString* const QCCompositionInputTrackPositionKey; extern NSString* const QCCompositionInputTrackInfoKey; extern NSString* const QCCompositionInputTrackSignalKey; extern NSString* const QCCompositionInputPrimaryColorKey; extern NSString* const QCCompositionInputSecondaryColorKey; extern NSString* const QCCompositionInputPaceKey;

    Constants

    • QCCompositionInputImageKey

      An image input port whose key is inputImage.

    • QCCompositionInputSourceImageKey

      An image input port whose key is inputSourceImage.

    • QCCompositionInputDestinationImageKey

      An image input port whose key is inputDestinationImage.

    • QCCompositionInputRSSFeedURLKey

      A string input port whose key is inputRSSFeedURL. This port must be passed an http or feed scheme URL.

    • QCCompositionInputRSSArticleDurationKey

      A number input port whose key is inputRSSArticleDuration. The value must be expressed in seconds.

    • QCCompositionInputPreviewModeKey

      A Boolean input port whose key is inputPreviewMode. When the value of this input port is set to TRUE, the composition that provides this port must be able to run in a low-quality mode that produces a preview of the composition.

    • QCCompositionInputXKey

      A number input port whose key is inputX. The value must be normalized to the image width with the origin on the left.

    • QCCompositionInputYKey

      A number input port whose key is inputY. The value must be normalized to the image height with the origin at the bottom.

    • QCCompositionInputScreenImageKey

      An image input port whose key is inputScreenImage.

    • QCCompositionInputAudioPeakKey

      A number input port whose key is inputAudioPeak. The value must be in the [0,1] range as a mono signal with no decay applied.

    • QCCompositionInputAudioSpectrumKey

      A structure input port whose key is inputAudioSpectrum. The structure must contain 16 values in the [0,1] range representing 16 spectrum bands of the mono signal from low to high frequencies with no decay applied.

    • QCCompositionInputTrackPositionKey

      A number input port whose key is inputTrackPosition. The value must be expressed in seconds.

    • QCCompositionInputTrackInfoKey

      A structure input port whose key is inputTrackInfo. The structure contains optional entries, such as “name”, “artist”, "album", "duration", "artwork", and so on.

    • QCCompositionInputTrackSignalKey

      A Boolean input port whose key is inputTrackSignal.

    • QCCompositionInputPrimaryColorKey

      A color input port whose key is inputPrimaryColor.

    • QCCompositionInputSecondaryColorKey

      A color input port whose key is inputSecondaryColor.

    • QCCompositionInputPaceKey

      A number input port whose key is inputPace. The value must be in the [0,1] range.

  • Output ports of a composition.

    Declaration

    extern NSString* const QCCompositionOutputImageKey; extern NSString* const QCCompositionOutputWebPageURLKey;

    Constants

    • QCCompositionOutputImageKey

      An image output port whose key is outputImage.

    • QCCompositionOutputWebPageURLKey

      A string output port whose key is outputWebPageURL.

  • Protocols for a composition.

    Declaration

    extern NSString* const QCCompositionProtocolGraphicAnimation; extern NSString* const QCCompositionProtocolGraphicTransition; extern NSString* const QCCompositionProtocolImageFilter; extern NSString* const QCCompositionProtocolImageCompositor; extern NSString* const QCCompositionProtocolImageTransition; extern NSString* const QCCompositionProtocolScreenSaverRSS;

    Constants