当前位置: 首页 > news >正文

肇庆市人民政府门户网站/seo优化人员

肇庆市人民政府门户网站,seo优化人员,做网站导航能赚钱吗,运城做网站的公司使用CoreImage教程 CoreImage包含有很多实用的滤镜,专业处理图片的库,为了能看到各种渲染效果,请使用如下图片素材. 现在可以开始教程了: #define FIX_IMAGE(image) fixImageWidth(image, 320.f)// 固定图片的宽度 UIImage * fixImageWidth(UIImage *image, CGFloat width) {f…

使用CoreImage教程

CoreImage包含有很多实用的滤镜,专业处理图片的库,为了能看到各种渲染效果,请使用如下图片素材.

 

现在可以开始教程了:

#define FIX_IMAGE(image)  fixImageWidth(image, 320.f)// 固定图片的宽度
UIImage * fixImageWidth(UIImage *image, CGFloat width)
{float newHeight = image.size.height * (width / image.size.width);CGSize size = CGSizeMake(width, newHeight);UIGraphicsBeginImageContextWithOptions(size, NO, 0);CGContextRef context = UIGraphicsGetCurrentContext();CGContextTranslateCTM(context, 0.0, size.height);CGContextScaleCTM(context, 1.0, -1.0);CGContextSetBlendMode(context, kCGBlendModeCopy);CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, size.width, size.height),image.CGImage);UIImage *imageOut = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();return imageOut;
}
代码片段

    // 将UIImage转换成CIImageCIImage *ciImage = [[CIImage alloc] initWithImage:[UIImage imageNamed:@"1.jpg"]];// 创建滤镜CIFilter *filter = [CIFilter filterWithName:@"CIPhotoEffectMono"keysAndValues:kCIInputImageKey, ciImage, nil];[filter setDefaults];// 获取绘制上下文CIContext *context = [CIContext contextWithOptions:nil];// 渲染并输出CIImageCIImage *outputImage = [filter outputImage];// 创建CGImage句柄CGImageRef cgImage = [context createCGImage:outputImagefromRect:[outputImage extent]];// 获取图片UIImage *showImage = [UIImage imageWithCGImage:cgImage];// 释放CGImage句柄
    CGImageRelease(cgImage);// 显示图片UIImageView *imageView = \[[UIImageView alloc] initWithImage:FIX_IMAGE(showImage)];[self.view addSubview:imageView];
代码片段

效果如下:

我们对操作进行简易的封装:

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转换成CIImageCIImage *ciImage = [[CIImage alloc] initWithImage:image];// 创建滤镜CIFilter *filter = [CIFilter filterWithName:namekeysAndValues:kCIInputImageKey, ciImage, nil];[filter setDefaults];// 获取绘制上下文CIContext *context = [CIContext contextWithOptions:nil];// 渲染并输出CIImageCIImage *outputImage = [filter outputImage];// 创建CGImage句柄CGImageRef cgImage = [context createCGImage:outputImagefromRect:[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

  • CIBoxBlur
  • CIDiscBlur
  • CIGaussianBlur
  • CIMedianFilter
  • CIMotionBlur
  • CINoiseReduction
  • CIZoomBlur

CICategoryColorAdjustment

  • CIColorClamp
  • CIColorControls
  • CIColorMatrix
  • CIColorPolynomial
  • CIExposureAdjust
  • CIGammaAdjust
  • CIHueAdjust
  • CILinearToSRGBToneCurve
  • CISRGBToneCurveToLinear
  • CITemperatureAndTint
  • CIToneCurve
  • CIVibrance
  • CIWhitePointAdjust

CICategoryColorEffect(我们刚刚用到的一些效果在这里哦)

  • CIColorCrossPolynomial
  • CIColorCube
  • CIColorCubeWithColorSpace
  • CIColorInvert
  • CIColorMap
  • CIColorMonochrome
  • CIColorPosterize
  • CIFalseColor
  • CIMaskToAlpha
  • CIMaximumComponent
  • CIMinimumComponent
  • CIPhotoEffectChrome
  • CIPhotoEffectFade
  • CIPhotoEffectInstant
  • CIPhotoEffectMono
  • CIPhotoEffectNoir
  • CIPhotoEffectProcess
  • CIPhotoEffectTonal
  • CIPhotoEffectTransfer
  • CISepiaTone
  • CIVignette
  • CIVignetteEffect

CICategoryCompositeOperation

  • CIAdditionCompositing
  • CIColorBlendMode
  • CIColorBurnBlendMode
  • CIColorDodgeBlendMode
  • CIDarkenBlendMode
  • CIDifferenceBlendMode
  • CIExclusionBlendMode
  • CIHardLightBlendMode
  • CIHueBlendMode
  • CILightenBlendMode
  • CILuminosityBlendMode
  • CIMaximumCompositing
  • CIMinimumCompositing
  • CIMultiplyBlendMode
  • CIMultiplyCompositing
  • CIOverlayBlendMode
  • CISaturationBlendMode
  • CIScreenBlendMode
  • CISoftLightBlendMode
  • CISourceAtopCompositing
  • CISourceInCompositing
  • CISourceOutCompositing
  • CISourceOverCompositing

