<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.15.0"
  ],
  "documentType" : "symbol",
  "framework" : "Quartz",
  "identifier" : "/documentation/Quartz/QCPlugInInputImageSource",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Quartz"
    ],
    "preciseIdentifier" : "c:objc(pl)QCPlugInInputImageSource"
  },
  "title" : "QCPlugInInputImageSource"
}
-->

# 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.

```
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:

```objc
@property(dynamic) id<QCPlugInInputImageSource> inputImage;
```

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

```objc
[self addInputPortWithType:QCPortTypeImage
                    forKey:@"inputImage"
            withAttributes:nil];
```

## Topics

### Converting an Image to a Representation

[`lockTextureRepresentation(with:forBounds:)`](/documentation/Quartz/QCPlugInInputImageSource/lockTextureRepresentation(with:forBounds:))

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

[`unlockTextureRepresentation()`](/documentation/Quartz/QCPlugInInputImageSource/unlockTextureRepresentation())

Releases the OpenGL texture representation of the image source.

[`lockBufferRepresentation(withPixelFormat:colorSpace:forBounds:)`](/documentation/Quartz/QCPlugInInputImageSource/lockBufferRepresentation(withPixelFormat:colorSpace:forBounds:))

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

[`bindTextureRepresentation(toCGLContext:textureUnit:normalizeCoordinates:)`](/documentation/Quartz/QCPlugInInputImageSource/bindTextureRepresentation(toCGLContext:textureUnit:normalizeCoordinates:))

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

[`unbindTextureRepresentation(fromCGLContext:textureUnit:)`](/documentation/Quartz/QCPlugInInputImageSource/unbindTextureRepresentation(fromCGLContext:textureUnit:))

Unbinds the texture from a texture unit.

[`unlockBufferRepresentation()`](/documentation/Quartz/QCPlugInInputImageSource/unlockBufferRepresentation())

Releases the memory buffer representation of the image source.

### Getting Color Space Information

[`imageColorSpace()`](/documentation/Quartz/QCPlugInInputImageSource/imageColorSpace())

Returns the color space of the image source.

[`shouldColorMatch()`](/documentation/Quartz/QCPlugInInputImageSource/shouldColorMatch())

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

### Getting Texture Information

[`texturePixelsWide()`](/documentation/Quartz/QCPlugInInputImageSource/texturePixelsWide())

Returns the width of the texture representation.

[`texturePixelsHigh()`](/documentation/Quartz/QCPlugInInputImageSource/texturePixelsHigh())

Returns the height of the texture representation.

[`textureTarget()`](/documentation/Quartz/QCPlugInInputImageSource/textureTarget())

Returns the texture target.

[`textureName()`](/documentation/Quartz/QCPlugInInputImageSource/textureName())

Returns the texture name.

[`textureColorSpace()`](/documentation/Quartz/QCPlugInInputImageSource/textureColorSpace())

Returns the color space of the texture representation.

[`textureFlipped()`](/documentation/Quartz/QCPlugInInputImageSource/textureFlipped())

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

[`textureMatrix()`](/documentation/Quartz/QCPlugInInputImageSource/textureMatrix())

Returns a texture matrix.

### Getting Image Buffer Information

[`imageBounds()`](/documentation/Quartz/QCPlugInInputImageSource/imageBounds())

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

[`bufferPixelsWide()`](/documentation/Quartz/QCPlugInInputImageSource/bufferPixelsWide())

Returns the width of the image buffer representation.

[`bufferPixelsHigh()`](/documentation/Quartz/QCPlugInInputImageSource/bufferPixelsHigh())

Returns the height of the image buffer representation.

[`bufferPixelFormat()`](/documentation/Quartz/QCPlugInInputImageSource/bufferPixelFormat())

Returns the pixel format of the image buffer representation.

[`bufferColorSpace()`](/documentation/Quartz/QCPlugInInputImageSource/bufferColorSpace())

Returns the color space of the image buffer representation.

[`bufferBaseAddress()`](/documentation/Quartz/QCPlugInInputImageSource/bufferBaseAddress())

Returns the base address of the image buffer.

[`bufferBytesPerRow()`](/documentation/Quartz/QCPlugInInputImageSource/bufferBytesPerRow())

Returns the  bytes per row of the buffer representation.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)