Center vector of CIFilter

2019-09-06 16:17发布

问题:

I'm having a hard time understanding the meaning of the center vector used by many different CIFilters.

Let's take CIRadialGradient for example, what does the inputCenter mean? What's its values range? How does its coordinate system behave etc.

回答1:

As Brian said, it's just a type that encodes a position where the effect is centered. HOWEVER, CoreImage coordinates are inverted on the Y-axis from what you're used to using on iOS: The 0,0 point is the lower-left corner and the y value increases as you move toward the top of the screen.



回答2:

The inputCenter for that CIFilter is the center of the two concentric circles. So it is a point in your view/image. The default value is [150 150], so I imagine that acceptable values can be any values in the view plane (positive or negative).

Some rudimentary info is here: https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/filter/ci/CIRadialGradient