org.apache.batik.ext.awt.image.renderable
Class AbstractRable

java.lang.Object
  |
  +--org.apache.batik.ext.awt.image.renderable.AbstractRable
All Implemented Interfaces:
Filter, java.awt.image.renderable.RenderableImage
Direct Known Subclasses:
AbstractColorInterpolationRable, AffineRable8Bit, BackgroundRable8Bit, ClipRable8Bit, FilterAlphaRable, FilterAsAlphaRable, FilterChainRable8Bit, FilterResRable8Bit, FloodRable8Bit, GraphicsNodeRable8Bit, MaskRable8Bit, MorphologyRable8Bit, MultiResRable, PadRable8Bit, ProfileRable, RedRable

public abstract class AbstractRable
extends java.lang.Object
implements Filter

This is an abstract base class that takes care of most of the normal issues surrounding the implementation of the RenderableImage interface. It tries to make no assumptions about the subclass implementation.


Field Summary
protected  java.util.Map props
           
protected  java.util.Vector srcs
           
protected  long stamp
           
 
Fields inherited from interface java.awt.image.renderable.RenderableImage
HINTS_OBSERVED
 
Constructor Summary
protected AbstractRable()
          void constructor.
protected AbstractRable(Filter src)
          Construct an Abstract Rable from src.
protected AbstractRable(Filter src, java.util.Map props)
          Construct an Abstract Rable from src and props.
protected AbstractRable(java.util.List srcs)
          Construct an Abstract Rable from a list of sources.
protected AbstractRable(java.util.List srcs, java.util.Map props)
          Construct an Abstract Rable from a list of sources, and bounds.
 
Method Summary
 java.awt.image.RenderedImage createDefaultRendering()
           
 java.awt.image.RenderedImage createScaledRendering(int w, int h, java.awt.RenderingHints hints)
           
 java.awt.geom.Rectangle2D getBounds2D()
          Returns the bounds of the current image.
 java.awt.Shape getDependencyRegion(int srcIndex, java.awt.geom.Rectangle2D outputRgn)
          Returns the region of input data is is required to generate outputRgn.
 java.awt.Shape getDirtyRegion(int srcIndex, java.awt.geom.Rectangle2D inputRgn)
          This calculates the region of output that is affected by a change in a region of input.
 float getHeight()
           
 float getMinX()
           
 float getMinY()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.String[] getPropertyNames()
           
 java.util.Vector getSources()
           
 long getTimeStamp()
          Returns the current modification timestamp on this Renderable node.
 float getWidth()
           
protected  void init(Filter src)
          Initialize an Abstract Rable from src, bounds and props.
protected  void init(Filter src, java.util.Map props)
          Initialize an Abstract Rable from src, bounds and props.
protected  void init(java.util.List srcs)
          Initialize an Abstract Rable from a list of sources, and possibly a bounds.
protected  void init(java.util.List srcs, java.util.Map props)
          Initialize an Abstract Rable from a list of sources, and possibly a bounds.
 boolean isDynamic()
           
 void touch()
          Increments the time stamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.image.renderable.RenderableImage
createRendering
 

Field Detail

srcs

protected java.util.Vector srcs

props

protected java.util.Map props

stamp

protected long stamp
Constructor Detail

AbstractRable

protected AbstractRable()
void constructor. The subclass must call one of the flavors of init before the object becomes usable. This is useful when the proper parameters to the init method need to be computed in the subclasses constructor.

AbstractRable

protected AbstractRable(Filter src)
Construct an Abstract Rable from src.
Parameters:
src - will be the first (and only) member of the srcs Vector. The bounds of src are also used to set the bounds of this renderable.

AbstractRable

protected AbstractRable(Filter src,
                        java.util.Map props)
Construct an Abstract Rable from src and props.
Parameters:
src - will also be set as the first (and only) member of the srcs Vector.
props - use to initialize the properties on this renderable image.

AbstractRable

protected AbstractRable(java.util.List srcs)
Construct an Abstract Rable from a list of sources.
Parameters:
srcs - This is used to initialize the srcs Vector. The bounds of this renderable will be the union of the bounds of all the sources in srcs. All the members of srcs must be CacheableRable otherwise an error will be thrown.

AbstractRable

protected AbstractRable(java.util.List srcs,
                        java.util.Map props)
Construct an Abstract Rable from a list of sources, and bounds.
Parameters:
srcs - This is used to initialize the srcs Vector. All the members of srcs must be CacheableRable otherwise an error will be thrown.
props - use to initialize the properties on this renderable image.
Method Detail

touch

public final void touch()
Increments the time stamp. This should be called when ever the image changes in such a way that cached output should be discarded.

