滤镜

2016-08-01  本文已影响38人  吴冬

滤镜

CIFilter *filter = [CIFilter filterWithName:@"滤镜种类"];

CIImage *outputImage = [filter outputImage];  //根据滤镜的选择输出的图片

CIContext *context = [CIContext contextWIthOptions:nil]; //上下文,复用方便,增加性能。

CGImageRef cgimg = [context createCGImage:outputImage formRect:[outputImage extent]];   //在上下文中绘制图片付给CGImageRef的子类

UIImage *newImage = [UIImage imageWithCGImage:cgimg];   //创建Image

CGImageRelease(cgimg)  //注意释放

滤镜种类

1.CIAccordionFoldTransition。(褶皱过度)

inputBottomHeight : 褶皱开始的位置,距离图片底部。

inputNumberOfFolds:褶皱数量。(0-50)

inputTime:变形时间。     (0-1)

需要强调的是,产生褶皱转变,俩张图片需要不同尺寸。

2.CIAdditionCompositing。 (复合)

inputImage: CIImage视图

inputBackgroundImage:CIImage视图

3.CIBoxBlur。 (增加模糊效果 9.0)

inputImage:CIImage视图

inputRadius:模糊半径。(1-10)

4.CIDiscBlur。(同上,效果比上边更明显。9.0)

5.CIGaussianBlur。 (同上,6.0以后就可用,和上边俩个相比模糊半径越大,有缩小的效果)

6.CIMedianfilter。 (中间视图变得更清晰,待理解)

inputImage:CIImage视图。

7.CIMotionBlur。 (移动模糊效果 Blurs an image to simulate the effect of using a camera that moves a specified angle and distance while capturing the image.)

inputImage:CIImage视图

inputRadius:模糊半径。(1-10)

inputAngle:模糊角度。

8.CIZoomBlur。(中间模糊 Simulates the effect of zooming the camera while capturing the image.)

inputCenter: CIVector *vit = [CIVector vectorWithX:606 / 2.0  Y:437/2.0];//图片中间属性

inputAmount:20.0 defaultValue.

9.CIPhotoEffectMono。 (黑白照片的即视感)

10.CIPhotoEffectInstant。 (老照片的即视感)

11.CIPhotoEffectFade。(有点褪色的感觉)

12.CIPhotoEffectChrome。(感觉镀了层橘黄的东西)

13.CIPhotoEffectNoir。 (更老的照片的即视感)

上一篇 下一篇

猜你喜欢

热点阅读