Contents

droste()

Stylizes an image with the Droste effect.

Declaration

class func droste() -> any CIFilter & CIDroste

Return 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:

inputImage

An image with the type CIImage.

rotation

A float representing the angle of the rotation, in radians, as an NSNumber.

zoom

A float representing the zoom of the effect as an NSNumber.

periodicity

A float representing the amount of intervals as an NSNumber.

inputInsetPoint1

A CGPoint representing the x and y position that defines the first inset point.

inputInsetPoint0

A CGPoint representing the x and y position that defines the second inset point.

inputStrands

A 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]

See Also

Filters