Last active
March 27, 2020 23:30
-
-
Save quentinfasquel/5ff09fc720262ac37d7c33ac03735393 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard let filter = CIFitler(name: "CIBlendWithMask") else { | |
// Could not find the built-in filter | |
return nil | |
} | |
let backgroundImage = CIImage(color: .clear).cropped(to: inputImage.extent) | |
filter.setValue(backgroundImage, forKey: kCIInputBackgroundImageKey) | |
filter.setValue(inputImage, forKey: kCIInputImageKey) | |
filter.setValue(maskImage, forKey: kCIInputMaskImageKey) | |
return filter.outputImage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment