Contents

softLightBlendMode()

Blurs the colors of two images by calculating luminance.

Declaration

class func softLightBlendMode() -> any CIFilter & CICompositeOperation

Return Value

The modified image.

Discussion

This method applies the soft-light blend mode filter to an image. The effect calculates the brightness of the colors in the background image. Colors that are lighter than 50 percent gray become lighter, while the filter further darkens colors that are darker than 50 percent. The filter then uses the calculated result to create the output image.

The soft-light 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 image becoming slightly darker with more saturation and the colors of the gradient image:

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

[Image]

See Also

Filters