Contents

opTile()

Produces an effect that mimics a style of visual art that uses optical illusions.

Declaration

class func opTile() -> any CIFilter & CIOpTile

Return 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:

inputImage

An image with the type CIImage.

center

A set of coordinates marking the center of the image as a CGPoint.

angle

A float representing the direction of distortion, in radians as an NSNumber.

width

A float representing the set width of each tile as an NSNumber.

scale

A float representing 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]

See Also

Filters