mix()
Blends two images together.
Declaration
class func mix() -> any CIFilter & CIMixReturn 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:
inputImageAn image with the type CIImage.
backgroundImageAn image representing the background image with the type CIImage.
amountA
floatrepresenting 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]