Contents

sourceAtopCompositing()

Overlaps two images to create one cropped image.

Declaration

class func sourceAtopCompositing() -> any CIFilter & CICompositeOperation

Return Value

The modified image.

Discussion

This method applies the source-atop compositing filter to an image. The effect creates the result by overlaying the input image over the background image. The filter then removes the area that doesn’t overlap with the background image.

The source-atop 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 an output image that shows the background image with the portion of the input image that overlaps it:

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

[Image]

See Also

Filters