---
title: "setCacheDepthMatchesImageDepth:"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsimage/setcachedepthmatchesimagedepth:"
---

# setCacheDepthMatchesImageDepth:

Sets whether the image’s offscreen window caches use the same bit depth as the image data itself.

## Declaration

```occ
- (void) setCacheDepthMatchesImageDepth:(BOOL) flag;
```

## Parameters

- `flag`: doc://com.apple.documentation/documentation/Swift/true if the offscreen caches use the same bit-depth associated with the image data; otherwise, doc://com.apple.documentation/documentation/Swift/false to indicate they should use the default bit depth.

## Discussion

Discussion This method does not cause the receiver to recache itself. The default depth limit is equal to the bit depth of the deepest screen on the system.

## See Also

### Related Documentation

- [recache()](appkit/nsimage/recache().md)
- [lockFocus()](appkit/nsimage/lockfocus().md)
- [cacheDepthMatchesImageDepth](appkit/nsimage/cachedepthmatchesimagedepth.md)

### Instance Methods

- [lockFocus()](appkit/nsimage/lockfocus().md)
- [lockFocusFlipped(_:)](appkit/nsimage/lockfocusflipped(_:).md)
- [unlockFocus()](appkit/nsimage/unlockfocus().md)
- [init(iconRef:)](appkit/nsimage/init(iconref:).md)
- [lockFocusOnRepresentation:](appkit/nsimage/lockfocusonrepresentation:.md)
- [bestRepresentationForDevice:](appkit/nsimage/bestrepresentationfordevice:.md)
- [compositeToPoint:operation:](appkit/nsimage/compositetopoint:operation:.md)
- [compositeToPoint:fromRect:operation:](appkit/nsimage/compositetopoint:fromrect:operation:.md)
- [compositeToPoint:fromRect:operation:fraction:](appkit/nsimage/compositetopoint:fromrect:operation:fraction:.md)
- [compositeToPoint:operation:fraction:](appkit/nsimage/compositetopoint:operation:fraction:.md)
- [dissolveToPoint:fraction:](appkit/nsimage/dissolvetopoint:fraction:.md)
- [dissolveToPoint:fromRect:fraction:](appkit/nsimage/dissolvetopoint:fromrect:fraction:.md)
- [setScalesWhenResized:](appkit/nsimage/setscaleswhenresized:.md)
- [scalesWhenResized](appkit/nsimage/scaleswhenresized.md)
- [setDataRetained:](appkit/nsimage/setdataretained:.md)
