droste()
Stylizes an image with the Droste effect.
Declaration
class func droste() -> any CIFilter & CIDrosteReturn Value
The distorted image.
Discussion
This method applies the Droste filter to an image. This effect creates a Droste effect that distorts the image by repeating smaller versions of the same image within itself.
The Droste filter uses the following properties:
inputImageAn image with the type CIImage.
rotationA
floatrepresenting the angle of the rotation, in radians, as an NSNumber.zoomA
floatrepresenting the zoom of the effect as an NSNumber.periodicityA float representing the amount of intervals as an NSNumber.
inputInsetPoint1A CGPoint representing the x and y position that defines the first inset point.
inputInsetPoint0A CGPoint representing the x and y position that defines the second inset point.
inputStrandsA float representing the amount of strands as an NSNumber.
The following code creates a filter that results in the image becoming a repeated, scaled pattern:
func drosteFilter(inputImage: CIImage) -> CIImage {
let filter = CIFilter.droste()
filter.inputImage = inputImage
filter.insetPoint1 = CGPoint(
x: inputImage.extent.size.width * 0.2,
y: inputImage.extent.size.height * 0.2
)
filter.insetPoint0 = CGPoint(
x: inputImage.extent.size.width * 0.8,
y: inputImage.extent.size.height * 0.8
)
filter.periodicity = 1
filter.rotation = 0
filter.strands = 1
filter.zoom = 1
return filter.outputImage!.cropped(to: inputImage.extent)
}[Image]