perspectiveTile()
Tiles an image by adjusting the perspective of the image.
Declaration
class func perspectiveTile() -> any CIFilter & CIPerspectiveTileReturn 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:
inputImageAn image with the type CIImage.
topLeftA CGPoint of the input image mapped to the top-left corner of the tile.
topRightA CGPoint of the input image mapped to the top-right corner of the tile.
bottomLeftA CGPoint of the input image mapped to the bottom-left corner of the tile.
bottomRightA 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]