ninePartStretched()
Distorts an image by stretching it between two breakpoints.
Declaration
class func ninePartStretched() -> any CIFilter & CINinePartStretchedReturn Value
The distorted image.
Discussion
This method applies the nine-part stretched filter to an image. This effect distorts an image by stretching an image to the breakpoint properties while distorting the image based on the grow amount.
The nine-part stretched filter uses the following properties:
inputImageAn image with the type CIImage.
growAmountA CGPoint representing the amount of stretching applied.
breakpoint0A CGPoint representing the lower-left corner of the image to retain before stretching begins.
breakpoint1A CGPoint representing the upper-right corner of the image to retain after stretching ends.
The following code creates a filter that results in a significantly warped image:
func ninePartStretch(inputImage: CIImage) -> CIImage {
let filter = CIFilter.ninePartStretched()
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]