additionCompositing()
Blends colors from two images by addition.
Declaration
class func additionCompositing() -> any CIFilter & CICompositeOperationMentioned in
Return Value
The modified image.
Discussion
The filter calculates the sum of color components in the two input images to produce a brightening effect. People typically use this filter to add highlights and lens flares.
The addition compositing filter uses the following properties:
inputImageAn image with the type CIImage.
backgroundImageAn image that the filter applies the effect on with the type CIImage.
The following code creates a filter that combines the images’ colors to produce one image:
func additionCompositing(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
let additionCompositeFilter = CIFilter.additionCompositing()
additionCompositeFilter.inputImage = inputImage
additionCompositeFilter.backgroundImage = backgroundImage
return additionCompositeFilter.outputImage!
}[Image]