Contents

sourceOverCompositing()

Places one image over a second image.

Declaration

class func sourceOverCompositing() -> any CIFilter & CICompositeOperation

Mentioned in

Return Value

The modified image.

Discussion

This method applies the source-over compositing filter to an image. The effect creates the result by overlaying the input image over the background image. Unlike the other source compositing filters, source-over doesn’t subtract parts of the image.

The source-over compositing 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 both of the input images becoming visible with no subtraction:

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

[Image]

See Also

Filters