Contents

mix()

Blends two images together.

Declaration

class func mix() -> any CIFilter & CIMix

Return Value

The modified image.

Discussion

This method applies the mix filter to an image. The effect uses the amount property to interpolate between the input image and the background image, resulting in both images visible in the output image.

The mix filter uses the following properties:

inputImage

An image with the type CIImage.

backgroundImage

An image representing the background image with the type CIImage.

amount

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

The following code creates a filter that combines the input and background images to create one image with both images visible:

func mix(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
    let mixFilter = CIFilter.mix()
    mixFilter.inputImage = inputImage
    mixFilter.backgroundImage = backgroundImage
    mixFilter.amount = 0.25
    return mixFilter.outputImage!
}

[Image]

See Also

Filters