Mam rozmycie gaussowskie, które robię dla aplikacji.Odwrócenie filtru rozmycia Gaussa: 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];
Działa wspaniale, ale chcę mieć możliwość odwrócenia go i przywrócenia widoku do normalności.
W jaki sposób mogę to zrobić, próbując po prostu usunąć widok rozmycia, jego widok nie działa. Próbowałem również ustawić różne właściwości do zerowania bez powodzenia.
nie można po prostu zrobić kopię viewImage przed rozmycie jest stosowana i powrócić, jeśli chcesz odwrócić? – Ravi
Jak zrobić kopię bez zmiany obu kopii po zastosowaniu efektu rozmycia? – jakenberg