javax.media.jai
Class BorderExtenderConstant

java.lang.Object
  extended byjavax.media.jai.BorderExtender
      extended byjavax.media.jai.BorderExtenderConstant
All Implemented Interfaces:
Serializable

public final class BorderExtenderConstant
extends BorderExtender

A subclass of BorderExtender that implements border extension by filling all pixels outside of the image bounds with constant values. For example, the image:

ABC
DEF
GHI

if extended by adding two extra rows to the top and bottom and two extra columns on the left and right sides, would become:

XXXXXXX
XXXXXXX
XXABCXX
XXDEFXX
XXGHIXX
XXXXXXX
XXXXXXX
where X is the constant fill value. The set of constants is clamped to the range and precision of the data type of the WritableRaster being filled. The number of constants used is given by the number of bands of the WritableRaster. If the WritableRaster has b bands, and there are c constants, constants 0 through b - 1 are used when b <= c. If there is only a single constant, then it is used for all bands. If b > c, an UnsupportedOperationException is thrown.

See Also:
BorderExtender, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.BorderExtender
BORDER_COPY, BORDER_REFLECT, BORDER_WRAP, BORDER_ZERO
 
Constructor Summary
BorderExtenderConstant(double[] constants)
          Constructs an instance of BorderExtenderConstant with a given set of constants.
 
Method Summary
 void extend(WritableRaster raster, PlanarImage im)
          Fills in the portions of a given Raster that lie outside the bounds of a given PlanarImage with constant values.
 double[] getConstants()
          Returns a clone of the constants array originally supplied to the constructor.
 
Methods inherited from class javax.media.jai.BorderExtender
createInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BorderExtenderConstant

public BorderExtenderConstant(double[] constants)
Constructs an instance of BorderExtenderConstant with a given set of constants. The constants are specified as an array of doubles.

Method Detail

getConstants

public final double[] getConstants()
Returns a clone of the constants array originally supplied to the constructor.

Since:
JAI 1.1.2

extend

public final void extend(WritableRaster raster,
                         PlanarImage im)
Fills in the portions of a given Raster that lie outside the bounds of a given PlanarImage with constant values.

The portion of raster that lies within im.getBounds() is not altered.

Specified by:
extend in class BorderExtender
Parameters:
raster - The WritableRaster the border area of which is to be filled with constants.
im - The PlanarImage which determines the portion of the WritableRaster not to be filled.
Throws:
IllegalArgumentException - if either parameter is null.
UnsupportedOperationException - if the number of image bands exceeds the number of constants and the latter is not unity.