iOS:来自Photoshop的CIFilter(色调)值
我使用Hue
filter来改变图像的色调:
CIFilter* hueFilter = [CIFilter filterWithName:@"CIHueAdjust" <blah blah> [NSNumber numberWithFloat:hue], nil];
我有我希望从Photoshop
使用的Hue
编号,但它不符合我从iOS获得的结果。
是否有一个规则来改变我在iOS
应该使用的PhotoShop
的数量?
HSL / HSV颜色模式中的色调是angular度坐标。 在Photoshop中,它以度(-180到+180)给出。
在CIHueAdjustfilter中,angular度以弧度给出。 从http://developer.apple.com/library/ios/#documentation/graphicsimaging/Reference/CoreImageFilterReference/Reference/reference.html#//apple_ref/doc/filter/ci/CIHueAdjust
参数
inputAngle
属性types为
CIAttributeTypeAngle
,显示名称为Angle的NSNumber
类。默认值:0.00最小值:0.00最大值:0.00滑块最小值:-3.14滑块最大值:3.14标识:0.00
从Photoshop值(度)到CIHueAdjust值(弧度)的公式是一个线性转换:
filterAngle = photoshopAngle * π / 180