Nevron .NET Vision
Framework / Presentation Layer / Graphics / Appearance Styles / Image Filters Style / Blur Image Filter

In This Topic
    Blur Image Filter
    In This Topic

    The blur image filter applies a blur convolution kernel on the alpha channel of the rasterized image. This results in blurred edges of the processed image.

     Creating a Blur Image Filter

    You create a blur image filter by creating an instance of the NBlurImageFilter class and adding it to the Filters collection of the NImageFiltersStyle object:

    C#
    Copy Code
    NBlurImageFilter blurImageFilter = new NBlurImageFilter();
    someFillStyle.ImageFiltersStyle.Filters.Add(blurImageFilter);
    
    Visual Basic
    Copy Code
    Dim blurImageFilter As NBlurImageFilter =  New NBlurImageFilter()
    someFillStyle.ImageFiltersStyle.Filters.Add(blurImageFilter)
    

    This will create a blur image filter with default properties.

     Tuning the Blur Image Filter

    The most important property of the blur image filter is the AlphaChannelOnly property controlling whether or not the filter will act on the alpha channel or the RGBA channels of the image. The default value of this property is false, but you can set it to true if you intend to blur black images or the size of the blur image filter kernel is small.

    Following are the BlurType and Size properties that define the function used to create the convolution matrix (kernel) and its size respectively. The following code creates a blur image filter with Gaussian convolution and size 10x10:

    C#
    Copy Code
    NBlurImageFilter blurFilter = new NBlurImageFilter();
    blurFilter.BlurType = BlurType.Gaussian;
    blurFilter.Size = new NSizeL(new NLength(10, NGraphicsUnit.Pixel), new NLength(10, NGraphicsUnit.Pixel));
    someFillStyle.ImageFiltersStyle.Filters.Add(blurFilter);
    
    Visual Basic
    Copy Code
    Dim blurFilter As NBlurImageFilter =  New NBlurImageFilter() 
    blurFilter.BlurType = BlurType.Gaussian
    blurFilter.Size = New NSizeL(New NLength(10, NGraphicsUnit.Pixel), New NLength(10, NGraphicsUnit.Pixel))
    someFillStyle.ImageFiltersStyle.Filters.Add(blurFilter)
    

    This means that pixels at distance up to 10 pixels away will be blurred using a Gaussian distribution function.

    Furthermore you can control whether the filter will blur the top, left, bottom or right side of the image using the BlurTop, BlurLeft, BlurBottom and BlurRight properties of the NBlurImageFilter object.

    The following image shows several bubbles rendered using a blur image filter with different settings:

    The first bubble is generated with blur image filter with BlurLeft and BlurRight set to false.

    The second bubble is generated with blur image filter with BlurTop and BlurBottom set to false.

    See Also