我有一个高斯模糊,我正在为一个应用程序做.
//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];
它工作得很好,但我希望能够将其反转并使视图恢复正常.
我怎么能这样做,因为试图简单地从它的超视图中移除模糊的视图不起作用.我也尝试过将各种属性设置为零而没有运气.
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。