Dev:CAFilter

CAFilter is an Objective-C wrapper for creating static or transition image filters.

Applying filters to layers
Although the SDK says that the filters property is unused, you can actually apply filter effects with it, for example, to apply a Gaussian blur filter for a window:

Builtin static filters
The following is a demo of all 8 built-in static filters available on 4.3

multiplyColor
Multiplies color components to the layer. It accepts 1 input parameter:
 * inputColor: Array of 4 floats indicating the RGBA components to multiply.

multiplyGradient
Multiplies a linear gradient to the layer. It accepts 4 input parameters:
 * inputColor0: Array of 4 floats indicating the RGBA components of the first point of the gradient.
 * inputColor1: Array of 4 floats indicating the RGBA components of the first second of the gradient.
 * inputPoint0: CGPoint (in the range (0,0) to (1,1)) for the location of the first point of the gradient.
 * inputPoint1: CGPoint (in the range (0,0) to (1,1)) for the location of the second point of the gradient.

colorAdd
Add color components to the layer. It accepts 1 input parameter:
 * inputColor: Array of 4 floats indicating the RGBA components to add.

colorSubtract
Subtract color components from the layer. It accepts 1 input parameter:
 * inputColor: Array of 4 floats indicating the RGBA components to subtract.

colorMonochrome
Apply monochrome effect to the layer. It accepts 3 input parameters:
 * inputColor</tt>: Array of 4 floats indicating the RGBA components of the color to apply.
 * inputBias</tt>: CGFloat between -1 and 1 for how close should the layer bias to the input color. If this value is -1, the whole layer is blackened. If this value is 0, this effect is equivalent to colorMultiply. If this value is 1, the whole layer is filled with the input color.
 * inputAmount</tt>: CGFloat between 0 and 1 for the strength of this effect. 1 is maximum, 0 is no-op.

gaussianBlur
Apply a Gaussian blur effect to the layer. It accepts 2 input parameters:
 * inputRadius</tt>: Strength of blurring, in pixels.
 * inputHardEdges</tt>: Boolean indicating whether the edge of the layer should be softened too. Default is NO.

lanczosResize
Resize the layer using the Lanczos algorithm. It accepts 1 input parameter:
 * inputScale</tt>: CGFloat for the resize scale.

pageCurl
Gives the layer a page curl effect. It accepts 12 float parameters. 3 of them are expected to be modified: While changing the other 9 from the default often produce very bad effect:
 * inputTime</tt>: CGFloat between 0 and 1, referring to the time this snapshot is taken when the a page curl animation is played.
 * inputAngle</tt>: The angle in radian where the layer is curled up towards there. 0 is the +x direction, π/2 is the +y direction.
 * inputRadius</tt>: The radius in pixel of the page's curvature.
 * inputStartAngle</tt>: The initial inclination of the curled page.
 * inputEndAngle</tt>: The final inclination of the curled page.
 * inputBackEnabled</tt>: Whether the back of the layer (curled up part) is shown.
 * inputBackColor0</tt>: Color of the back of the layer.
 * inputBackColor1</tt>: Color of the just curled up part, i.e. the edge between the back and the front of the layer.
 * inputFrontEnabled</tt>: Whether the front of the layer (uncurled part) is shown.
 * inputFrontColor</tt>: Equivalent to applying multiplyColor to the image.
 * <tt>inputShadowColor</tt>: The shadow color that glows around the curled part.
 * <tt>inputShadowBounds</tt>: CGRect in pixel relative to the origin of the layer where the shadow will glow around this rectangle.

Availability
The following shows the availability of different CAFilters starting from 2.0

Transition filters
Transition filters also uses CAFilter as the interface, as CATransition also has a <tt>filter</tt> property. But the transition filters cannot be treated as static filters and applied to layers directly.