Packagestarling.filters
Classpublic class BlurFilter
InheritanceBlurFilter Inheritance FragmentFilter Inheritance Object

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 the respective static methods to create such a filter.



Public Properties
 PropertyDefined By
  blurX : Number
The blur factor in x-direction (stage coordinates).
BlurFilter
  blurY : Number
The blur factor in y-direction (stage coordinates).
BlurFilter
 InheritedisCached : Boolean
[read-only] Indicates if the filter is cached (via the "cache" method).
FragmentFilter
 Inheritedmode : String
The filter mode, which is one of the constants defined in the "FragmentFilterMode" class.
FragmentFilter
 InheritedoffsetX : Number
Use the x-offset to move the filter output to the right or left.
FragmentFilter
 InheritedoffsetY : Number
Use the y-offset to move the filter output to the top or bottom.
FragmentFilter
 Inheritedresolution : Number
The resolution of the filter texture.
FragmentFilter
Protected Properties
 PropertyDefined By
 InheritedbaseTextureID : int
The ID (sampler) of the input texture (containing the output of the previous pass).
FragmentFilter
 InheritedmarginX : Number
The x-margin will extend the size of the filter texture along the x-axis.
FragmentFilter
 InheritedmarginY : Number
The y-margin will extend the size of the filter texture along the y-axis.
FragmentFilter
 InheritedmvpConstantID : int
The ID of the first register of the modelview-projection constant (a 4x4 matrix).
FragmentFilter
 InheritednumPasses : int
The number of passes the filter is applied.
FragmentFilter
 InheritedtexCoordsAtID : int
The ID of the vertex buffer attribute that stores the texture coordinates.
FragmentFilter
 InheritedvertexPosAtID : int
The ID of the vertex buffer attribute that stores the vertex position.
FragmentFilter
Public Methods
 MethodDefined By
  
BlurFilter(blurX:Number = 1, blurY:Number = 1, resolution:Number = 1)
Create a new BlurFilter.
BlurFilter
 Inherited
cache():void
Caches the filter output into a texture.
FragmentFilter
 Inherited
clearCache():void
Clears the cached output of the filter.
FragmentFilter
  
createDropShadow(distance:Number = 4.0, angle:Number = 0.785, color:uint = 0x0, alpha:Number = 0.5, blur:Number = 1.0, resolution:Number = 0.5):BlurFilter
[static] Creates a blur filter that is set up for a drop shadow effect.
BlurFilter
  
createGlow(color:uint = 0xffff00, alpha:Number = 1.0, blur:Number = 1.0, resolution:Number = 0.5):BlurFilter
[static] Creates a blur filter that is set up for a glow effect.
BlurFilter
 Inherited
dispose():void
Disposes the filter (programs, buffers, textures).
FragmentFilter
 Inherited
render(object:DisplayObject, support:RenderSupport, parentAlpha:Number):void
Applies the filter on a certain display object, rendering the output into the current render target.
FragmentFilter
  
setUniformColor(enable:Boolean, color:uint = 0x0, alpha:Number = 1.0):void
A uniform color will replace the RGB values of the input color, while the alpha value will be multiplied with the given factor.
BlurFilter
Protected Methods
 MethodDefined By
 Inherited
activate(pass:int, context:Context3D, texture:Texture):void
Subclasses must override this method and use it to activate their fragment- and to vertext-programs.
FragmentFilter
 Inherited
assembleAgal(fragmentShader:String = null, vertexShader:String = null):Program3D
Assembles fragment- and vertex-shaders, passed as Strings, to a Program3D.
FragmentFilter
 Inherited
Subclasses must override this method and use it to create their fragment- and vertex-programs.
FragmentFilter
 Inherited
deactivate(pass:int, context:Context3D, texture:Texture):void
This method is called directly after 'context.drawTriangles'.
FragmentFilter
Protected Constants
 ConstantDefined By
 InheritedPMA : Boolean = true
All filter processing is expected to be done with premultiplied alpha.
FragmentFilter
 InheritedSTD_FRAGMENT_SHADER : String = tex oc, v0, fs0 <2d, clamp, linear, mipnone>
The standard fragment shader code.
FragmentFilter
 InheritedSTD_VERTEX_SHADER : String
The standard vertex shader code.
FragmentFilter
Property Detail
blurXproperty
blurX:Number

The blur factor in x-direction (stage coordinates). The number of required passes will be Math.ceil(value).


Implementation
    public function get blurX():Number
    public function set blurX(value:Number):void
blurYproperty 
blurY:Number

The blur factor in y-direction (stage coordinates). The number of required passes will be Math.ceil(value).


Implementation
    public function get blurY():Number
    public function set blurY(value:Number):void
Constructor Detail
BlurFilter()Constructor
public function BlurFilter(blurX:Number = 1, blurY:Number = 1, resolution:Number = 1)

Create a new BlurFilter. For each blur direction, the number of required passes is Math.ceil(blur).

Instead of raising the number of passes, you should consider lowering the resolution. A lower resolution will result in a blurrier image, while reducing the rendering cost.

Parameters
blurX:Number (default = 1)
 
blurY:Number (default = 1)
 
resolution:Number (default = 1)
Method Detail
createDropShadow()method
public static function createDropShadow(distance:Number = 4.0, angle:Number = 0.785, color:uint = 0x0, alpha:Number = 0.5, blur:Number = 1.0, resolution:Number = 0.5):BlurFilter

Creates a blur filter that is set up for a drop shadow effect.

Parameters

distance:Number (default = 4.0)
 
angle:Number (default = 0.785)
 
color:uint (default = 0x0)
 
alpha:Number (default = 0.5)
 
blur:Number (default = 1.0)
 
resolution:Number (default = 0.5)

Returns
BlurFilter
createGlow()method 
public static function createGlow(color:uint = 0xffff00, alpha:Number = 1.0, blur:Number = 1.0, resolution:Number = 0.5):BlurFilter

Creates a blur filter that is set up for a glow effect.

Parameters

color:uint (default = 0xffff00)
 
alpha:Number (default = 1.0)
 
blur:Number (default = 1.0)
 
resolution:Number (default = 0.5)

Returns
BlurFilter
setUniformColor()method 
public function setUniformColor(enable:Boolean, color:uint = 0x0, alpha:Number = 1.0):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.

Parameters

enable:Boolean
 
color:uint (default = 0x0)
 
alpha:Number (default = 1.0)