javax.media.jai
Class ImageLayout

java.lang.Object
  extended by javax.media.jai.ImageLayout
All Implemented Interfaces:
Serializable, Cloneable

public class ImageLayout
extends Object
implements Cloneable, Serializable

A class describing the desired layout of an OpImage.

The ImageLayout class encapsulates three types of information about an image:

Each of these parameters may be set individually, or left unset. An unset parameter will cause the corresponding value of a given RenderedImage to be used. For example, the code:

 ImageLayout layout;
 RenderedImage im;

 int width = layout.getTileWidth(im);
 
will return the tile width of the ImageLayout if it is set, or the tile width of the image im if it is not.

ImageLayout objects are primarily intended to be passed as part of the renderingHints argument of the create() method of RenderedImageFactory. The create() method may remove parameter settings that it cannot deal with, prior to passing the ImageLayout to any OpImage constructors. New OpImage subclasses are not required to accept an ImageLayout parameter, but most will at least need to synthesize one to be passed up the constructor chain.

Methods that modify the state of an ImageLayout return a reference to 'this' following the change. This allows multiple modifications to be made in a single expression. This provides a way of modifying an ImageLayout within a superclass constructor call.

See Also:
Serialized Form

Field Summary
static int COLOR_MODEL_MASK
          A bitmask to specify the validity of colorModel.
static int HEIGHT_MASK
          A bitmask to specify the validity of height.
static int MIN_X_MASK
          A bitmask to specify the validity of minX.
static int MIN_Y_MASK
          A bitmask to specify the validity of minY.
static int SAMPLE_MODEL_MASK
          A bitmask to specify the validity of sampleModel.
static int TILE_GRID_X_OFFSET_MASK
          A bitmask to specify the validity of tileGridXOffset.
static int TILE_GRID_Y_OFFSET_MASK
          A bitmask to specify the validity of tileGridYOffset.
static int TILE_HEIGHT_MASK
          A bitmask to specify the validity of tileHeight.
static int TILE_WIDTH_MASK
          A bitmask to specify the validity of tileWidth.
protected  int validMask
          The 'or'-ed together valid bitmasks.
static int WIDTH_MASK
          A bitmask to specify the validity of width.
 
Constructor Summary
ImageLayout()
          Constructs an ImageLayout with no parameters set.
ImageLayout(int minX, int minY, int width, int height)
          Constructs an ImageLayout with only the image dimension parameters set.
ImageLayout(int minX, int minY, int width, int height, int tileGridXOffset, int tileGridYOffset, int tileWidth, int tileHeight, SampleModel sampleModel, ColorModel colorModel)
          Constructs an ImageLayout with all its parameters set.
ImageLayout(int tileGridXOffset, int tileGridYOffset, int tileWidth, int tileHeight, SampleModel sampleModel, ColorModel colorModel)
          Constructs an ImageLayout with its tile grid layout, SampleModel, and ColorModel parameters set.
ImageLayout(RenderedImage im)
          Constructs an ImageLayout with all its parameters set to equal those of a given RenderedImage.
 
Method Summary
 Object clone()
          Returns a clone of the ImageLayout as an Object.
 boolean equals(Object obj)
          Tests if the specified Object equals this ImageLayout.
 ColorModel getColorModel(RenderedImage fallback)
          Returns the value of colorModel if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getHeight(RenderedImage fallback)
          Returns the value of height if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getMinX(RenderedImage fallback)
          Returns the value of minX if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getMinY(RenderedImage fallback)
          Returns the value of minY if it is valid, and otherwise returns the value from the supplied RenderedImage.
 SampleModel getSampleModel(RenderedImage fallback)
          Returns the value of sampleModel if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getTileGridXOffset(RenderedImage fallback)
          Returns the value of tileGridXOffset if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getTileGridYOffset(RenderedImage fallback)
          Returns the value of tileGridYOffset if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getTileHeight(RenderedImage fallback)
          Returns the value of tileHeight if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getTileWidth(RenderedImage fallback)
          Returns the value of tileWidth if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int getValidMask()
          Returns the 'or'-ed together bitmask indicating parameter validity.
 int getWidth(RenderedImage fallback)
          Returns the value of width if it is valid, and otherwise returns the value from the supplied RenderedImage.
 int hashCode()
          Returns the hash code for this ImageLayout.
 boolean isValid(int mask)
          Returns true if all the parameters specified by the argument are set.
 ImageLayout setColorModel(ColorModel colorModel)
          Sets colorModel to the supplied value and marks it as valid.
 ImageLayout setHeight(int height)
          Sets height to the supplied value and marks it as valid.
 ImageLayout setMinX(int minX)
          Sets minX to the supplied value and marks it as valid.
 ImageLayout setMinY(int minY)
          Sets minY to the supplied value and marks it as valid.
 ImageLayout setSampleModel(SampleModel sampleModel)
          Sets sampleModel to the supplied value and marks it as valid.
 ImageLayout setTileGridXOffset(int tileGridXOffset)
          Sets tileGridXOffset to the supplied value and marks it as valid.
 ImageLayout setTileGridYOffset(int tileGridYOffset)
          Sets tileGridYOffset to the supplied value and marks it as valid.
 ImageLayout setTileHeight(int tileHeight)
          Sets tileHeight to the supplied value and marks it as valid.
 ImageLayout setTileWidth(int tileWidth)
          Sets tileWidth to the supplied value and marks it as valid.
 ImageLayout setValid(int mask)
          Sets selected bits of the valid bitmask.
 ImageLayout setWidth(int width)
          Sets width to the supplied value and marks it as valid.
 String toString()
          Returns a String containing the values of all valid fields.
 ImageLayout unsetImageBounds()
          Marks the parameters dealing with the image bounds (minX, minY, width, and height) as being invalid.
 ImageLayout unsetTileLayout()
          Marks the parameters dealing with the tile layout (tileGridXOffset, tileGridYOffset, tileWidth, and tileHeight) as being invalid.
 ImageLayout unsetValid(int mask)
          Clears selected bits of the valid bitmask.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_X_MASK

