triangleTile()
Tiles a triangular area of an image.
Declaration
class func triangleTile() -> any CIFilter & CITriangleTileReturn Value
The tiled image.
Discussion
This method applies the triangle tile filter to an image. The effect creates a tiled pattern from a triangular area from the input image.
The triangle 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.
The following code creates a filter that produces a triangle of the input image and tiles the result:
func triangle(inputImage: CIImage) -> CIImage {
let triangleTile = CIFilter.triangleTile()
triangleTile.setValue(inputImage, forKey: kCIInputImageKey)
triangleTile.center = CGPoint(x: 2016, y: 1512)
triangleTile.angle = 1
triangleTile.width = 250
return triangleTile.outputImage!
}[Image]