darkenBlendMode()
Blends colors from two images while darkening lighter pixels.
Declaration
class func darkenBlendMode() -> any CIFilter & CICompositeOperationReturn Value
The modified image.
Discussion
This method applies the darken-blend mode filter to an image. The effect targets lighter colors in the background image and darkens them, while darker colors remain unchanged. The result is the sum of the adjusted color values from both images.
The darken-blend mode filter uses the following properties:
The following code creates a filter that darkens the image:
func darkenBlendMode(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
let colorBlendFilter = CIFilter.darkenBlendMode()
colorBlendFilter.inputImage = inputImage
colorBlendFilter.backgroundImage = backgroundImage
return colorBlendFilter.outputImage!
}[Image]