Contents

setScalesWhenResized:

Sets whether to scale different-sized image representations to fit the image’s size.

Declaration

- (void) setScalesWhenResized:(BOOL) flag;

Parameters

  • flag:

    True if image representations are scaled to fit; otherwise False.

Discussion

Most images (especially those loaded from files and URLs) contain only a single image representation whose size is the same as the receiver. It is possible to add image representations using the addRepresentation(_:) or addRepresentations(_:) methods but doing so is rarely necessary because modern hardware is powerful enough to resize and scale images quickly. The only reason to consider creating new representations is if each representations contains a customized version of the image at a specific size. (TIFF images may also contain a thumbnail version of an image, which is stored using a separate image representation.) If you pass true in the flag parameter, and subsequently assign a new value to the size property, all such image representations would be scaled to the same size. Scaling of bitmap images usually results in the interpolation of the bitmap data.

This method does not invalidate the caches of any of the receiver’s image representations. The caches are not invalidated until you change the image size using the size property. Scaling affects only the cached offscreen data for a given image representation.

See Also

Related Documentation

Instance Methods