Protocol

QCPlugInOutputImageProvider

The QCPlugInOuputImageProvider protocol eliminates the need to use explicit image types for the image output ports on a custom patch. The methods in this protocol are called by the Quartz Composer engine when the output image is needed. If your custom patch has an image output port, you need to implement the appropriate methods for rendering image data and to supply information about the rendering destination and the image bounds.

Declaration

@protocol QCPlugInOutputImageProvider

Overview

Output images are opaque provider objects that comply to this protocol. To create an image output port as an Objective-C 2.0 property, declare it as follows:

@property(dynamic) id<QCPlugInOutputImageProvider> outputImage;

To create an image input port dynamically use the type QCPortTypeImage:

[self addOutputPortWithType:QCPortTypeImage
                    forKey:@”outputImage”
            withAttributes:nil];

To write images to that port, you need to implement the methods in this protocol and create an internal class that represents the images produced by the custom patch. For example, a simple interface for an image provider is:

@interface MyOutputImage : NSObject <QCPlugInOutputImageProvider>
{
    NSUInteger _width;
    NSUInteger _height;
}

Topics

Rendering an Image to a Destination

- renderToBuffer:withBytesPerRow:pixelFormat:forBounds:

Renders a subregion of the image into the supplied memory buffer using the specified pixel format.

- copyRenderedTextureForCGLContext:pixelFormat:bounds:isFlipped:

Returns the name of an OpenGL texture of type GL_TEXTURE_RECTANGLE_EXT that contains a subregion of the image in a given pixel format.

- renderWithCGLContext:forBounds:

Renders a subregion of the image to the provided CGL context.

- releaseRenderedTexture:forCGLContext:

Releases the previously copied texture.

Providing Information About the Image

- imageBounds

Returns the bounds of the image expressed in pixels and aligned to integer boundaries.

Required.

- imageColorSpace

Returns the color space of the image or NULL if the image should not be color matched.

Required.

- shouldColorMatch

Returns whether the image should be color matched.

Providing Information About the Rendering Destination

- supportedBufferPixelFormats

Returns a list of pixel formats that are supported for rendering to a memory buffer.

- supportedRenderedTexturePixelFormats

Returns a list of pixel formats that are supported for rendering to an onscreen OpenGL context.

- canRenderWithCGLContext:

Returns whether the image data can be rendered into the provided CGL context.