• 滤镜链


    滤镜链:即用一个滤镜的output image 当作 另一个滤镜的 input:

     1 CIContext *context = [CIContext contextWithOptions:nil];
     2     CIImage *image = [CIImage imageWithCGImage:[UIImage imageNamed:@"aa11.jpg"].CGImage];
     3     
     4    
     5     
     6     CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone"];
     7     [filter setValue:image forKey:kCIInputImageKey];
     8     [filter setValue:@0.8f forKey:kCIInputIntensityKey];
     9     CIImage *result = [filter valueForKey:kCIOutputImageKey];
    10   
    11     CIFilter *gloom = [CIFilter filterWithName:@"CIGloom"];
    12     [gloom setValue:result forKey:kCIInputImageKey];
    13     [gloom setValue:@15.0f forKey:kCIInputRadiusKey];
    14     [gloom setValue:@0.55f forKey:kCIInputIntensityKey];
    15     result = [gloom valueForKey:kCIOutputImageKey];
    16     
    17     CIFilter *bumpDistortion = [CIFilter filterWithName:@"CIBumpDistortion"];
    18     [bumpDistortion setValue:result forKey:kCIInputImageKey];
    19     [bumpDistortion setValue:[CIVector vectorWithX:300 Y:50] forKey:kCIInputCenterKey];
    20     [bumpDistortion setValue:@100.0f forKey:kCIInputRadiusKey];
    21     [bumpDistortion setValue:@3.0f forKey:kCIInputScaleKey];
    22     result = [bumpDistortion valueForKey:kCIOutputImageKey];
    23   
    24     
    25     CGRect extent = [result extent];
    26     CGImageRef cgImage = [context createCGImage:result fromRect:extent];
    27     
    28     UIImage *resultImg = [UIImage imageWithCGImage:cgImage];
    29     
    30     UIImageView *imgView = [[UIImageView alloc]initWithFrame:self.view.bounds];
    31     [imgView setImage:resultImg];
    32     [self.view addSubview:imgView];
  • 相关阅读:
    BZOJ3238 [Ahoi2013]差异 SA+单调栈
    BZOJ2754 [SCOI2012]喵星球上的点名 SA+莫队+树状数组
    Luogu P3251 [JLOI2012]时间流逝 期望dp
    Luogu P3962 [TJOI2013]数字根 st
    BZOJ3619 [Zjoi2014]璀灿光华 构造+dfs
    Codeforces 990G 点分治+暴力
    express基础项目创建
    Node.js 中使用 ES6 中的 import / export 的方法大全
    bootstrap 辅助工具
    python实现FTP服务器
  • 原文地址:https://www.cnblogs.com/grq186/p/4602535.html
Copyright © 2020-2023  润新知