Contents

perspectiveTile()

Tiles an image by adjusting the perspective of the image.

Declaration

class func perspectiveTile() -> any CIFilter & CIPerspectiveTile

Return Value

The tiled image.

Discussion

This method applies the perspective tile filter to an image. The effect adjusts the perspective of the image and then tiles the result.

The perspective tile filter uses the following properties:

inputImage

An image with the type CIImage.

topLeft

A CGPoint of the input image mapped to the top-left corner of the tile.

topRight

A CGPoint of the input image mapped to the top-right corner of the tile.

bottomLeft

A CGPoint of the input image mapped to the bottom-left corner of the tile.

bottomRight

A CGPoint of the input image mapped to the bottom-right corner of the tile.

The following code creates a filter that tiles the image and adjusts the perspective to add depth:

func perspective(inputImage: CIImage) -> CIImage {
    let perspectiveTile = CIFilter.perspectiveTile()
    perspectiveTile.inputImage = inputImage
    perspectiveTile.topLeft = CGPoint(x: 118, y: 484)
    perspectiveTile.topRight = CGPoint(x: 646, y: 507)
    perspectiveTile.bottomLeft = CGPoint(x: 548, y: 140)
    perspectiveTile.bottomRight = CGPoint(x: 155, y: 153)
    return perspectiveTile.outputImage!
}

[Image]

See Also

Filters