Contents

ninePartTiled()

Distorts an image by tiling portions of it.

Declaration

class func ninePartTiled() -> any CIFilter & CINinePartTiled

Return Value

The distorted image.

Discussion

This method applies the nine-part tiled filter to an image. This effect distorts an image by tiling an image based on the breakpoints properties.

The nine-part tiled filter uses the following properties:

inputImage

An image with the type CIImage.

flipYTiles

A Boolean value representing if the y-axis should be flipped.

growAmount

A CGPoint representing the amount of stretching applied.

breakpoint1

A CGPoint representing the upper-right corner of the image to retain after tiling ends.

breakpoint0

A CGPoint representing the lower-left corner of image to retain before stretching begins.

The following code creates a filter that results in distorted tiles of the image becoming flipped:

func ninePartTiled(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.ninePartTiled()
    filter.inputImage = inputImage
    filter.setDefaults()
    filter.breakpoint0 = CGPoint(x: 200, y: 200)
    filter.breakpoint1 = CGPoint(x: inputImage.extent.size.width-200, y: inputImage.extent.size.height - 200)
    filter.growAmount = CGPoint(x: 500, y: 500)
    return filter.outputImage!
}

[Image]

See Also

Filters