Contents

bumpDistortionLinear()

Linearly distorts an image with a concave or convex bump.

Declaration

class func bumpDistortionLinear() -> any CIFilter & CIBumpDistortionLinear

Return 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:

inputImage

An image with the type CIImage.

radius

A float representing the amount of pixels the filter uses to create the distortion as an NSNumber.

center

A set of coordinates marking the center of the image as a CGPoint.

scale

A float representing the curvature of the bump effect as an NSNumber.

angle

A float representing 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]

See Also

Filters