zoomBlur()
Creates a zoom blur centered around a single point on the image.
Declaration
class func zoomBlur() -> any CIFilter & CIZoomBlurReturn Value
The blurred image.
Discussion
This method applies the zoom blur filter to an image. This effect mimics the zoom of a camera when capturing the image.
The zoom blur filter uses the following properties:
amountA
floatrepresenting the zoom-in amount as an NSNumber.centerA set of coordinates marking the center of the image as a CGPoint.
inputImageA CIImage representing the input image to apply the filter to.
The following code creates a filter that adds a zoom blur to the input image:
func zoomBlur(inputImage: CIImage) -> CIImage? {
let zoomBlurFilter = CIFilter.zoomBlur()
zoomBlurFilter.inputImage = inputImage
zoomBlurFilter.amount = 5
zoomBlurFilter.center = CGPoint(x: 150, y: 150)
return zoomBlurFilter.outputImage
}[Image]