Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.batik.ext.awt.image.rendered
Class AbstractRed  view AbstractRed download AbstractRed.java

java.lang.Object
  extended byorg.apache.batik.ext.awt.image.rendered.AbstractRed
All Implemented Interfaces:
CachableRed, java.awt.image.RenderedImage
Direct Known Subclasses:
AbstractTiledRed, AffineRed, Any2LsRGBRed, Any2LumRed, Any2sRGBRed, BufferedImageCachableRed, ColorMatrixRed, ComponentTransferRed, CompositeRed, DiffuseLightingRed, DisplacementMapRed, FilterAlphaRed, FilterAsAlphaRed, FloodRed, FormatRed, GaussianBlurRed8Bit, MultiplyAlphaRed, PadRed, ProfileRed, TileRed, TranslateRed, TurbulencePatternRed

public abstract class AbstractRed
extends java.lang.Object
implements CachableRed

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

Version:
$Id: AbstractRed.java,v 1.12 2005/03/27 08:58:33 cam Exp $

Field Summary
protected  java.awt.Rectangle bounds
           
protected  java.awt.image.ColorModel cm
           
protected  int minTileX
           
protected  int minTileY
           
protected  int numXTiles
           
protected  int numYTiles
           
protected  java.util.Map props
           
protected  java.awt.image.SampleModel sm
           
protected  java.util.Vector srcs
           
protected  int tileGridXOff
           
protected  int tileGridYOff
           
protected  int tileHeight
           
protected  int tileWidth
           
 
Constructor Summary
protected AbstractRed()
          void constructor.
protected AbstractRed(CachableRed src, java.util.Map props)
          Construct an Abstract RenderedImage from a source image and props (may be null).
protected AbstractRed(CachableRed src, java.awt.Rectangle bounds, java.awt.image.ColorModel cm, java.awt.image.SampleModel sm, int tileGridXOff, int tileGridYOff, java.util.Map props)
          Construct an Abstract Rable from a bounds rect and props (may be null).
protected AbstractRed(CachableRed src, java.awt.Rectangle bounds, java.awt.image.ColorModel cm, java.awt.image.SampleModel sm, java.util.Map props)
          Construct an Abstract RenderedImage from a source image, bounds rect and props (may be null).
protected AbstractRed(CachableRed src, java.awt.Rectangle bounds, java.util.Map props)
          Construct an Abstract RenderedImage from a source image, bounds rect and props (may be null).
protected AbstractRed(java.util.List srcs, java.awt.Rectangle bounds, java.awt.image.ColorModel cm, java.awt.image.SampleModel sm, int tileGridXOff, int tileGridYOff, java.util.Map props)
          Construct an Abstract RenderedImage from a bounds rect, ColorModel (may be null), SampleModel (may be null), tile grid offsets and props (may be null).
protected AbstractRed(java.util.List srcs, java.awt.Rectangle bounds, java.awt.image.ColorModel cm, java.awt.image.SampleModel sm, java.util.Map props)
          Construct an Abstract RenderedImage from a bounds rect, ColorModel (may be null), SampleModel (may be null) and props (may be null).
protected AbstractRed(java.util.List srcs, java.awt.Rectangle bounds, java.util.Map props)
          Construct an Abstract Rable from a List of sources a bounds rect and props (may be null).
protected AbstractRed(java.awt.Rectangle bounds, java.util.Map props)
          Construct an Abstract RenderedImage from a bounds rect and props (may be null).
 
Method Summary
static void copyBand(java.awt.image.Raster src, int srcBand, java.awt.image.WritableRaster dst, int dstBand)
           
 void copyToRaster(java.awt.image.WritableRaster wr)
          Copies data from this images tile grid into wr.
 java.awt.Rectangle getBounds()
          Returns the bounds of the current image.
 java.awt.image.ColorModel getColorModel()
           
 java.awt.image.Raster getData()
           
 java.awt.image.Raster getData(java.awt.Rectangle rect)
           
 java.awt.Shape getDependencyRegion(int srcIndex, java.awt.Rectangle outputRgn)
          Returns the region of input data is is required to generate outputRgn.
 java.awt.Shape getDirtyRegion(int srcIndex, java.awt.Rectangle inputRgn)
          This calculates the region of output that is affected by a change in a region of input.
 int getHeight()
           
 int getMinTileX()
           
 int getMinTileY()
           
 int getMinX()
           
 int getMinY()
           
 int getNumXTiles()
           
 int getNumYTiles()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.String[] getPropertyNames()
           
 java.awt.image.SampleModel getSampleModel()
           
 java.util.Vector getSources()
           
 java.awt.image.Raster getTile(int tileX, int tileY)
           
 int getTileGridXOffset()
           
 int getTileGridYOffset()
           
 int getTileHeight()
           
 int getTileWidth()
           
 int getWidth()
           
 int getXTile(int xloc)
          Returns the x index of tile under xloc.
 int getYTile(int yloc)
          Returns the y index of tile under yloc.
