roundedRectangleGenerator()
Generates a rounded rectangle image.
Declaration
class func roundedRectangleGenerator() -> any CIFilter & CIRoundedRectangleGeneratorReturn Value
The generated image.
Discussion
This method generates a rounded rectangle image with the specified size, corner radius, and color properties.
The rounded rectangle generator filter uses the following properties:
colorA CIColor representing the color of the rounded rectangle.
extentA CGRect representing the size of the rounded rectangle.
radiusA
floatrepresenting the curve of the rectangle’s corners.
The following code creates a filter that generates a light blue square with rounded corners:
func roundedRectangle () -> CIImage {
let roundedRectangleGenerator = CIFilter.roundedRectangleGenerator()
roundedRectangleGenerator.color = CIColor(red: 96/255, green: 173/255, blue: 193/255)
roundedRectangleGenerator.extent = CGRect(x: 0, y: 1, width: 700, height: 700)
roundedRectangleGenerator.radius = 100
return roundedRectangleGenerator.outputImage!
}[Image]
See Also
Filters
attributedTextImageGenerator()aztecCodeGenerator()barcodeGenerator()blurredRectangleGenerator()checkerboardGenerator()code128BarcodeGenerator()lenticularHaloGenerator()meshGenerator()pdf417BarcodeGenerator()qrCodeGenerator()randomGenerator()roundedRectangleStrokeGenerator()starShineGenerator()stripesGenerator()sunbeamsGenerator()