com.flagstone.transform.filter
Class ConvolutionFilter

java.lang.Object
  extended by com.flagstone.transform.filter.ConvolutionFilter
All Implemented Interfaces:
SWFEncodeable, Filter

public final class ConvolutionFilter
extends Object
implements Filter

ConvolutionFilter is used to apply a two-dimensional discrete convolution on the pixels of the object on the display list.


Nested Class Summary
static class ConvolutionFilter.Builder
          Builder for creating ConvolutionFilter objects.
 
Constructor Summary
ConvolutionFilter(ConvolutionFilter.Builder builder)
          Create a new ConvolutionFilter object using the parameters defined in the Builder.
ConvolutionFilter(SWFDecoder coder, Context context)
          Creates and initialises a ConvolutionFilter object using values encoded in the Flash binary format.
 
Method Summary
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 boolean equals(Object object)
           
 float getBias()
          Get the bias for the convolution equation.
 Color getColor()
          Get the default colour used for pixel outside the display object.
 float getDivisor()
          Get the divisor for the convolution equation.
 float[][] getMatrix()
          Get a copy of the convolution matrix.
 int hashCode()
           
 boolean isAlpha()
          Is the alpha value of the pixels in the display list object preserved in the output of the convolution.
 boolean isClamp()
          Are outside pixels clamped to the nearest inside one (true) or to the default colour (false).
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConvolutionFilter

public ConvolutionFilter(ConvolutionFilter.Builder builder)
Create a new ConvolutionFilter object using the parameters defined in the Builder.

Parameters:
builder - a Builder containing the parameters for the instance.

ConvolutionFilter

public ConvolutionFilter(SWFDecoder coder,
                         Context context)
                  throws IOException
Creates and initialises a ConvolutionFilter object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
context - a Context object used to manage the decoders for different type of object and to pass information on how objects are decoded.
Throws:
IOException - if an error occurs while decoding the data.
Method Detail

getDivisor

public float getDivisor()
Get the divisor for the convolution equation.

Returns:
the divisor value.

getBias

public float getBias()
Get the bias for the convolution equation.

Returns:
the bias value.

getMatrix

public float[][] getMatrix()
Get a copy of the convolution matrix.

Returns:
a copy of the matrix.

getColor

public Color getColor()
Get the default colour used for pixel outside the display object.

Returns:
the colour used for outside pixels.

isClamp

public boolean isClamp()
Are outside pixels clamped to the nearest inside one (true) or to the default colour (false).

Returns:
true if the pixels are clamped, false if the default colour is used.

isAlpha

public boolean isAlpha()
Is the alpha value of the pixels in the display list object preserved in the output of the convolution.

Returns:
true if alpha is preserved, false if not.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.