circularScreen()
Adds a circular overlay to an image.
Declaration
class func circularScreen() -> any CIFilter & CICircularScreenReturn Value
The modified image.
Discussion
This method applies a circular screen filter to an image. The effect generates a monochrome image containing a series of circular rings. The halftone effect is a set of lines, dots, or circles that contain detail. When viewing the image from a distance, the markings blend together, creating the illusion of continuous lines and shapes. Print media commonly uses this effect.
The circular screen filter uses the following properties:
inputImageAn image with the type CIImage.
centerA set of coordinates marking the center of the image as a CGPoint.
widthA
floatrepresenting the distance between each circle in the pattern as an NSNumber.sharpnessA
floatrepresenting the sharpness of the circles in the pattern as an NSNumber.
The following code creates a filter that results in a monochrome image with a large circular pattern overlaying the image:
func circular(inputImage: CIImage) -> CIImage {
let circularHalftone = CIFilter.circularScreen()
circularHalftone.inputImage = inputImage
circularHalftone.center = CGPoint(x: 2016, y: 1512)
circularHalftone.width = 35
circularHalftone.sharpness = 0.70
return circularHalftone.outputImage!
}[Image]