|
|
@@ -71,7 +71,11 @@ public struct Filter {
|
|
|
let filter = CIFilter(name: "CISourceOverCompositing")!
|
|
|
filter.setValue(colorImage, forKey: kCIInputImageKey)
|
|
|
filter.setValue(input, forKey: kCIInputBackgroundImageKey)
|
|
|
+ #if swift(>=4.0)
|
|
|
return filter.outputImage?.cropped(to: input.extent)
|
|
|
+ #else
|
|
|
+ return filter.outputImage?.cropping(to: input.extent)
|
|
|
+ #endif
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -85,9 +89,14 @@ public struct Filter {
|
|
|
kCIInputContrastKey: contrast,
|
|
|
kCIInputSaturationKey: saturation]
|
|
|
|
|
|
- let blackAndWhite = input.applyingFilter("CIColorControls", parameters: paramsColor)
|
|
|
let paramsExposure = [kCIInputEVKey: inputEV]
|
|
|
+ #if swift(>=4.0)
|
|
|
+ let blackAndWhite = input.applyingFilter("CIColorControls", parameters: paramsColor)
|
|
|
return blackAndWhite.applyingFilter("CIExposureAdjust", parameters: paramsExposure)
|
|
|
+ #else
|
|
|
+ let blackAndWhite = input.applyingFilter("CIColorControls", withInputParameters: paramsColor)
|
|
|
+ return blackAndWhite.applyingFilter("CIExposureAdjust", withInputParameters: paramsExposure)
|
|
|
+ #endif
|
|
|
}
|
|
|
|
|
|
}
|