Tôi đã có một gaussian blur mà tôi đang làm cho một ứng dụng.Gaussian Blur Filter Reversal: iOS
//Get a UIImage from the UIView
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//Blur the UIImage
CIImage *imageToBlur = [CIImage imageWithCGImage:viewImage.CGImage];
CIFilter *gaussianBlurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
[gaussianBlurFilter setValue:imageToBlur forKey:@"inputImage"];
[gaussianBlurFilter setValue:[NSNumber numberWithFloat:2] forKey:@"inputRadius"];
CIImage *resultImage = [gaussianBlurFilter valueForKey:@"outputImage"];
UIImage *endImage = [[UIImage alloc] initWithCIImage:resultImage];
//Place the UIImage in a UIImageView
newView = [[UIImageView alloc] initWithFrame:self.view.bounds];
newView.image = endImage;
[self.view addSubview:newView];
Nó hoạt động tốt, nhưng tôi muốn có thể đảo ngược và trả lại chế độ xem trở lại bình thường.
Làm cách nào tôi có thể thực hiện việc này vì chỉ đơn giản là xóa chế độ xem mờ khỏi giám sát của nó không hoạt động. Tôi cũng đã thử thiết lập các thuộc tính khác nhau để không có may mắn.
thể bạn không chỉ cần tạo một bản sao của viewImage trước khi mờ được áp dụng và trở lại khi bạn muốn thay đổi? – Ravi
Làm cách nào để tạo bản sao của nó mà không thay đổi cả hai bản sao sau khi áp dụng hiệu ứng nhòe? – jakenberg