Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting intensity of VideoConfigurationProtocol with Slider #25

Open
cosmicsalad opened this issue Jun 21, 2019 · 1 comment
Open

Comments

@cosmicsalad
Copy link

cosmicsalad commented Jun 21, 2019

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?

@vitoziv
Copy link
Contributor

vitoziv commented Jun 21, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants