国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

使用CoreImage教程CoreImage包含有很多實用的濾鏡,專業處理圖片的庫

2019-11-09 17:17:27
字體:
來源:轉載
供稿:網友

轉自:http://www.cnblogs.com/YouXianMing/p/3719056.html

使用CoreImage教程

CoreImage包含有很多實用的濾鏡,專業處理圖片的庫,為了能看到各種渲染效果,請使用如下圖片素材.

 

現在可以開始教程了:

 代碼片段

 代碼片段

效果如下:

我們對操作進行簡易的封裝:

CIFilterEffect.h + CIFilterEffect.m

復制代碼
////  CIFilterEffect.h//  CIFilter////  Created by YouXianMing on 14-5-9.//  Copyright (c) 2014年 Y.X. All rights reserved.//#import <Foundation/Foundation.h>@interface CIFilterEffect : NSObject@PRoperty (nonatomic, strong, readonly) UIImage *result;- (instancetype)initWithImage:(UIImage *)image filterName:(NSString *)name;@end復制代碼復制代碼
////  CIFilterEffect.m//  CIFilter////  Created by YouXianMing on 14-5-9.//  Copyright (c) 2014年 Y.X. All rights reserved.//#import "CIFilterEffect.h"@interface CIFilterEffect ()@property (nonatomic, strong, readwrite) UIImage *result;@end@implementation CIFilterEffect- (instancetype)initWithImage:(UIImage *)image filterName:(NSString *)name{    self = [super init];    if (self)    {        // 將UIImage轉換成CIImage        CIImage *ciImage = [[CIImage alloc] initWithImage:image];                // 創建濾鏡        CIFilter *filter = [CIFilter filterWithName:name                                      keysAndValues:kCIInputImageKey, ciImage, nil];        [filter setDefaults];                // 獲取繪制上下文        CIContext *context = [CIContext contextWithOptions:nil];                // 渲染并輸出CIImage        CIImage *outputImage = [filter outputImage];                // 創建CGImage句柄        CGImageRef cgImage = [context createCGImage:outputImage                                           fromRect:[outputImage extent]];                _result = [UIImage imageWithCGImage:cgImage];                // 釋放CGImage句柄        CGImageRelease(cgImage);    }    return self;}@end復制代碼

我們來開始嘗試其他的濾鏡效果,我們可以嘗試的至少有這些:

@"CILinearToSRGBToneCurve",@"CiphotoEffectChrome",@"CIPhotoEffectFade",@"CIPhotoEffectInstant",@"CIPhotoEffectMono",@"CIPhotoEffectNoir",@"CIPhotoEffectProcess",@"CIPhotoEffectTonal",@"CIPhotoEffectTransfer",@"CISRGBToneCurveToLinear",@"CIVignetteEffect",

下面是所有渲染出來的圖片,與上面提供的濾鏡名字一一對應:

 

以下效果是需要進行一些配置才能達到的效果,這個就不開源了,你懂得:).

 

 

福利:

Core Image Filter Reference

https://developer.apple.com/library/ios/documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html

CICategoryBlur

CIBoxBlurCIDiscBlurCIGaussianBlurCIMedianFilterCIMotionBlurCINoiseReductionCIZoomBlur

CICategoryColorAdjustment

CIColorClampCIColorControlsCIColorMatrixCIColorPolynomialCIExposureAdjustCIGammaAdjustCIHueAdjustCILinearToSRGBToneCurveCISRGBToneCurveToLinearCITemperatureAndTintCIToneCurveCIVibranceCIWhitePointAdjust

CICategoryColorEffect(我們剛剛用到的一些效果在這里哦)

CIColorCrossPolynomialCIColorCubeCIColorCubeWithColorSpaceCIColorInvertCIColorMapCIColorMonochromeCIColorPosterizeCIFalseColorCIMaskToAlphaCIMaximumComponentCIMinimumComponentCIPhotoEffectChromeCIPhotoEffectFadeCIPhotoEffectInstantCIPhotoEffectMonoCIPhotoEffectNoirCIPhotoEffectProcessCIPhotoEffectTonalCIPhotoEffectTransferCISepiaToneCIVignetteCIVignetteEffect

