Contents

roundedRectangleStrokeGenerator()

Creates an image containing the outline of a rounded rectangle.

Declaration

class func roundedRectangleStrokeGenerator() -> any CIFilter & CIRoundedRectangleStrokeGenerator

Return Value

A CIImage containing the stroked rectangle.

Discussion

This filter creates an outline of a rounded rectangle.

The filter takes the following properties:

extent

A CGRect containing the position and size of the rectangle.

width

The width of the stroke to draw.

radius

The corner radius.

The following code generates an image containing a stroked rounded rectangle:

func roundedRectangleStroke() -> CIImage {
    let filter = CIFilter.roundedRectangleStrokeGenerator()
    filter.extent = CGRect(x: 0, y: 0, width: 200, height: 100)
    filter.color = CIColor.red
    filter.width = 5
    filter.radius = 20
    return filter.outputImage!
}

[Image]

See Also

Filters