glassLozenge()
Creates a lozenge-shaped lens and distorts the image.
Declaration
class func glassLozenge() -> any CIFilter & CIGlassLozengeReturn Value
The distorted image.
Discussion
This method applies the glass lozenge filter to an image. This effect distorts an image by creating a lozenge shape placed over the input image.
The absolute threshold filter uses the following properties:
inputImageAn image with the type CIImage.
radiusA
floatrepresenting the radius of the lozenge distortion as an NSNumber.refractionA
floatrepresenting the refraction of the glass as an NSNumber.inputPoint1A CGPoint representing the x and y positions that define the center of the circle at the first end of the lozenge.
inputPoint2A CGPoint representing the x and y positions that define the center of the circle at the second end of the lozenge.
The following code creates a filter that results in a large glass lozenge distorting the image:
func glassLozenge(inputImage: CIImage) -> CIImage {
let filter = CIFilter.glassLozenge()
filter.inputImage = inputImage
filter.refraction = 1.7
filter.point0 = CGPoint(x: 150, y: 1050)
filter.point1 = CGPoint(x: 3050, y: 150)
return filter.outputImage!
}[Image]