创建CI筛选器链 [英] Create a CI Filter Chain
本文介绍了创建CI筛选器链的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获得联合GI滤镜效果。我想将CISepiaTone与CIPhotoEffectMono结合使用。目前,我对过滤器有类似的要求。
How do I get combine GI Filter effects. I would like to combine CISepiaTone with CIPhotoEffectMono. Currently I have something like this for a filter.
case 1:{
filter = [CIFilter filterWithName:@"CISepiaTone" keysAndValues: kCIInputImageKey, beginImage, @"inputIntensity", [NSNumber numberWithFloat:0.8], nil];
break;
}
推荐答案
Apple gives a detailed example in its documentation : https://developer.apple.com/library/ios/documentation/graphicsimaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html
基本上,您将一个过滤器的输出设置为下一个过滤器并以这种方式创建链条。从苹果公司:
Basically you set the output of one filter to the input of the next filter and crrate a chain that way. From 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];
这是第二个使用结果作为输入的过滤器
and here comes the second filter using result as input
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];
这篇关于创建CI筛选器链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文