/**
*实现马赛克效果
*/
// 导出CIImage图片
CIImage *ciImage = [[CIImage alloc] initWithImage:[UIImageimageNamed:@"De.png"]];
// 1.创建Filter滤镜
CIFilter *filter = [CIFilter filterWithName:@"CIPixellate"];
[filter setValue:ciImage forKey:kCIInputImageKey];
[filter setDefaults];
CIImage *outImage = [filter valueForKey:kCIOutputImageKey];
// 2. 用CIContext将滤镜中的图片渲染出来
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef cgImage = [context createCGImage:outImage fromRect:[outImage extent]];
// 3. 导出图片
UIImage *showImage = [UIImage imageWithCGImage:cgImage];
CGImageRelease(cgImage);
// 4. 加载出来
UIImageView *imageView = [[UIImageView alloc] initWithImage:showImage];
imageView.center = self.window.center;
[self.window addSubview:imageView];