使用 CIGaussianGradient 滤波器进行核心图像的示例
我正在寻找适用于 iOS 的 Core Image 过滤器的代码示例。参数中带有 inputImage 的那些过滤器,我可以弄清楚如何实现。但是那些没有 inputImage 参数的,我不确定它是如何工作的。
以下是 Apple 文档的摘录:
CIGaussianGradient
使用高斯分布生成从一种颜色到另一种颜色变化的渐变。 参数
inputCenter
A CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.
Default value: [150 150] Identity: (null)
inputColor0
A CIColor class whose display name is Color 1.
inputColor1
A CIColor class whose display name is Color 2.
inputRadius
An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.
Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 300.00
I am looking for a code sample of this Core Image filter for iOS. Those filters with the inputImage in the parameter, I can figure out how to implement. But the ones without the inputImage parameter, I am not sure how it works.
Here is the extract from Apple's doc:
CIGaussianGradient
Generates a gradient that varies from one color to another using a Gaussian distribution.
Parameters
inputCenter
A CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.
Default value: [150 150] Identity: (null)
inputColor0
A CIColor class whose display name is Color 1.
inputColor1
A CIColor class whose display name is Color 2.
inputRadius
An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.
Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 300.00
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该可以帮助您开始......尽管我不确定为什么这会在 iOS 中产生洋红色超过白色的渐变,而它在 Quartz Composer 中产生洋红色超过黑色的渐变。 (如果你还没有使用过 Quartz Composer,它包含在 Apple 的开发工具中,非常适合测试 Core Image 滤镜)
要使用它做任何有用的事情,我相信你必须在之后裁剪它 - 否则它将具有无限的维度(根据到 Quartz Composer)。
This should get you started... though I'm not sure why this produces a magenta over white gradient in iOS, while it produces a magenta over black gradient in Quartz Composer. (if you haven't used Quartz Composer, it's included with Apple's dev tools and is great for testing out Core Image filters)
To do anything useful with it, I believe you have to crop it afterwards - otherwise it will have infinite dimensions (according to Quartz Composer).