Graphics Reference
In-Depth Information
Listing 6-2 reflects the code changes. A change is made to the line where we set the
inputRadius initial value to 0.0f and we add the line to name the filter so that it can be
called later. The complete view initialization code is in Listing 6-3.
LISTING 6-2
Adding Filter Name and Setting inputRadius
CIFilter *blurFilter =
[CIFilter filterWithName: @”CIGaussianBlur” ];
[blurFilter setDefaults];
[blurFilter setValue :[ NSNumber numberWithFloat :0.0f]
forKey : @”inputRadius” ];
[blurFilter setName : @”blur” ];
[ layer setFilters :[ NSArray arrayWithObject :blurFilter]];
LISTING 6-3
BlurView Initialization Code
- ( void )awakeFromNib;
{
[ self setWantsLayer: YES ];
// Initialize the layer
blurLayer = [[[BlurLayer alloc ] init ] retain ];
[blurLayer setMasksToBounds : YES ];
// Set the layer to fill the entire frame
[blurLayer setFrame : CGRectMake (0.0,
0.0,
[ self frame ]. size . width ,
[ self frame ]. size . height )];
[[ self layer ] addSublayer :blurLayer];
// Initialize the Gaussian blur filter
CIFilter *blurFilter =
[CIFilter filterWithName: @”CIGaussianBlur” ];
[blurFilter setDefaults];
[blurFilter setValue :[ NSNumber numberWithFloat :0.0]
forKey : @”inputRadius” ];
 
Search WWH ::




Custom Search