CICategoryDistortionEffect

  • CIBumpDistortion
  • CIBumpDistortionLinear
  • CICircleSplashDistortion
  • CICircularWrap
  • CIDroste
  • CIDisplacementDistortion
  • CIGlassDistortion
  • CIGlassLozenge
  • CIHoleDistortion
  • CILightTunnel
  • CIPinchDistortion
  • CIStretchCrop
  • CITorusLensDistortion
  • CITwirlDistortion
  • CIVortexDistortion

CICategoryGenerator

  • CICheckerboardGenerator
  • CIConstantColorGenerator
  • CILenticularHaloGenerator
  • CIQRCodeGenerator
  • CIRandomGenerator
  • CIStarShineGenerator
  • CIStripesGenerator
  • CISunbeamsGenerator

CICategoryGeometryAdjustment

  • CIAffineTransform
  • CICrop
  • CILanczosScaleTransform
  • CIPerspectiveTransform
  • CIPerspectiveTransformWithExtent
  • CIStraightenFilter

CICategoryGradient

  • CIGaussianGradient
  • CILinearGradient
  • CIRadialGradient
  • CISmoothLinearGradient

CICategoryHalftoneEffect

  • CICircularScreen
  • CICMYKHalftone
  • CIDotScreen
  • CIHatchedScreen
  • CILineScreen

CICategoryReduction

  • CIAreaAverage
  • CIAreaHistogram
  • CIRowAverage
  • CIColumnAverage
  • CIHistogramDisplayFilter
  • CIAreaMaximum
  • CIAreaMinimum
  • CIAreaMaximumAlpha
  • CIAreaMinimumAlpha

CICategorySharpen

  • CISharpenLuminance
  • CIUnsharpMask

CICategoryStylize

  • CIBlendWithAlphaMask
  • CIBlendWithMask
  • CIBloom
  • CIComicEffect
  • CIConvolution3X3
  • CIConvolution5X5
  • CIConvolution7X7
  • CIConvolution9Horizontal
  • CIConvolution9Vertical
  • CICrystallize
  • CIDepthOfField
  • CIEdges
  • CIEdgeWork
  • CIGloom
  • CIHeightFieldFromMask
  • CIHexagonalPixellate
  • CIHighlightShadowAdjust
  • CILineOverlay
  • CIPixellate
  • CIPointillize
  • CIShadedMaterial
  • CISpotColor
  • CISpotLight

CICategoryTileEffect

  • CIAffineClamp
  • CIAffineTile
  • CIEightfoldReflectedTile
  • CIFourfoldReflectedTile
  • CIFourfoldRotatedTile
  • CIFourfoldTranslatedTile
  • CIGlideReflectedTile
  • CIKaleidoscope
  • CIOpTile
  • CIParallelogramTile
  • CIPerspectiveTile
  • CISixfoldReflectedTile
  • CISixfoldRotatedTile
  • CITriangleKaleidoscope
  • CITriangleTile
  • CITwelvefoldReflectedTile

CICategoryTransition

  • CIBarsSwipeTransition
  • CICopyMachineTransition
  • CIDisintegrateWithMaskTransition
  • CIDissolveTransition
  • CIFlashTransition
  • CIModTransition
  • CIPageCurlTransition
  • CIPageCurlWithShadowTransition
  • CIRippleTransition
  • CISwipeTransition

 

转载于:https://www.cnblogs.com/YouXianMing/p/3719056.html

http://www.jmfq.cn/news/5114611.html

相关文章:

  • iis默认网站无法访问/抖音引流推广一个30元
  • 一级a做爰片了网站/石家庄自动seo
  • 织梦网站调用工具/王通seo
  • 如何在百度上做网站/搜索引擎的两个基本方法
  • 东莞网站优化指导/seo手机端排名软件
  • 佛山专业网站建设报价/查域名的网址
  • 静态网站开发用到的技术/国内新闻摘抄
  • 税务系统网站建设特点/怎样在百度上发布信息
  • 国家企业信用信息网查询系统/windows优化大师的功能
  • 手机网站建设推荐/torrentkitty磁力天堂
  • 创新的网站建站/零售客户电商网站
  • 爬虫网站怎么做/广安百度推广代理商
  • 舟山市建设信息港网站/aso平台
  • 武汉做网站的大公司有哪些/网络营销毕业论文范文
  • 前台发布视频wordpress/baike seotl
  • 用php内容做电商网站/广告资源对接平台
  • 厦门网页设计培训班/seo优化排名价格
  • php网站开发自学/网店推广培训
  • 辽宁智能网站建设制作/上海网站外包
  • 靖江做网站哪家好/关键词林俊杰在线听免费
  • 移动端的网站/山东工艺美术学院网站建设公司
  • 用自建网站做外贸/seo网络优化招聘信息
  • 沈阳疫情最新消息今天新增病例/宁波品牌网站推广优化公司
  • 长沙网站开发设计/怎么开网店新手入门
  • 学网站建设难/百度软件
  • 网站建设培训合肥/哪里有做网络推广的
  • 昆明网站建设去出发科技公司/seo推广百度百科
  • 做办公设备网站/软文投稿平台有哪些
  • 新手做站必看 手把手教你做网站/邵阳疫情最新消息
  • 企业网站备案 淘宝客/微信广告平台推广