protected  void init(CachableRed src, java.awt.Rectangle bounds, java.awt.image.ColorModel cm, java.awt.image.SampleModel sm, int tileGridXOff, int tileGridYOff, java.util.Map props)
          This is one of two basic init function (this is for single source rendereds).
protected  void init(java.util.List srcs, java.awt.Rectangle bounds, java.awt.image.ColorModel cm, java.awt.image.SampleModel sm, int tileGridXOff, int tileGridYOff, java.util.Map props)
          This is the basic init function.
 java.awt.image.WritableRaster makeTile(int tileX, int tileY)
          This is a helper function that will create the tile requested Including properly subsetting the bounds of the tile to the bounds of the current image.
protected  void updateTileGridInfo()
          This function computes all the basic information about the tile grid based on the data stored in sm, and tileGridX/YOff.
 
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.RenderedImage
copyData
 

Field Detail

bounds

protected java.awt.Rectangle bounds

srcs

protected java.util.Vector srcs

props

protected java.util.Map props

sm

protected java.awt.image.SampleModel sm

cm

protected java.awt.image.ColorModel cm

tileGridXOff

protected int tileGridXOff

tileGridYOff

protected int tileGridYOff

tileWidth

protected int tileWidth

tileHeight

protected int tileHeight

minTileX

protected int minTileX

minTileY

protected int minTileY

numXTiles

protected int numXTiles

numYTiles

protected int numYTiles
Constructor Detail

AbstractRed

protected AbstractRed()
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.


AbstractRed

protected AbstractRed(java.awt.Rectangle bounds,
                      java.util.Map props)
Construct an Abstract RenderedImage from a bounds rect and props (may be null). The srcs Vector will be empty.


AbstractRed

protected AbstractRed(CachableRed src,
                      java.util.Map props)
Construct an Abstract RenderedImage from a source image and props (may be null).


AbstractRed

protected AbstractRed(CachableRed src,
                      java.awt.Rectangle bounds,
                      java.util.Map props)
Construct an Abstract RenderedImage from a source image, bounds rect and props (may be null).


AbstractRed

protected AbstractRed(CachableRed src,
                      java.awt.Rectangle bounds,
                      java.awt.image.ColorModel cm,
                      java.awt.image.SampleModel sm,
                      java.util.Map props)
Construct an Abstract RenderedImage from a source image, bounds rect and props (may be null).


AbstractRed

protected AbstractRed(CachableRed src,
                      java.awt.Rectangle bounds,
                      java.awt.image.ColorModel cm,
                      java.awt.image.SampleModel sm,
                      int tileGridXOff,
                      int tileGridYOff,
                      java.util.Map props)
Construct an Abstract Rable from a bounds rect and props (may be null). The srcs Vector will be empty.


AbstractRed

protected AbstractRed(java.util.List srcs,
                      java.awt.Rectangle bounds,
                      java.util.Map props)
Construct an Abstract Rable from a List of sources a bounds rect and props (may be null).


AbstractRed

protected AbstractRed(java.util.List srcs,
                      java.awt.Rectangle bounds,
                      java.awt.image.ColorModel cm,
                      java.awt.image.SampleModel sm,
                      java.util.Map props)
Construct an Abstract RenderedImage from a bounds rect, ColorModel (may be null), SampleModel (may be null) and props (may be null). The srcs Vector will be empty.


AbstractRed

protected AbstractRed(java.util.List srcs,
                      java.awt.Rectangle bounds,
                      java.awt.image.ColorModel cm,
                      java.awt.image.SampleModel sm,
                      int tileGridXOff,
                      int tileGridYOff,
                      java.util.Map props)
Construct an Abstract RenderedImage from a bounds rect, ColorModel (may be null), SampleModel (may be null), tile grid offsets and props (may be null). The srcs Vector will be empty.

Method Detail

init

protected void init(CachableRed src,
                    java.awt.Rectangle bounds,
                    java.awt.image.ColorModel cm,
                    java.awt.image.SampleModel sm,
                    int tileGridXOff,
                    int tileGridYOff,
                    java.util.Map props)
