checkerboardGenerator()
Generates a checkerboard image.
Declaration
class func checkerboardGenerator() -> any CIFilter & CICheckerboardGeneratorReturn Value
The generated image.
Discussion
This method generates a checkerboard pattern as an image. The effect requires the size, sharpness, and color properties to create the pattern.
The checkerboard generator filter uses the following properties:
centerA
vectorrepresenting the center of the image as a CIVector.color0A CIColor representing the first color of the pattern.
color1A CIColor representing the second color of the pattern.
sharpnessA
floatrepresenting the sharpness of the pattern as an NSNumber.widthA
floatrepresenting the width of the checkerboard squares as an NSNumber.
The following code creates a filter that generates a black-and-white checkered pattern:
func checkerBoard() -> CIImage {
let checkerBoardGenerator = CIFilter.checkerboardGenerator()
checkerBoardGenerator.setDefaults()
checkerBoardGenerator.center = CGPoint(x: 0, y: 0)
checkerBoardGenerator.color0 = .white
checkerBoardGenerator.color1 = .black
checkerBoardGenerator.width = 40
checkerBoardGenerator.sharpness = 1
return checkerBoardGenerator.outputImage!
}[Image]
See Also
Filters
attributedTextImageGenerator()aztecCodeGenerator()barcodeGenerator()blurredRectangleGenerator()code128BarcodeGenerator()lenticularHaloGenerator()meshGenerator()pdf417BarcodeGenerator()qrCodeGenerator()randomGenerator()roundedRectangleGenerator()roundedRectangleStrokeGenerator()starShineGenerator()stripesGenerator()sunbeamsGenerator()