Sets whether the receiver retains its source image data.
SDK
macOS 10.0–10.6Deprecated
Framework
AppKit
Declaration
- (void)setDataRetained:(BOOL)flag;
Parameters
flag
YES if you want the source image data to be retained; otherwise NO.
Discussion
Retention of the source image data is important if the source of the image data could change, be moved, or be deleted. Data retention is also useful if you plan to resize an image frequently; otherwise, resizing occurs on a cached copy of the image, which can lose image quality during successive scaling operations. With data retention enabled, the image is resized from the original source data.
If the responsibility for drawing the image is delegated to another object, there is no reason to retain the image data. Similarly, if the source of the image data is not expected to change or you do not plan to resize the image, you do not need to retain the data. In fact, retaining the data leads to increased memory usage, which could have a negative impact on performance.
If you create your image object using the initByReferencingFile: method, the only data retained is the name of the source file.