我在一张图片上使用了2个滤镜。这个问题很容易理解,如果我移动一个滑块,滤镜将会很好地应用,但是当我移动另一个滑块时,图片将重置为原始_tempImage
。
我尝试用_justNowImage.image = quickFilteredImage;
替换_tempImage = quickFilteredImage;
,但结果是一个疯狂的过滤器。
由于
- (IBAction)sharpenSliderChanged:(id)sender
{
GPUImageSharpenFilter *sharpenFilter = [[GPUImageSharpenFilter alloc] init];
[sharpenFilter setSharpness:sharpenSlider.value];
UIImage *quickFilteredImage = [sharpenFilter imageByFilteringImage: _tempImage];
_justNowImage.image = quickFilteredImage;
}
- (IBAction)exposureSliderChanged:(id)sender
{
GPUImageExposureFilter *exposureFilter = [[GPUImageExposureFilter alloc] init];
[exposureFilter setExposure:exposureSlider.value];
UIImage *quickFilteredImage = [exposureFilter imageByFilteringImage: _tempImage];
_justNowImage.image = quickFilteredImage;
}
答案 0 :(得分:1)
UIImage *quickFilteredImage = [exposureFilter imageByFilteringImage: _tempImage];
您只对原始图片应用了不同的过滤器..i.e _tempImage
将这些行添加到两个方法的末尾
_tempImage = quickFilteredImage