Contents

stripesGenerator()

Generates a line of stripes as an image

Declaration

class func stripesGenerator() -> any CIFilter & CIStripesGenerator

Return Value

The generated image.

Discussion

This method generates a vertical stripped line pattern as an image.

The stripes generator filter uses the following properties:

center

A CIVector representing the center of the image.

color0

A CIColor representing the stripes color.

color1

A CIColor representing the background color.

width

A float representing the width of the lines as an NSNumber.

sharpness

A float representing the sharpness of the lines as an NSNumber.

The following code creates a filter that generates a black and white vertical striped image:

func stripes() -> CIImage {
    let stripesGenerator = CIFilter.stripesGenerator()
    stripesGenerator.center = CGPoint(x: 150, y: 150)
    stripesGenerator.color0 = .white
    stripesGenerator.color1 = .black
    stripesGenerator.width = 80
    stripesGenerator.sharpness = 1
    return stripesGenerator.outputImage!
}

[Image]

See Also

Filters