Instance Method

initWithCGImage:size:

Initializes and returns an image object using the contents of a Core Graphics image.

Declaration

- (instancetype)initWithCGImage:(CGImageRef)cgImage size:(NSSize)size;

Parameters

cgImage

The source CGImage.

size

The size of the new image. If size is NSZeroSize, the pixel dimensions of cgImage are assumed as the image’s size.

Return Value

An initialized NSImage object.

Discussion

You should not assume anything about the image, other than that drawing it is equivalent to drawing the CGImage.

This is not a designated initializer.

See Also

Creating an Image from Existing Data

- initWithData:

Initializes and returns an image object using the provided image data.

- initWithDataIgnoringOrientation:

Initializes and returns an image object using the provided image data and ignoring the EXIF orientation tags.

- initWithPasteboard:

Initializes and returns an image object with data from the specified pasteboard.

- initWithIconRef:

Initializes the image object with a Carbon-style icon resource.

Deprecated