sourceOutCompositing()
Subtracts overlapping area of two images to create the output image.
Declaration
class func sourceOutCompositing() -> any CIFilter & CICompositeOperationReturn Value
The modified image.
Discussion
This method applies the source-out compositing filter to an image. The effect creates the result by overlaying the input image over the background image. The filter then removes the overlapping area of the background image from the result.
The source-out compositing filter uses the following properties:
The following code creates a filter that results in an output image that shows the portion of the background image that doesn’t overlap with the input image:
func sourceOutCompositing(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
let colorBlendFilter = CIFilter.sourceOutCompositing()
colorBlendFilter.inputImage = inputImage
colorBlendFilter.backgroundImage = backgroundImage
return colorBlendFilter.outputImage!
}[Image]