Protocol

QCPlugInInputImageSource

The QCPlugInInputImageSource protocol eliminates the need to use explicit image types for the image input ports on your custom patch. Not only does using the protocol avoid restrictions of a specific image type, but it avoids impedance mismatches, and provides better performance by deferring pixel computation until it is needed. When you need to access the pixels in an image, you simply convert the image to a representation (texture or buffer) using one of the methods defined by the QCPlugInInputImageSource protocol. Use a texture representation when you want to use input images on the GPU. Use a buffer representation when you want to use input images on the CPU.

Declaration

@protocol QCPlugInInputImageSource

Overview

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

@property(dynamic) id<QCPlugInInputImageSource> inputImage;

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

[self addInputPortWithType:QCPortTypeImage
                    forKey:@”inputImage”
            withAttributes:nil];

Topics

Converting an Image to a Representation

- lockTextureRepresentationWithColorSpace:forBounds:

Creates an OpenGL texture representation from a subregion of the image source using the provided color space.

Required.

- unlockTextureRepresentation

Releases the OpenGL texture representation of the image source.

Required.

- lockBufferRepresentationWithPixelFormat:colorSpace:forBounds:

Creates a memory buffer representation from a subregion of the image source using the provided pixel format and color space.

Required.

- bindTextureRepresentationToCGLContext:textureUnit:normalizeCoordinates:

Binds the texture to a given texture unit and optionally scales or flips the texture.

Required.

- unbindTextureRepresentationFromCGLContext:textureUnit:

Unbinds the texture from a texture unit.

Required.

- unlockBufferRepresentation

Releases the memory buffer representation of the image source.

Required.

Getting Color Space Information

- imageColorSpace

Returns the color space of the image source.

Required.

- shouldColorMatch

Returns whether or not the image source should be color matched.

Required.

Getting Texture Information

- texturePixelsWide

Returns the width of the texture representation.

Required.

- texturePixelsHigh

Returns the height of the texture representation.

Required.

- textureTarget

Returns the texture target.

Required.

- textureName

Returns the texture name.

Required.

- textureColorSpace

Returns the color space of the texture representation.

Required.

- textureFlipped

Returns whether or not the contents of the texture are flipped vertically.

Required.

- textureMatrix

Returns a texture matrix.

Required.

Getting Image Buffer Information

- imageBounds

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

Required.

- bufferPixelsWide

Returns the width of the image buffer representation.

Required.

- bufferPixelsHigh

Returns the height of the image buffer representation.

Required.

- bufferPixelFormat

Returns the pixel format of the image buffer representation.

Required.

- bufferColorSpace

Returns the color space of the image buffer representation.

Required.

- bufferBaseAddress

Returns the base address of the image buffer.

Required.

- bufferBytesPerRow

Returns the bytes per row of the buffer representation.

Required.