Contents

glassLozenge()

Creates a lozenge-shaped lens and distorts the image.

Declaration

class func glassLozenge() -> any CIFilter & CIGlassLozenge

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

inputImage

An image with the type CIImage.

radius

A float representing the radius of the lozenge distortion as an NSNumber.

refraction

A float representing the refraction of the glass as an NSNumber.

inputPoint1

A CGPoint representing the x and y positions that define the center of the circle at the first end of the lozenge.

inputPoint2

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

See Also

Filters