Function

CGContextDrawTiledImage

Repeatedly draws an image, scaled to the provided rectangle, to fill the current clip region.

Declaration

void CGContextDrawTiledImage(CGContextRef c, CGRect rect, CGImageRef image);

Parameters

context

The graphics context in which to draw the image.

rect

A rectangle that specifies the origin and size of the destination tile. The image is scaled—disproportionately, if necessary—to fit the bounds specified by the rect parameter.

image

The image to draw.

Discussion

Core Graphics draws the scaled image starting at the origin of the rectangle in user space, then moves to a new point (horizontally by the width of the tile and/or vertically by the height of the tile), draws the scaled image, moves again, draws again, and so on, until the current clip region is tiled with copies of the image. Unlike patterns, the image is tiled in user space, so transformations applied to the CTM affect the final result.

See Also

Drawing an Image to a Graphics Context

CGContextDrawImage

Draws an image into a graphics context.