GPUImage-iOS 虚化图片

虚化: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];
    // 真麻烦
}

你可能感兴趣的:(GPUImage-iOS 虚化图片)