public static final int MIN_X_MASK
A bitmask to specify the validity of minX.

See Also:
Constant Field Values

MIN_Y_MASK

public static final int MIN_Y_MASK
A bitmask to specify the validity of minY.

See Also:
Constant Field Values

WIDTH_MASK

public static final int WIDTH_MASK
A bitmask to specify the validity of width.

See Also:
Constant Field Values

HEIGHT_MASK

public static final int HEIGHT_MASK
A bitmask to specify the validity of height.

See Also:
Constant Field Values

TILE_GRID_X_OFFSET_MASK

public static final int TILE_GRID_X_OFFSET_MASK
A bitmask to specify the validity of tileGridXOffset.

See Also:
Constant Field Values

TILE_GRID_Y_OFFSET_MASK

public static final int TILE_GRID_Y_OFFSET_MASK
A bitmask to specify the validity of tileGridYOffset.

See Also:
Constant Field Values

TILE_WIDTH_MASK

public static final int TILE_WIDTH_MASK
A bitmask to specify the validity of tileWidth.

See Also:
Constant Field Values

TILE_HEIGHT_MASK

public static final int TILE_HEIGHT_MASK
A bitmask to specify the validity of tileHeight.

See Also:
Constant Field Values

SAMPLE_MODEL_MASK

public static final int SAMPLE_MODEL_MASK
A bitmask to specify the validity of sampleModel.

See Also:
Constant Field Values

COLOR_MODEL_MASK

public static final int COLOR_MODEL_MASK
A bitmask to specify the validity of colorModel.

See Also:
Constant Field Values

validMask

protected int validMask
The 'or'-ed together valid bitmasks.

Constructor Detail

ImageLayout

public ImageLayout()
Constructs an ImageLayout with no parameters set.


ImageLayout

public ImageLayout(int minX,
                   int minY,
                   int width,
                   int height,
                   int tileGridXOffset,
                   int tileGridYOffset,
                   int tileWidth,
                   int tileHeight,
                   SampleModel sampleModel,
                   ColorModel colorModel)
Constructs an ImageLayout with all its parameters set. The sampleModel and colorModel parameters are ignored if null.

