stripesGenerator()
Generates a line of stripes as an image
Declaration
class func stripesGenerator() -> any CIFilter & CIStripesGeneratorReturn Value
The generated image.
Discussion
This method generates a vertical stripped line pattern as an image.
The stripes generator filter uses the following properties:
centerA CIVector representing the center of the image.
color0A CIColor representing the stripes color.
color1A CIColor representing the background color.
widthA
floatrepresenting the width of the lines as an NSNumber.sharpnessA
floatrepresenting 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
attributedTextImageGenerator()aztecCodeGenerator()barcodeGenerator()blurredRectangleGenerator()checkerboardGenerator()code128BarcodeGenerator()lenticularHaloGenerator()meshGenerator()pdf417BarcodeGenerator()qrCodeGenerator()randomGenerator()roundedRectangleGenerator()roundedRectangleStrokeGenerator()starShineGenerator()sunbeamsGenerator()