<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCachedImageRep",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCachedImageRep"
  },
  "title" : "NSCachedImageRep"
}
-->

# NSCachedImageRep

An object that stores image data in a form that can be readily transferred to the screen.

```
@interface NSCachedImageRep : NSImageRep
```

## Overview

An [`NSCachedImageRep`](/documentation/AppKit/NSCachedImageRep) object differs from other image representation objects in that it simply stores the already rendered image, whereas other image representation objects generally have knowledge about how to render the image from source data.

You typically do not use this class directly. Instead, [`NSImage`](/documentation/AppKit/NSImage) and its other image representation objects create instances of [`NSCachedImageRep`](/documentation/AppKit/NSCachedImageRep) as needed to cache versions of the rendered image. This caching speeds up screen-based drawing for existing images during subsequent rendering operations. Cached image representations are also used to capture drawing commands for images created programmatically by locking focus on an image.

## Topics

### Initializing Cached Representations of Images

[`-  initWithSize:depth:separate:alpha:`](/documentation/AppKit/NSCachedImageRep/initWithSize:depth:separate:alpha:)

Returns a cached image representation initialized with the specified image characteristics.

[`-  initWithWindow:rect:`](/documentation/AppKit/NSCachedImageRep/initWithWindow:rect:)

Returns a cached image representation initialized for drawing in the specified window.

### Getting Data

[`-  rect`](/documentation/AppKit/NSCachedImageRep/rect)

Returns the rectangle where the representation is cached.

[`-  window`](/documentation/AppKit/NSCachedImageRep/window)

Returns the window where the representation is cached.

## Relationships

### Inherits From

[`NSImageRep`](/documentation/AppKit/NSImageRep)

---

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)