This is one of two basic init function (this is for single source rendereds). It is provided so subclasses can compute various values before initializing all the state in the base class. You really should call this method before returning from your subclass constructor.


init

protected void init(java.util.List srcs,
                    java.awt.Rectangle bounds,
                    java.awt.image.ColorModel cm,
                    java.awt.image.SampleModel sm,
                    int tileGridXOff,
                    int tileGridYOff,
                    java.util.Map props)
This is the basic init function. It is provided so subclasses can compute various values before initializing all the state in the base class. You really should call this method before returning from your subclass constructor.


updateTileGridInfo

protected void updateTileGridInfo()
This function computes all the basic information about the tile grid based on the data stored in sm, and tileGridX/YOff. It is responsible for updating tileWidth, tileHeight, minTileX/Y, and numX/YTiles.


getBounds

public java.awt.Rectangle getBounds()
Description copied from interface: CachableRed
Returns the bounds of the current image. This should be 'in sync' with getMinX, getMinY, getWidth, getHeight

Specified by:
getBounds in interface CachableRed

getSources

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

getColorModel

public java.awt.image.ColorModel getColorModel()
Specified by:
getColorModel in interface java.awt.image.RenderedImage

getSampleModel

public java.awt.image.SampleModel getSampleModel()
Specified by:
getSampleModel in interface java.awt.image.RenderedImage

getMinX

public int getMinX()
Specified by:
getMinX in interface java.awt.image.RenderedImage

getMinY

public int getMinY()
Specified by:
getMinY in interface java.awt.image.RenderedImage

getWidth

public int getWidth()
Specified by:
getWidth in interface java.awt.image.RenderedImage

getHeight

public int getHeight()
Specified by:
getHeight in interface java.awt.image.RenderedImage

getTileWidth

public int getTileWidth()
Specified by:
getTileWidth in interface java.awt.image.RenderedImage

getTileHeight

public int getTileHeight()
Specified by:
getTileHeight in interface java.awt.image.RenderedImage

getTileGridXOffset

public int getTileGridXOffset()
Specified by:
getTileGridXOffset in interface java.awt.image.RenderedImage

getTileGridYOffset

public int getTileGridYOffset()
Specified by:
getTileGridYOffset in interface java.awt.image.RenderedImage

getMinTileX

public int getMinTileX()
Specified by:
getMinTileX in interface java.awt.image.RenderedImage

getMinTileY

public int getMinTileY()
Specified by:
getMinTileY in interface java.awt.image.RenderedImage

getNumXTiles

public int getNumXTiles()
Specified by:
getNumXTiles in interface java.awt.image.RenderedImage

getNumYTiles

public int getNumYTiles()
Specified by:
getNumYTiles in interface java.awt.image.RenderedImage

getProperty

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

getPropertyNames

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

getDependencyRegion

public java.awt.Shape getDependencyRegion(int srcIndex,
                                          java.awt.Rectangle outputRgn)
Description copied from interface: CachableRed
Returns the region of input data is is required to generate outputRgn.

Specified by:
getDependencyRegion in interface CachableRed

getDirtyRegion

public java.awt.Shape getDirtyRegion(int srcIndex,
                                     java.awt.Rectangle inputRgn)
Description copied from interface: CachableRed
This calculates the region of output that is affected by a change in a region of input.

Specified by:
getDirtyRegion in interface CachableRed

getTile

public java.awt.image.Raster getTile(int tileX,
                                     int tileY)
Specified by:
getTile in interface java.awt.image.RenderedImage

getData

public java.awt.image.Raster getData()
Specified by:
getData in interface java.awt.image.RenderedImage

getData

public java.awt.image.Raster getData(java.awt.Rectangle rect)
Specified by:
getData in interface java.awt.image.RenderedImage

getXTile

public final int getXTile(int xloc)
Returns the x index of tile under xloc.


getYTile

public final int getYTile(int yloc)
Returns the y index of tile under yloc.


copyToRaster

public void copyToRaster(java.awt.image.WritableRaster wr)
Copies data from this images tile grid into wr. wr may extend outside the bounds of this image in which case the data in wr outside the bounds will not be touched.


makeTile

public java.awt.image.WritableRaster makeTile(int tileX,
                                              int tileY)
This is a helper function that will create the tile requested Including properly subsetting the bounds of the tile to the bounds of the current image.


copyBand

public static void copyBand(java.awt.image.Raster src,
                            int srcBand,
                            java.awt.image.WritableRaster dst,
                            int dstBand)