Parameters:
minX Method Summary  Object clone()
          Returns a clone of the ImageLayout as an Object.  boolean equals(Object obj)
          Tests if the specified Object equals this ImageLayout.  ColorModel getColorModel(RenderedImage fallback)
          Returns the value of colorModel if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getHeight(RenderedImage fallback)
          Returns the value of height if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getMinX(RenderedImage fallback)
          Returns the value of minX if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getMinY(RenderedImage fallback)
          Returns the value of minY if it is valid, and otherwise returns the value from the supplied RenderedImage.  SampleModel getSampleModel(RenderedImage fallback)
          Returns the value of sampleModel if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getTileGridXOffset(RenderedImage fallback)
          Returns the value of tileGridXOffset if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getTileGridYOffset(RenderedImage fallback)
          Returns the value of tileGridYOffset if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getTileHeight(RenderedImage fallback)
          Returns the value of tileHeight if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getTileWidth(RenderedImage fallback)
          Returns the value of tileWidth if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getValidMask()
          Returns the 'or'-ed together bitmask indicating parameter validity.  int getWidth(RenderedImage fallback)
          Returns the value of width if it is valid, and otherwise returns the value from the supplied RenderedImage.  int hashCode()
          Returns the hash code for this ImageLayout.  boolean isValid(int mask)
          Returns true if all the parameters specified by the argument are set.  ImageLayout setColorModel(ColorModel colorModel)
          Sets colorModel to the supplied value and marks it as valid.  ImageLayout setHeight(int height)
          Sets height to the supplied value and marks it as valid.  ImageLayout setMinX(int minX)
          Sets minX to the supplied value and marks it as valid.  ImageLayout setMinY(int minY)
          Sets minY to the supplied value and marks it as valid.  ImageLayout setSampleModel(SampleModel sampleModel)
          Sets sampleModel to the supplied value and marks it as valid.  ImageLayout setTileGridXOffset(int tileGridXOffset)
          Sets tileGridXOffset to the supplied value and marks it as valid.  ImageLayout setTileGridYOffset(int tileGridYOffset)
          Sets tileGridYOffset to the supplied value and marks it as valid.  ImageLayout setTileHeight(int tileHeight)
          Sets tileHeight to the supplied value and marks it as valid.  ImageLayout setTileWidth(int tileWidth)
          Sets tileWidth to the supplied value and marks it as valid.  ImageLayout setValid(int mask)
          Sets selected bits of the valid bitmask.  ImageLayout setWidth(int width)
          Sets width to the supplied value and marks it as valid.  String toString()
          Returns a String containing the values of all valid fields.  ImageLayout unsetImageBounds()
          Marks the parameters dealing with the image bounds (minX, minY, width, and height) as being invalid.  ImageLayout unsetTileLayout()
          Marks the parameters dealing with the tile layout (tileGridXOffset, tileGridYOffset, tileWidth, and tileHeight) as being invalid.  ImageLayout unsetValid(int mask)
          Clears selected bits of the valid bitmask.  
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_X_MASK

public static final int MIN_X_MASK
A bitmask to specify the validity of minX.

See Also:
Constant Field Values

MIN_Y_MASK

public static final int MIN_Y_MASK
A bitmask to specify the validity of minY.

See Also:
Constant Field Values

WIDTH_MASK

public static final int WIDTH_MASK
A bitmask to specify the validity of width.

See Also:
Constant Field Values

HEIGHT_MASK

public static final int HEIGHT_MASK
A bitmask to specify the validity of height.

See Also:
Constant Field Values

TILE_GRID_X_OFFSET_MASK

public static final int TILE_GRID_X_OFFSET_MASK
A bitmask to specify the validity of tileGridXOffset.

See Also:
Constant Field Values

TILE_GRID_Y_OFFSET_MASK

public static final int TILE_GRID_Y_OFFSET_MASK
A bitmask to specify the validity of tileGridYOffset.

See Also:
Constant Field Values

TILE_WIDTH_MASK

public static final int TILE_WIDTH_MASK
A bitmask to specify the validity of tileWidth.

See Also:
Constant Field Values

TILE_HEIGHT_MASK

public static final int TILE_HEIGHT_MASK
A bitmask to specify the validity of tileHeight.

See Also:
Constant Field Values

SAMPLE_MODEL_MASK

public static final int SAMPLE_MODEL_MASK
A bitmask to specify the validity of sampleModel.

See Also:
Constant Field Values

COLOR_MODEL_MASK

public static final int COLOR_MODEL_MASK
A bitmask to specify the validity of colorModel.

See Also:
Constant Field Values

validMask

protected int validMask
The 'or'-ed together valid bitmasks.

Constructor Detail

ImageLayout

public ImageLayout()
Constructs an ImageLayout with no parameters set.


ImageLayout

public ImageLayout(int minX,
                   int minY,
                   int width,
                   int height,
                   int tileGridXOffset,
                   int tileGridYOffset,
                   int tileWidth,
                   int tileHeight,
                   SampleModel sampleModel,
                   ColorModel colorModel)
Constructs an ImageLayout with all its parameters set. The sampleModel and colorModel parameters are ignored if null.

Parameters:
minX Method Summary  Object clone()
          Returns a clone of the ImageLayout as an Object.  boolean equals(Object obj)
          Tests if the specified Object equals this ImageLayout.  ColorModel getColorModel(RenderedImage fallback)
          Returns the value of colorModel if it is valid, and otherwise returns the value from the supplied RenderedImage.  int getHeight(RenderedImage fallback)
          Returns the value of height if it is valid, and otherwise returns the value from the supplied RenderedImage.