Contents

overlayBlendMode()

Blends colors by overlaying images.

Declaration

class func overlayBlendMode() -> any CIFilter & CICompositeOperation

Return Value

The modified image.

Discussion

This method applies the overlay-blend mode filter to an image. The effect creates the output image by overlapping the input image over the background image while preserving highlights and shadows of the background image.

The overlay-blend mode filter uses the following properties:

inputImage

An image with the type CIImage.

backgroundImage

An image with the type CIImage.

The following code creates a filter that results in the background image becoming darker with the input image overlaid on top:

func overlayBlendMode(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
    let colorBlendFilter = CIFilter.overlayBlendMode()
    colorBlendFilter.inputImage = inputImage
    colorBlendFilter.backgroundImage = backgroundImage
    return colorBlendFilter.outputImage!
}

[Image]

See Also

Filters