Graphics Reference
In-Depth Information
LISTING 6-10
Continued
return [ NSArray arrayWithObjects :
blurFilter,
hueFilter,
colorFilter,
nil ];
}
This code creates three filters: blurFilter , hueFilter , and colorFilter . The latter,
colorFilter , enables us to alter three different values: saturation, contrast, and bright-
ness. Each filter has a set of default values that we can take advantage of by calling
-setDefaults . Notice also that we have given each filter a name; these names are used to
access filter values with bindings and KVC.
With the filters added to the layer, we can access each filter's parameters using a key-path.
The full key-paths for each slider are shown in Table 6-1.
TABLE 6-1
Filter Key-Paths
Filter
Filter Name
Parameter Name
Key-Path
blur
inputRadius
imageLayer.filters.blur.inputRadius
hue
inputAngle
imageLayer.filters.hue.inputAngle
color
inputSaturation
imageLayer.filters.color.inputSaturation
color
inputContrast
imageLayer.filters.color.inputContrast
color
inputBrightness
imageLayer.filters.color.inputBrightnes
If you look at the bindings menu in the slider inspector in Interface Builder, you can see
how these key-paths are applied. Figure 6-6 shows the key path for the hue filter.
FIGURE 6-6
Bindings for the Hue Filter Slider
 
Search WWH ::




Custom Search