---
title: "lockBufferRepresentation(withPixelFormat:colorSpace:forBounds:)"
framework: quartz
role: symbol
role_heading: Instance Method
path: "quartz/qcplugininputimagesource/lockbufferrepresentation(withpixelformat:colorspace:forbounds:)"
---

# lockBufferRepresentation(withPixelFormat:colorSpace:forBounds:)

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

## Declaration

```swift
func lockBufferRepresentation(withPixelFormat format: String!, colorSpace: CGColorSpace!, forBounds bounds: NSRect) -> Bool
```

## Parameters

- `format`: A pixel format that is compatible with the color space.
- `colorSpace`: A Quartz color space that is compatible with the pixel format.
- `bounds`: The bounds of the subregion, expressed as pixels, and aligned to integer boundaries.

## Return Value

Return Value true if successful; otherwise false.

## Discussion

Discussion The content of the buffer is read-only. You should not attempt to modify it.

## See Also

### Converting an Image to a Representation

- [lockTextureRepresentation(with:forBounds:)](quartz/qcplugininputimagesource/locktexturerepresentation(with:forbounds:).md)
- [unlockTextureRepresentation()](quartz/qcplugininputimagesource/unlocktexturerepresentation().md)
- [bindTextureRepresentation(toCGLContext:textureUnit:normalizeCoordinates:)](quartz/qcplugininputimagesource/bindtexturerepresentation(tocglcontext:textureunit:normalizecoordinates:).md)
- [unbindTextureRepresentation(fromCGLContext:textureUnit:)](quartz/qcplugininputimagesource/unbindtexturerepresentation(fromcglcontext:textureunit:).md)
- [unlockBufferRepresentation()](quartz/qcplugininputimagesource/unlockbufferrepresentation().md)
