function vipblkeffects
% VIPBLKEFFECTS Mask dynamic dialog function for Effects demo

% Copyright 1995-2005 The MathWorks, Inc.
% $Date: 2010/08/30 03:04:57 $  $Revision: 1.1.6.1 $

blk = gcbh;
effect_str = get_param(blk, 'effect');

% handle visibility options for the effects demo
maskVis = get_param(blk, 'MaskVisibilities');
maskVal = get_param(blk, 'MaskValues');
oldMaskVis = maskVis;

% indices to the components on the mask
[sharpness_idx, brush_size_idx, blur_radius_idx,...
    spread_distance_idx, get_angle_idx, angle_idx] = deal(2, 3, 4, 5, 6, 7);

% handle dynamic cases
switch effect_str
    case ('Relief')
        maskVis{sharpness_idx} = 'off';
        maskVis{brush_size_idx} = 'off';
        maskVis{blur_radius_idx} = 'off';
        maskVis{spread_distance_idx} = 'off';
        maskVis{get_angle_idx} = 'on';
        maskVis{angle_idx} = maskVal{get_angle_idx};
        
    case ('Sharpen')
        maskVis{sharpness_idx} = 'on';
        maskVis{brush_size_idx} = 'off';
        maskVis{blur_radius_idx} = 'off';
        maskVis{spread_distance_idx} = 'off';
        maskVis{get_angle_idx} = 'off';
        maskVis{angle_idx} = 'off';
    
    case ('Oil painting')
        maskVis{sharpness_idx} = 'off';
        maskVis{brush_size_idx} = 'on';
        maskVis{blur_radius_idx} = 'off';
        maskVis{spread_distance_idx} = 'off';
        maskVis{get_angle_idx} = 'off';
        maskVis{angle_idx} = 'off';
        
    case ('Emboss')
        maskVis{sharpness_idx} = 'off';
        maskVis{brush_size_idx} = 'off';
        maskVis{blur_radius_idx} = 'off';
        maskVis{spread_distance_idx} = 'off';
        maskVis{get_angle_idx} = 'on';       
        maskVis{angle_idx} = maskVal{get_angle_idx};
        
    case ('Blur')
        maskVis{sharpness_idx} = 'off';
        maskVis{brush_size_idx} = 'off';
        maskVis{blur_radius_idx} = 'on';
        maskVis{spread_distance_idx} = 'off';
        maskVis{get_angle_idx} = 'off';
        maskVis{angle_idx} = 'off';
    
    case ('Spread')
        maskVis{sharpness_idx} = 'off';
        maskVis{brush_size_idx} = 'off';
        maskVis{blur_radius_idx} = 'off';
        maskVis{spread_distance_idx} = 'on';
        maskVis{get_angle_idx} = 'off';
        maskVis{angle_idx} = 'off';
end

% change the mask if necessary
if (~isequal(maskVis, oldMaskVis))
    set_param(blk, 'MaskVisibilities', maskVis);
end

% EOF