differenceBlendMode()
Subtracts color values to blend colors.
Declaration
class func differenceBlendMode() -> any CIFilter & CICompositeOperationReturn Value
The modified image.
Discussion
This method applies the difference-blend mode filter to an image. The effect calculates the brightness value for both images and subtracts the smaller value, resulting in a slightly darker image. This effect doesn’t modify images that are black.
The difference-blend mode filter uses the following properties:
The following code creates a filter that blends colors in the background image and input image:
func differenceBlendMode(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
let colorBlendFilter = CIFilter.differenceBlendMode()
colorBlendFilter.inputImage = inputImage
colorBlendFilter.backgroundImage = backgroundImage
return colorBlendFilter.outputImage!
}[Image]