C# Class SparrowSharp.Filters.BlurFilter

The BlurFilter applies a gaussian blur to an object. The strength of the blur can be set for x- and y-axis separately (always relative to the stage).

A blur filter can also be set up as a drop shadow or glow filter. Use FilterFactory to create such a filter.

For each blur direction, the number of required passes is ceil(blur).

blur = 0.5: 1 pass

blur = 1.0: 1 pass

blur = 1.5: 2 passes

blur = 2.0: 2 passes

etc.

Inheritance: FragmentFilter
Mostra file Open project: fmotagarcia/sparrow-sharp Class Usage Examples

Public Methods

Method Description
BlurFilter ( float blur = 1.0f, float resolution = 1.0f ) : System

Initializes a blur filter with the specified blur and a resolution.

SetUniformColor ( bool enable, uint color = 0x000000, float alpha = 1.0f ) : void

A uniform color will replace the RGB values of the input color, while the alpha value will be multiplied with the given factor. Pass false as the first parameter to deactivate the uniform color.

Protected Methods

Method Description
ActivateWithPass ( int pass, Texture texture, Matrix mvpMatrix ) : void
CreatePrograms ( ) : void

Private Methods

Method Description
UpdateMarginsAndPasses ( ) : void
UpdateParamaters ( int pass, int texWidth, int texHeight ) : void

Method Details

ActivateWithPass() protected method

protected ActivateWithPass ( int pass, Texture texture, Matrix mvpMatrix ) : void
pass int
texture Sparrow.Textures.Texture
mvpMatrix Matrix
return void

BlurFilter() public method

Initializes a blur filter with the specified blur and a resolution.
public BlurFilter ( float blur = 1.0f, float resolution = 1.0f ) : System
blur float
resolution float
return System

CreatePrograms() protected method

protected CreatePrograms ( ) : void
return void

SetUniformColor() public method

A uniform color will replace the RGB values of the input color, while the alpha value will be multiplied with the given factor. Pass false as the first parameter to deactivate the uniform color.
public SetUniformColor ( bool enable, uint color = 0x000000, float alpha = 1.0f ) : void
enable bool
color uint
alpha float
return void