---
title: "lockTextureRepresentation(with:forBounds:)"
framework: quartz
role: symbol
role_heading: Instance Method
path: "quartz/qcplugininputimagesource/locktexturerepresentation(with:forbounds:)"
---

# lockTextureRepresentation(with:forBounds:)

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

## Declaration

```swift
func lockTextureRepresentation(with colorSpace: CGColorSpace!, forBounds bounds: NSRect) -> Bool
```

## Parameters

- `colorSpace`: A Quartz color space.
- `bounds`: The bounds of the subregion, expressed in pixels. They must be aligned to integer boundaries.

## Return Value

Return Value true is successful; false if texture can’t be created.

## Discussion

Discussion Neither the content of the texture nor its states (for example, the wrap mode) must be modified; you can only draw with it. The texture is valid only in the plug-in context.

## See Also

### Converting an Image to a Representation

- [unlockTextureRepresentation()](quartz/qcplugininputimagesource/unlocktexturerepresentation().md)
- [lockBufferRepresentation(withPixelFormat:colorSpace:forBounds:)](quartz/qcplugininputimagesource/lockbufferrepresentation(withpixelformat:colorspace:forbounds:).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)