getTimeStamp

public long getTimeStamp()
Returns the current modification timestamp on this Renderable node. This value will change whenever cached output data becomes invalid.
Specified by:
getTimeStamp in interface Filter
Returns:
Current modification timestamp value.

init

protected void init(Filter src)
Initialize an Abstract Rable from src, bounds and props. This can be called long after the object is constructed to reset the state of the Renderable.
Parameters:
src - will become the first (and only) member of the srcs Vector.
bounds - defines the extent of this Rable in it's user coordinate system.

init

protected void init(Filter src,
                    java.util.Map props)
Initialize an Abstract Rable from src, bounds and props. This can be called long after the object is constructed to reset the state of the Renderable.
Parameters:
src - will also be set as the first (and only) member of the srcs Vector.
bounds - defines the extent of this Rable in it's user coordinate system.
props - use to set the properties on this renderable image. Always clears the current properties (even if null).

init

protected void init(java.util.List srcs)
Initialize an Abstract Rable from a list of sources, and possibly a bounds. This can be called long after the object is constructed to reset the state of the Renderable.
Parameters:
srcs - Used the create a new srcs Vector (old sources are dropped).
bounds - defines the new bounds of the object. If it is null then the bounds become the union of the bounds of all sources.

init

protected void init(java.util.List srcs,
                    java.util.Map props)
Initialize an Abstract Rable from a list of sources, and possibly a bounds. This can be called long after the object is constructed to reset the state of the Renderable.
Parameters:
srcs - Used the create a new srcs Vector (old sources are dropped).
bounds - defines the new bounds of the object. If it is null then the bounds become the union of the bounds of all sources.
props - use to set the properties on this renderable image. Always clears the current properties (even if null).

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Description copied from interface: Filter
Returns the bounds of the current image. This should be 'in sync' with getMinX, getMinY, getWidth, getHeight
Specified by:
getBounds2D in interface Filter

getSources

public java.util.Vector getSources()
Specified by:
getSources in interface java.awt.image.renderable.RenderableImage

createDefaultRendering

public java.awt.image.RenderedImage createDefaultRendering()
Specified by:
createDefaultRendering in interface java.awt.image.renderable.RenderableImage

createScaledRendering

public java.awt.image.RenderedImage createScaledRendering(int w,
                                                          int h,
                                                          java.awt.RenderingHints hints)
Specified by:
createScaledRendering in interface java.awt.image.renderable.RenderableImage

getMinX

public float getMinX()
Specified by:
getMinX in interface java.awt.image.renderable.RenderableImage

getMinY

public float getMinY()
Specified by:
getMinY in interface java.awt.image.renderable.RenderableImage

getWidth

public float getWidth()
Specified by:
getWidth in interface java.awt.image.renderable.RenderableImage

getHeight

public float getHeight()
Specified by:
getHeight in interface java.awt.image.renderable.RenderableImage

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface java.awt.image.renderable.RenderableImage

getPropertyNames

public java.lang.String[] getPropertyNames()
Specified by:
getPropertyNames in interface java.awt.image.renderable.RenderableImage

isDynamic

public boolean isDynamic()
Specified by:
isDynamic in interface java.awt.image.renderable.RenderableImage

getDependencyRegion

public java.awt.Shape getDependencyRegion(int srcIndex,
                                          java.awt.geom.Rectangle2D outputRgn)
Description copied from interface: Filter
Returns the region of input data is is required to generate outputRgn.
Specified by:
getDependencyRegion in interface Filter
Following copied from interface: org.apache.batik.ext.awt.image.renderable.Filter
Parameters:
srcIndex - The source to do the dependency calculation for.
outputRgn - The region of output you are interested in generating dependencies for. The is given in the user coordiate system for this node.
Returns:
The region of input required. This is in the user coordinate system for the source indicated by srcIndex.

getDirtyRegion

public java.awt.Shape getDirtyRegion(int srcIndex,
                                     java.awt.geom.Rectangle2D inputRgn)
Description copied from interface: Filter
This calculates the region of output that is affected by a change in a region of input.
Specified by:
getDirtyRegion in interface Filter
Following copied from interface: org.apache.batik.ext.awt.image.renderable.Filter
Parameters:
srcIndex - The input that inputRgn reflects changes in.
inputRgn - the region of input that has changed, used to calculate the returned shape. This is given in the user coordinate system of the source indicated by srcIndex.
Returns:
The region of output that would be invalid given a change to inputRgn of the source selected by srcIndex. this is in the user coordinate system of this node.


Copyright © 2002 Apache Software Foundation. All Rights Reserved.