CIFilter for CategoryDistortionEffect示例

时间:2011-12-14 14:01:36

标签: iphone filter distortion

有人可以展示一个为kCICategoryDistortionEffect初始化CIFilter的例子吗?

我需要为我的摄影创建失真效果。我已经读过IOS 5中的CIFilter是可能的。 但我找不到合适的代码如何实现它。

2 个答案:

答案 0 :(得分:3)

我一直在寻找这个。到目前为止,它似乎在iOS 5中不可用。以下是证据:

如果您执行:

NSArray *properties = [CIFilter filterNamesInCategory:
                       kCICategoryBuiltIn];

你会看到它只返回以下列表,其中包含任何kCICategoryDistortionEffect。它只包含:

CIAdditionCompositing,
CIAffineTransform,
CICheckerboardGenerator,
CIColorBlendMode,
CIColorBurnBlendMode,
CIColorControls,
CIColorCube,
CIColorDodgeBlendMode,
CIColorInvert,
CIColorMatrix,
CIColorMonochrome,
CIConstantColorGenerator,
CICrop,
CIDarkenBlendMode,
CIDifferenceBlendMode,
CIExclusionBlendMode,
CIExposureAdjust,
CIFalseColor,
CIGammaAdjust,
CIGaussianGradient,
CIHardLightBlendMode,
CIHighlightShadowAdjust,
CIHueAdjust,
CIHueBlendMode,
CILightenBlendMode,
CILinearGradient,
CILuminosityBlendMode,
CIMaximumCompositing,
CIMinimumCompositing,
CIMultiplyBlendMode,
CIMultiplyCompositing,
CIOverlayBlendMode,
CIRadialGradient,
CISaturationBlendMode,
CIScreenBlendMode,
CISepiaTone,
CISoftLightBlendMode,
CISourceAtopCompositing,
CISourceInCompositing,
CISourceOutCompositing,
CISourceOverCompositing,
CIStraightenFilter,
CIStripesGenerator,
CITemperatureAndTint,
CIToneCurve,
CIVibrance,
CIVignette,
CIWhitePointAdjust

并且错过了我们感兴趣的那个:

CICategoryDistortionEffect,
CIBumpDistortion,
CIBumpDistortionLinear,
CICircleSplashDistortion,
CICircularWrap,
CIDisplacementDistortion,
CIGlassDistortion,
CIGlassLozenge,
CIHoleDistortion,
CIPinchDistortion,
CITorusLensDistortion,
CITwirlDistortion,
CIVortexDistortion

答案 1 :(得分:1)

您可以使用以下代码

查看所有过滤器类型
NSArray *filterNames =[CIFilter filterNamesInCategory:kCICategoryBuiltIn];
NSLog(@"Built in filters");
for (NSString *currentFilterName in filterNames)
{
    NSLog(@"%@", currentFilterName);
}