Contents

draw(_:in:byTiling:)

Draws an image in the specified area.

Declaration

func draw(_ image: CGImage, in rect: CGRect, byTiling: Bool = false)

Parameters

  • image:

    The image to draw.

  • rect:

    The rectangle, in user space coordinates, in which to draw the image.

  • byTiling:

    If True, this method fills the context’s entire clipping region by tiling many copies of the image, and the rect parameter defines the origin and size of the tiling pattern.

    If False (the default), this method draws a single copy of the image in the area defined by the rect parameter.

Discussion

This method scales the image (disproportionately, if necessary) to fit the bounds specified by the rect parameter.When the byTiling parameter is true, the image is tiled in user space—thus, unlike when drawing with patterns, the current transformation (see the ctm property) affects the final result.

See Also

Drawing Images and PDF Content