GPUImage-iOS 虚化图片
2016-10-21 本文已影响0人
周大湿
虚化:GPUImageiOSBlurFilter
- (void)setHeaderBackImageBlur:(UIImage *)image {
// 滤镜
ssBlurFilter = [[GPUImageiOSBlurFilter alloc] init];
ssBlurFilter.blurRadiusInPixels = 5.0f;
// GPUImageView
_ssBlurImage.clipsToBounds = YES;
_ssBlurImage.layer.contentsGravity = kCAGravityResizeAspect;
// 设置缩放
_ssBlurImage.fillMode = kGPUImageFillModePreserveAspectRatioAndFill;
// 加载图片
GPUImagePicture *picture = [[GPUImagePicture alloc] initWithImage:image];
// 图片添加滤镜
[picture addTarget:ssBlurFilter];
// 滤镜显示在哪
[ssBlurFilter addTarget:_ssBlurImage];
// 异步处理
[picture processImage];
// 真麻烦
}