我有一个高斯模糊,我正在为一个应用程序做.
//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];
它工作得很好,但我希望能够将其反转并使视图恢复正常.
我怎么能这样做,因为试图简单地从它的超视图中移除模糊的视图不起作用.我也尝试过将各种属性设置为零而没有运气.