Contents

blurredRectangleGenerator()

Generates a blurred rectangle.

Declaration

class func blurredRectangleGenerator() -> any CIFilter & CIBlurredRectangleGenerator

Return Value

A CIImage containing a blurred rectangle.

Discussion

Creates a CIImage containing a blurred rectangle. The resulting image size is the extent of the rectangle plus any additional space required for the blur effect.

The blurred rectangle filter uses the following properties:

extent

A CGRect that defines the extent of the effect.

color

A CIColor specifying the color of the rectangle.

sigma

A float specifying the sigma for the Gaussian blur.

The following code creates a filter that generates a blurred red rectangle with a width of 200 x 100 pixels.

func blurredRectangle() -> CIImage {
    let filter = CIFilter.blurredRectangleGenerator()
    filter.extent = CGRect(x: 0, y: 0, width: 200, height: 100)
    filter.color = CIColor.red
    filter.sigma = 10.0
    return filter.outputImage!
}

[Image]

See Also

Filters