VideoEffect

public protocol VideoEffect : AnyObject

An object that apply a video effect.

Example code:

final class MonochromeEffect: VideoEffect {
    let filter: CIFilter? = CIFilter(name: "CIColorMonochrome")

    func execute(_ image: CIImage) -> CIImage {
        guard let filter: CIFilter = filter else {
            return image
        }
        filter.setValue(image, forKey: "inputImage")
        filter.setValue(CIColor(red: 0.75, green: 0.75, blue: 0.75), forKey: "inputColor")
        filter.setValue(1.0, forKey: "inputIntensity")
        return filter.outputImage ?? image
    }
}
  • Executes to apply a video effect.

    Declaration

    Swift

    func execute(_ image: CIImage) -> CIImage