• 滤镜链


    滤镜链:即用一个滤镜的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];
  • 相关阅读:
    MemCached总结二:数据管理指令
    MemCached总结一:Unbutu操作系统下memcached服务器安装和telnet方式连接memcache
    Laravel5 开启Debug
    状压dp
    树形dp
    区间dp
    线性dp
    背包九讲
    dp求解各种子串子序列
    线段树详解
  • 原文地址:https://www.cnblogs.com/grq186/p/4602535.html
Copyright © 2020-2023  润新知