CoreImage的模糊滤镜
2024-09-04 10:34:10
//1.原始图片
UIImage * image = [UIImage imageNamed:@"1.jpg"]; /****************core image******************/
//a.图片
CIImage * ciImage = [[CIImage alloc] initWithImage:image];
//b.滤镜
CIFilter * ciFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
NSLog(@"%@",[ciFilter attributes]);
//设置滤镜的模糊程度,默认是10
[ciFilter setValue:@() forKey:@"inputRadius"];
//将图片放到滤镜中
[ciFilter setValue:ciImage forKey:kCIInputImageKey];
//输出图片
CIImage * outImage = [ciFilter valueForKey:kCIOutputImageKey];
//c.获取CGImage的句柄
CIContext * context = [CIContext contextWithOptions:nil];
CGImageRef outCGImage = [context createCGImage:outImage fromRect:[outImage extent]];
UIImage * blurImage = [UIImage imageWithCGImage:outCGImage];
CGImageRelease(outCGImage); /********************************************/
//2.初始化imageView
UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(, , , )];
imageView.image = blurImage;
[self.view addSubview:imageView];
最新文章
- Linux查看可执行程序所在路径
- 学习mongo系列(五) AND,$or,$type
- sql server还原数据库文件(.bak)常见问题解决办法笔记
- C# 通过线程来控制进度条(转)--讲解多线程对界面的操作
- web测试用例表(自用)
- 坑爹CF April Fools Day Contest题解
- raspberry pi 3 截图及查看
- Window的匿名Closing 事件
- springMVC+ freemark多视图配置
- escape、encodeURI和encodeURIComponent的区别及使用
- Android异常分析(转)
- vscode 停用插件自动更新
- Nginx是什么?Nginx介绍及Nginx的优点
- js-循环中判断两次点击是否是同一元素
- MySQL字符集不一致的解决办法总结
- servlet injection analysis
- MySQL中的存储过程和函数使用详解
- 【刷题】BZOJ 2730 [HNOI2012]矿场搭建
- Nginx Configuration 免费HTTPS加密证书
- Spring+Dubbo集成Redis的两种解决方案
热门文章
- JavaWeb响应下载(包含工具类)
- Font Awesome 字体使用方法, 兼容ie7+
- Python的网络编程[0] ->; socket[1] ->; socket 模块
- jsp登陆
- MySQL EXPLAIN 命令详解学习
- Winform打砖块游戏制作step by step第4节---小球移动
- 利用jquery.form.js实现将form提交转为ajax方式提交的方法(带上传的表单提交)
- [置顶]
 kubernetes资源对象--ResourceQuotas
- 设计模式之原型模式(php实现)
- python 常用系统参数