Contents

CGDisplayCreateImage(_:rect:)

Returns an image containing the contents of a portion of the specified display.

Declaration

func CGDisplayCreateImage(_ display: CGDirectDisplayID, rect: CGRect) -> CGImage?

Parameters

  • display:

    The identifier of the display to be accessed.

  • rect:

    The rectangle, specified in display space, for the portion of the display being copied into the image.

Return Value

An image containing the contents of the specified rectangle. If the display ID is invalid, the return value is NULL. In Objective-C, you’re responsible for releasing the image created by calling CGImageRelease.

Discussion

The actual rectangle used is the rectangle returned by CGRectIntegral(_:) with rect as a parameter.

See Also

Functions