Cabbage icon indicating copy to clipboard operation
Cabbage copied to clipboard

Adjusting intensity of VideoConfigurationProtocol with Slider

Open cosmicsalad opened this issue 5 years ago • 1 comments

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?

cosmicsalad avatar Jun 21 '19 00:06 cosmicsalad

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.

vitoziv avatar Jun 21 '19 10:06 vitoziv