0

我在一张图片上使用了 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;
    }
4

1 回答 1

1
    UIImage *quickFilteredImage = [exposureFilter imageByFilteringImage: _tempImage];

您仅对原始图像应用不同的过滤器..即 _tempImage

将这些行添加到两种方法的末尾

_tempImage = quickFilteredImage
于 2012-12-29T11:27:36.723 回答