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:
CAFilter* filter = [CAFilter filterWithName:@"gaussianBlur"]; [filter setValue:[NSNumber numberWithFloat:5] forKey:@"inputRadius"]; window.layer.filters = [NSArray arrayWithObject:filter];
Builtin static filters
The gaussianBlur filter can apply a Gaussian blur effect to the layer. It accepts a float parameter, inputRadius, which specifies the strength of blurring.
This will multiply an inputColor to the layer.
The pageCurl filter gives the layer a page curl effect. It accepts 3 float parameters:
- inputTime (from 0 to 1).
- inputAngle (in radian, must not be a multiple of π/2).
- inputRadius (in pixel, the radius of the curled part).
Transition filters also uses CAFilter as the interface, as CATransition also has a filter property. But the transition filters cannot be treated as static filters and applied to layers directly.