opTile()
Produces an effect that mimics a style of visual art that uses optical illusions.
Declaration
class func opTile() -> any CIFilter & CIOpTileReturn Value
The tiled image.
Discussion
This filter extracts a tile from the image, applies any specified scaling and rotation, and then assembles the image again to give an optical illusion effect.
The optical illusion tile filter uses the following properties:
inputImageAn image with the type CIImage.
centerA set of coordinates marking the center of the image as a CGPoint.
angleA
floatrepresenting the direction of distortion, in radians as an NSNumber.widthA
floatrepresenting the set width of each tile as an NSNumber.scaleA
floatrepresenting the scale of numbers of tiles in the output image as an NSNumber.
The following code creates a filter that results in a distorted image with less detail:
func op(inputImage: CIImage) -> CIImage {
let opTile = CIFilter.opTile()
opTile.inputImage = inputImage
opTile.center = CGPoint(x: 150, y: 150)
opTile.scale = 2.80
opTile.angle = 0
opTile.width = 65
return opTile.outputImage!
}[Image]