如何组合GI滤镜效果。我想将CISepiaTone与CIPhotoEffectMono结合起来。目前我有一个类似的过滤器。
case 1:{
filter = [CIFilter filterWithName:@"CISepiaTone" keysAndValues: kCIInputImageKey, beginImage, @"inputIntensity", [NSNumber numberWithFloat:0.8], nil];
break;
}
答案 0 :(得分:7)
Apple在其文档中提供了一个详细的示例 :https://developer.apple.com/library/ios/documentation/graphicsimaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html
基本上,您将一个过滤器的输出设置为下一个过滤器的输入并以此方式对链进行压缩。来自Apple:
CIFilter *gloom = [CIFilter filterWithName:@"CIGloom"];
[gloom setDefaults];
[gloom setValue: result forKey: kCIInputImageKey];
[gloom setValue: @25.0f forKey: kCIInputRadiusKey];
[gloom setValue: @0.75f forKey: kCIInputIntensityKey];
CIImage *result = [gloom valueForKey: kCIOutputImageKey];
这里是使用结果作为输入的第二个过滤器
CIFilter *bumpDistortion = [CIFilter filterWithName:@"CIBumpDistortion"];
[bumpDistortion setDefaults];
[bumpDistortion setValue: result forKey: kCIInputImageKey];
[bumpDistortion setValue: [CIVector vectorWithX:200 Y:150]
forKey: kCIInputCenterKey];
[bumpDistortion setValue: @100.0f forKey: kCIInputRadiusKey];
[bumpDistortion setValue: @3.0f forKey: kCIInputScaleKey];
result = [bumpDistortion valueForKey: kCIOutputImageKey];