解决问题:将图像模糊
前提:添加 CoreGraphics.framework
源码:
- (UIImage*) blur:(UIImage*)theImage
{
// create our blurred image
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *inputImage = [CIImage imageWithCGImage:theImage.CGImage];
// setting up Gaussian Blur (could use one of many filters offered by Core Image)
CIFilter *blurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
[blurFilter setValue:inputImage forKey:kCIInputImageKey];
[blurFilter setValue:[NSNumber numberWithFloat:10.0f] forKey:@"inputRadius"];
CIImage *result = [blurFilter valueForKey:kCIOutputImageKey];
// CIGaussianBlur has a tendency to shrink the image a little,
// this ensures it matches up exactly to the bounds of our original image
CGImageRef cgImage = [context createCGImage:result fromRect:[inputImage extent]];
UIImage *returnIma

该博客探讨了如何在iOS应用中实现图像模糊处理,通过添加CoreGraphics.framework并使用相关源码,详细介绍了将图像模糊的具体步骤和技术要点。
最低0.47元/天 解锁文章
3379

被折叠的 条评论
为什么被折叠?