CICategoryCompositeOperation

CIAdditionCompositingCIColorBlendModeCIColorBurnBlendModeCIColorDodgeBlendModeCIDarkenBlendModeCIDifferenceBlendModeCIExclusionBlendModeCIHardLightBlendModeCIHueBlendModeCILightenBlendModeCILuminosityBlendModeCIMaximumCompositingCIMinimumCompositingCIMultiplyBlendModeCIMultiplyCompositingCIOverlayBlendModeCISaturationBlendModeCIScreenBlendModeCISoftLightBlendModeCISourceAtopCompositingCISourceInCompositingCISourceOutCompositingCISourceOverCompositing

CICategoryDistortionEffect

CIBumpDistortionCIBumpDistortionLinearCICircleSplashDistortionCICircularWrapCIDrosteCIDisplacementDistortionCIGlassDistortionCIGlassLozengeCIHoleDistortionCILightTunnelCIPinchDistortionCIStretchCropCITorusLensDistortionCITwirlDistortionCIVortexDistortion

CICategoryGenerator

CICheckerboardGeneratorCIConstantColorGeneratorCILenticularHaloGeneratorCIQRCodeGeneratorCIRandomGeneratorCIStarShineGeneratorCIStripesGeneratorCISunbeamsGenerator

CICategoryGeometryAdjustment

CIAffineTransformCICropCILanczosScaleTransformCIPerspectiveTransformCIPerspectiveTransformWithExtentCIStraightenFilter

CICategoryGradient

CIGaussianGradientCILinearGradientCIRadialGradientCISmoothLinearGradient

CICategoryHalftoneEffect

CICircularScreenCICMYKHalftoneCIDotScreenCIHatchedScreenCILineScreen

CICategoryReduction

CIAreaAverageCIAreaHistogramCIRowAverageCIColumnAverageCIHistogramDisplayFilterCIAreaMaximumCIAreaMinimumCIAreaMaximumAlphaCIAreaMinimumAlpha

CICategorySharpen

CISharpenLuminanceCIUnsharpMask

CICategoryStylize

CIBlendWithAlphaMaskCIBlendWithMaskCIBloomCIComicEffectCIConvolution3X3CIConvolution5X5CIConvolution7X7CIConvolution9HorizontalCIConvolution9VerticalCICrystallizeCIDepthOfFieldCIEdgesCIEdgeWorkCIGloomCIHeightFieldFromMaskCIHexagonalPixellateCIHighlightShadowAdjustCILineOverlayCIPixellateCIPointillizeCIShadedMaterialCISpotColorCISpotLight

CICategoryTileEffect

CIAffineClampCIAffineTileCIEightfoldReflectedTileCIFourfoldReflectedTileCIFourfoldRotatedTileCIFourfoldTranslatedTileCIGlideReflectedTileCIKaleidoscopeCIOpTileCIParallelogramTileCIPerspectiveTileCISixfoldReflectedTileCISixfoldRotatedTileCITriangleKaleidoscopeCITriangleTileCITwelvefoldReflectedTile

CICategoryTransition

CIBarsswipeTransitionCICopyMachineTransitionCIDisintegrateWithMaskTransitionCIDissolveTransitionCIFlashTransitionCIModTransitionCIPageCurlTransitionCIPageCurlWithShadowTransitionCIRippleTransitionCISwipeTransition

 

標簽: iOS


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 科技| 泸定县| 惠来县| 霍邱县| 栾城县| 桓仁| 大方县| 双鸭山市| 安康市| 岚皋县| 平利县| 苍溪县| 叙永县| 乐业县| 乐昌市| 龙游县| 裕民县| 娄底市| 曲靖市| 安徽省| 祥云县| 霸州市| 息烽县| 霍州市| 应城市| 运城市| 明光市| 麻江县| 巨野县| 上虞市| 武胜县| 格尔木市| 宁津县| 茌平县| 元氏县| 益阳市| 日喀则市| 承德县| 赣榆县| 泽库县| 子洲县|