org.jmage.filterchain
Class FilterChain

java.lang.Object
  extended by org.jmage.filterchain.FilterChain

public class FilterChain
extends java.lang.Object

A FilterChain processes an image by passing it through a preconfigured, ordered set of filters.


Field Summary
protected  java.util.List filters
           
protected static org.apache.log4j.Logger log
           
protected  java.lang.String name
           
 
Constructor Summary
FilterChain(java.lang.String name)
          Use this to construct an empty FilterChain.
 
Method Summary
 void addFilter(ConfigurableImageFilter filter, java.util.Properties filterProperties)
          Add a filter to the FilterChain's end.
 void addFilter(ConfigurableImageFilter filter, java.util.Properties filterProperties, int position)
          Add a filter to the FilterChain at the given position.
 void addFilter(ImageFilter filter)
          Add a filter to the FilterChain at the end.
 void addFilter(ImageFilter filter, int position)
          Add a filter to the FilterChain at the given position.
 boolean equals(java.lang.Object o)
          Override equals to check for unique name
 javax.media.jai.PlanarImage filter(javax.media.jai.PlanarImage image)
          Filters the image by passing it through all filters in the filterchain.
 java.lang.String getName()
          Gets the FilterChain's unique name.
 int hashCode()
          Override hashCode to generate for "name" uniqueness
 void removeFilter(ImageFilter filter)
          Removes a filter from a FilterChain.
 void updateConfigurableFilters(java.util.Properties filterProperties)
          Iterates through all configurable image filters in the filter filterchain and applies additional filterProperties to them.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name

filters

protected java.util.List filters

log

protected static org.apache.log4j.Logger log
Constructor Detail

FilterChain

public FilterChain(java.lang.String name)
Use this to construct an empty FilterChain. FilterChains need a unique name.

Method Detail

getName

public java.lang.String getName()
Gets the FilterChain's unique name.

Returns:
the unique name

addFilter

public void addFilter(ConfigurableImageFilter filter,
                      java.util.Properties filterProperties)
               throws FilterException
Add a filter to the FilterChain's end.

Parameters:
filter - the filter
filterProperties - the filter's properties
Throws:
FilterException - if the filter can't be properly initialized

addFilter

public void addFilter(ConfigurableImageFilter filter,
                      java.util.Properties filterProperties,
                      int position)
               throws FilterException,
                      java.lang.IndexOutOfBoundsException
Add a filter to the FilterChain at the given position.

Parameters:
filter - the filter
filterProperties - the filter's properties
position - the position in the filter filterchain
Throws:
FilterException - if the filter can't be properly initialized
java.lang.IndexOutOfBoundsException - if the FilterChain can't add the filter at the position.

addFilter

public void addFilter(ImageFilter filter,
                      int position)
               throws java.lang.IndexOutOfBoundsException
Add a filter to the FilterChain at the given position.

Parameters:
filter - the filter
position - the position in the filter filterchain
Throws:
java.lang.IndexOutOfBoundsException - if the FilterChain can't add the filter at the position.

addFilter

public void addFilter(ImageFilter filter)
Add a filter to the FilterChain at the end.

Parameters:
filter - the filter

removeFilter

public void removeFilter(ImageFilter filter)
                  throws FilterException
Removes a filter from a FilterChain.

Parameters:
filter - the filter
Throws:
FilterException

updateConfigurableFilters

public void updateConfigurableFilters(java.util.Properties filterProperties)
                               throws FilterException
Iterates through all configurable image filters in the filter filterchain and applies additional filterProperties to them. Filters must declare public constants with the property name to be able to for this to work.

Parameters:
filterProperties -
Throws:
FilterException

filter

public javax.media.jai.PlanarImage filter(javax.media.jai.PlanarImage image)
                                   throws FilterException
Filters the image by passing it through all filters in the filterchain.

Parameters:
image - the image
Returns:
the filtered image
Throws:
FilterException

equals

public boolean equals(java.lang.Object o)
Override equals to check for unique name

Overrides:
equals in class java.lang.Object
Parameters:
o - the FilterChain
Returns:
true | false

hashCode

public int hashCode()
Override hashCode to generate for "name" uniqueness

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode


Copyright © 2004-2008 Sourceforge. All Rights Reserved.