CIFilter滤镜使用

2020-05-19  本文已影响0人  格雷s

本Demo是以前写的仿Prisma,通过AVFoundation自定义相机UI、CIFilter实现滤镜的、二维码扫描等,分享出来可能会对有需要的人有些帮助,下面上功能

使用的CIFilter功能有

- (NSArray *)filters {
    return @[
             @{
                 @"name":@"原图",
                 @"filter":@"Origin"
                 },
             @{
                 @"name":@"怀旧",
                 @"filter":@"CIPhotoEffectInstant"
                 },
             @{
                 @"name":@"黑白",
                 @"filter":@"CIPhotoEffectNoir"
                 },
             @{
                 @"name":@"灰调",
                 @"filter":@"CIPhotoEffectTonal"
                 },
             @{
                 @"name":@"岁月",
                 @"filter":@"CIPhotoEffectTransfer"
                 },
             @{
                 @"name":@"单色",
                 @"filter":@"CIPhotoEffectMono"
                 },
             @{
                 @"name":@"褪色",
                 @"filter":@"CIPhotoEffectFade"
                 },
             @{
                 @"name":@"冲印",
                 @"filter":@"CIPhotoEffectProcess"
                 },
             @{
                 @"name":@"铬黄",
                 @"filter":@"CIPhotoEffectChrome"
                 },
             @{
                 @"name":@"色调",
                 @"filter":@"CIHueAdjust",
                 },
             @{
                 @"name":@"老电影",
                 @"filter":@"CISepiaTone"
                 },
             @{
                 @"name":@"反色",
                 @"filter":@"CIColorInvert"
                 },
             @{
                 @"name":@"饱和",
                 @"filter":@"CIColorControls"
                 },
             @{
                 @"name":@"矩阵",
                 @"filter":@"CIColorMatrix"
                 },
             @{
                 @"name":@"曝光",
                 @"filter":@"CIExposureAdjust"
                 },
             @{
                 @"name":@"温度",
                 @"filter":@"CITemperatureAndTint"
                 },
             @{
                 @"name":@"振动",
                 @"filter":@"CIVibrance"
                 },
             @{
                 @"name":@"凹凸",
                 @"filter":@"CIBumpDistortion"
                 },
//             @{
//                 @"name":@"二维码",
//                 @"filter":@"CIQRCodeGenerator"
//                 },
//             @{
//                 @"name":@"高斯渐变",
//                 @"filter":@"CIHeightFieldFromMask"
//                 },
             @{
                 @"name":@"高亮",
                 @"filter":@"CIHighlightShadowAdjust"
                 },
             @{
                 @"name":@"描边",
                 @"filter":@"CILineOverlay"
                 },
             @{
                 @"name":@"模糊",
                 @"filter":@"CIGaussianBlur"
                 },
             
             ];
}

贴上app基本UI

主界面

image.png

扫描、拍照功能切换

image.png

滤镜处理

image.png

项目地址

GLIconFilter

上一篇下一篇

猜你喜欢

热点阅读