Cabbage
Cabbage copied to clipboard
Adjusting intensity of VideoConfigurationProtocol with Slider
Basic example -
public class MyFilter: VideoConfigurationProtocol {
var filter: TestFilter!
public var setIntensity: CGFloat = 0.3
public init() { }
public func applyEffect(to sourceImage: CIImage, info: VideoConfigurationEffectInfo) -> CIImage {
var finalImage = sourceImage
filter = TestFilter()
filter.inputImage = finalImage
filter.intensity = setIntensity
finalImage = filter.outputImage!
return finalImage
}
}
Then when appending this class into trackItem.videoConfiguration.configurations, would there be a preferred method to adjust the setIntensity variable with a UISlider?
You can call setIntensity anywhere you like, no preferred method. But be careful of multi-thread issue, the applyEffect
method will be called on the render thread.