本文主要是介绍UIImageview 模糊、高斯模糊,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
CIContext *context = [CIContext contextWithOptions:nil];
// 加载本地图片
UIImage *image = [UIImage imageNamed:@""];
CIImage *image2 = [[CIImage alloc] initWithCGImage:image.CGImage];
CIImage *image = [CIImage imageWithContentsOfURL:[NSURL URLWithString:@"www.123.jpg";
CIFilter *filter = [CIFilterfilterWithName:@"CIGaussianBlur"];
[filter setValue:image forKey:kCIInputImageKey];
// 设置模糊值
[filter setValue:@20.0f forKey: @"inputRadius"];
CIImage *result = [filter valueForKey:kCIOutputImageKey];
CGImageRef outImage = [context createCGImage: result fromRect:[result extent]];
UIImage * blurImage = [UIImage imageWithCGImage:outImage];
//headerBGimage 是uiimageview
headerBGimage.image = blurImage;
这篇关于UIImageview 模糊、高斯模糊的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!