bumpDistortionLinear()
Linearly distorts an image with a concave or convex bump.
Declaration
class func bumpDistortionLinear() -> any CIFilter & CIBumpDistortionLinearReturn Value
The distorted image.
Discussion
This method applies the bump distortion linear filter to an image. This effect creates a concave or convex bump to a linear portion of the image. The curvature of the bump is defined by the scale property. A value of 0.0 has no effect, while a positive value creates an outward curvature and a negative value creates an inward curvature.
The bump distortion linear filter uses the following properties:
inputImageAn image with the type CIImage.
radiusA
floatrepresenting the amount of pixels the filter uses to create the distortion as an NSNumber.centerA set of coordinates marking the center of the image as a CGPoint.
scaleA
floatrepresenting the curvature of the bump effect as an NSNumber.angleA
floatrepresenting the angle of the distortion, in radians, as an NSNumber.
The following code creates a filter that results in a vertical bump distorting the image:
func bumpDistortionLinear(inputImage: CIImage) -> CIImage {
let filter = CIFilter.bumpDistortionLinear()
filter.inputImage = inputImage
filter.center = CGPoint(x: inputImage.extent.midX, y: inputImage.extent.midY)
filter.radius = 500
filter.scale = 0.2
filter.angle = .pi/2
return filter.outputImage!
}[Image]