| java.lang.Object javax.media.jai.ImageLayout
ImageLayout | public class ImageLayout extends Object implements Cloneable,Serializable(Code) | | A class describing the desired layout of an OpImage .
The ImageLayout class encapsulates three types of information about
an image:
- The image bounds, comprising the min X and Y coordinates,
image width, and image height;
- The tile grid layout, comprising the tile grid X and Y offsets,
the tile width, and the tile height; and
- The
SampleModel and ColorModel of the 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.
|
Field Summary | |
final public static int | COLOR_MODEL_MASK A bitmask to specify the validity of colorModel . | final public static int | HEIGHT_MASK A bitmask to specify the validity of height . | final public static int | MIN_X_MASK A bitmask to specify the validity of minX . | final public static int | MIN_Y_MASK A bitmask to specify the validity of minY . | final public static int | SAMPLE_MODEL_MASK A bitmask to specify the validity of sampleModel . | final public static int | TILE_GRID_X_OFFSET_MASK A bitmask to specify the validity of tileGridXOffset . | final public static int | TILE_GRID_Y_OFFSET_MASK A bitmask to specify the validity of tileGridYOffset . | final public static int | TILE_HEIGHT_MASK A bitmask to specify the validity of tileHeight . | final public static int | TILE_WIDTH_MASK A bitmask to specify the validity of tileWidth . | final public static int | WIDTH_MASK A bitmask to specify the validity of width . | transient ColorModel | colorModel The image's ColorModel . | int | height The image's height. | int | minX The image's minimum X coordinate. | int | minY The image's minimum Y coordinate. | transient SampleModel | sampleModel The image's SampleModel . | int | tileGridXOffset The X coordinate of tile (0, 0). | int | tileGridYOffset The Y coordinate of tile (0, 0). | int | tileHeight The height of a tile. | int | tileWidth The width of a tile. | protected int | validMask The 'or'-ed together valid bitmasks. | int | width The image's width . |
Constructor Summary | |
public | ImageLayout() Constructs an ImageLayout with no parameters set. | 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. | public | ImageLayout(int minX, int minY, int width, int height) Constructs an ImageLayout with only the image dimension
parameters set. | public | 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. | public | ImageLayout(RenderedImage im) Constructs an ImageLayout with all its parameters set
to equal those of a given RenderedImage . |
Method Summary | |
public Object | clone() Returns a clone of the ImageLayout as an Object. | public boolean | equals(Object obj) Tests if the specified Object equals this
ImageLayout . | public ColorModel | getColorModel(RenderedImage fallback) Returns the value of colorModel if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If colorModel is not valid and fallback is null, null is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getHeight(RenderedImage fallback) Returns the value of height if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If height is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getMinX(RenderedImage fallback) Returns the value of minX if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If minX is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getMinY(RenderedImage fallback) Returns the value of minY if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If minY is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public SampleModel | getSampleModel(RenderedImage fallback) Returns the value of sampleModel if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If sampleModel is not valid and fallback is null, null is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getTileGridXOffset(RenderedImage fallback) Returns the value of tileGridXOffset if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileGridXOffset is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getTileGridYOffset(RenderedImage fallback) Returns the value of tileGridYOffset if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileGridYOffset is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getTileHeight(RenderedImage fallback) Returns the value of tileHeight if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileHeight is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getTileWidth(RenderedImage fallback) Returns the value of tileWidth if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileWidth is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public int | getValidMask() Returns the 'or'-ed together bitmask indicating parameter validity. | public int | getWidth(RenderedImage fallback) Returns the value of width if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If width is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. | public int | hashCode() Returns the hash code for this ImageLayout . | final public boolean | isValid(int mask) Returns true if all the parameters specified by the argument are set.
Parameters: mask - a bitmask. | public ImageLayout | setColorModel(ColorModel colorModel) Sets colorModel to the supplied value and marks it as valid.
Parameters: colorModel - the new ColorModel . | public ImageLayout | setHeight(int height) Sets height to the supplied value and marks it as valid.
Parameters: height - the height of the image, as an int. | public ImageLayout | setMinX(int minX) Sets minX to the supplied value and marks it as valid.
Parameters: minX - the minimum X coordinate of the image, as an int. | public ImageLayout | setMinY(int minY) Sets minY to the supplied value and marks it as valid.
Parameters: minY - the minimum Y coordinate of the image, as an int. | public ImageLayout | setSampleModel(SampleModel sampleModel) Sets sampleModel to the supplied value and marks it as valid.
Parameters: sampleModel - the new SampleModel . | public ImageLayout | setTileGridXOffset(int tileGridXOffset) Sets tileGridXOffset to the supplied value and marks it as valid.
Parameters: tileGridXOffset - the X coordinate of tile (0, 0), as an int. | public ImageLayout | setTileGridYOffset(int tileGridYOffset) Sets tileGridYOffset to the supplied value and marks it as valid.
Parameters: tileGridYOffset - the Y coordinate of tile (0, 0), as an int. | public ImageLayout | setTileHeight(int tileHeight) Sets tileHeight to the supplied value and marks it as valid.
Parameters: tileHeight - the height of a tile, as an int. | public ImageLayout | setTileWidth(int tileWidth) Sets tileWidth to the supplied value and marks it as valid.
Parameters: tileWidth - the width of a tile, as an int. | public ImageLayout | setValid(int mask) Sets selected bits of the valid bitmask. | public ImageLayout | setWidth(int width) Sets width to the supplied value and marks it as valid.
Parameters: width - the width of the image, as an int. | public String | toString() Returns a String containing the values of all valid fields. | public ImageLayout | unsetImageBounds() Marks the parameters dealing with the image bounds
(minX, minY, width, and height) as being invalid. | public ImageLayout | unsetTileLayout() Marks the parameters dealing with the tile layout (tileGridXOffset,
tileGridYOffset, tileWidth, and tileHeight) as being invalid. | public ImageLayout | unsetValid(int mask) Clears selected bits of the valid bitmask. |
COLOR_MODEL_MASK | final public static int COLOR_MODEL_MASK(Code) | | A bitmask to specify the validity of colorModel .
|
HEIGHT_MASK | final public static int HEIGHT_MASK(Code) | | A bitmask to specify the validity of height .
|
MIN_X_MASK | final public static int MIN_X_MASK(Code) | | A bitmask to specify the validity of minX .
|
MIN_Y_MASK | final public static int MIN_Y_MASK(Code) | | A bitmask to specify the validity of minY .
|
SAMPLE_MODEL_MASK | final public static int SAMPLE_MODEL_MASK(Code) | | A bitmask to specify the validity of sampleModel .
|
TILE_GRID_X_OFFSET_MASK | final public static int TILE_GRID_X_OFFSET_MASK(Code) | | A bitmask to specify the validity of tileGridXOffset .
|
TILE_GRID_Y_OFFSET_MASK | final public static int TILE_GRID_Y_OFFSET_MASK(Code) | | A bitmask to specify the validity of tileGridYOffset .
|
TILE_HEIGHT_MASK | final public static int TILE_HEIGHT_MASK(Code) | | A bitmask to specify the validity of tileHeight .
|
TILE_WIDTH_MASK | final public static int TILE_WIDTH_MASK(Code) | | A bitmask to specify the validity of tileWidth .
|
WIDTH_MASK | final public static int WIDTH_MASK(Code) | | A bitmask to specify the validity of width .
|
height | int height(Code) | | The image's height.
|
minX | int minX(Code) | | The image's minimum X coordinate.
|
minY | int minY(Code) | | The image's minimum Y coordinate.
|
sampleModel | transient SampleModel sampleModel(Code) | | The image's SampleModel .
|
tileGridXOffset | int tileGridXOffset(Code) | | The X coordinate of tile (0, 0).
|
tileGridYOffset | int tileGridYOffset(Code) | | The Y coordinate of tile (0, 0).
|
tileHeight | int tileHeight(Code) | | The height of a tile.
|
tileWidth | int tileWidth(Code) | | The width of a tile.
|
validMask | protected int validMask(Code) | | The 'or'-ed together valid bitmasks.
|
width | int width(Code) | | The image's width .
|
ImageLayout | public ImageLayout()(Code) | | 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)(Code) | | Constructs an ImageLayout with all its parameters set.
The sampleModel and colorModel parameters are ignored if null.
Parameters: minX - the image's minimum X coordinate. Parameters: minY - the image's minimum Y coordinate. Parameters: width - the image's width. Parameters: height - the image's height. Parameters: tileGridXOffset - the X coordinate of tile (0, 0). Parameters: tileGridYOffset - the Y coordinate of tile (0, 0). Parameters: tileWidth - the width of a tile. Parameters: tileHeight - the height of a tile. Parameters: sampleModel - the image's SampleModel . Parameters: colorModel - the image's ColorModel . |
ImageLayout | public ImageLayout(int minX, int minY, int width, int height)(Code) | | Constructs an ImageLayout with only the image dimension
parameters set.
Parameters: minX - the image's minimum X coordinate. Parameters: minY - the image's minimum Y coordinate. Parameters: width - the image's width. Parameters: height - the image's height. |
ImageLayout | public ImageLayout(int tileGridXOffset, int tileGridYOffset, int tileWidth, int tileHeight, SampleModel sampleModel, ColorModel colorModel)(Code) | | Constructs an ImageLayout with its tile grid layout,
SampleModel , and ColorModel parameters set.
The sampleModel and colorModel parameters are ignored if null.
Parameters: tileGridXOffset - the X coordinate of tile (0, 0). Parameters: tileGridYOffset - the Y coordinate of tile (0, 0). Parameters: tileWidth - the width of a tile. Parameters: tileHeight - the height of a tile. Parameters: sampleModel - the image's SampleModel . Parameters: colorModel - the image's ColorModel . |
ImageLayout | public ImageLayout(RenderedImage im)(Code) | | Constructs an ImageLayout with all its parameters set
to equal those of a given RenderedImage .
Parameters: im - a RenderedImage whose layout will be copied. |
clone | public Object clone()(Code) | | Returns a clone of the ImageLayout as an Object.
|
equals | public boolean equals(Object obj)(Code) | | Tests if the specified Object equals this
ImageLayout .
Parameters: obj - the Object to test for equality true if the specified Object is an instance of ImageLayout and equals thisImageLayout ; false otherwise. since: JAI 1.1 |
getColorModel | public ColorModel getColorModel(RenderedImage fallback)(Code) | | Returns the value of colorModel if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If colorModel is not valid and fallback is null, null is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of colorModel . |
getHeight | public int getHeight(RenderedImage fallback)(Code) | | Returns the value of height if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If height is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of height. |
getMinX | public int getMinX(RenderedImage fallback)(Code) | | Returns the value of minX if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If minX is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of minX. |
getMinY | public int getMinY(RenderedImage fallback)(Code) | | Returns the value of minY if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If minY is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of minY. |
getSampleModel | public SampleModel getSampleModel(RenderedImage fallback)(Code) | | Returns the value of sampleModel if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If sampleModel is not valid and fallback is null, null is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of sampleModel . |
getTileGridXOffset | public int getTileGridXOffset(RenderedImage fallback)(Code) | | Returns the value of tileGridXOffset if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileGridXOffset is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of tileGridXOffset. |
getTileGridYOffset | public int getTileGridYOffset(RenderedImage fallback)(Code) | | Returns the value of tileGridYOffset if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileGridYOffset is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of tileGridYOffset. |
getTileHeight | public int getTileHeight(RenderedImage fallback)(Code) | | Returns the value of tileHeight if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileHeight is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of tileHeight. |
getTileWidth | public int getTileWidth(RenderedImage fallback)(Code) | | Returns the value of tileWidth if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If tileWidth is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of tileWidth. |
getValidMask | public int getValidMask()(Code) | | Returns the 'or'-ed together bitmask indicating parameter validity.
To determine the validity of a particular parameter, say tile width,
test getValidMask() & ImageLayout.TILE_WIDTH_MASK
against 0 .
To test a single mask value or set of mask values, the
convenience method isValid() may be used.
an int that is the logical 'or' of the valid mask values,with a '1' bit representing the setting of a value. |
getWidth | public int getWidth(RenderedImage fallback)(Code) | | Returns the value of width if it is valid, and
otherwise returns the value from the supplied RenderedImage .
If width is not valid and fallback is null, 0 is returned.
Parameters: fallback - the RenderedImage fallback. the appropriate value of width. |
hashCode | public int hashCode()(Code) | | Returns the hash code for this ImageLayout .
a hash code for this ImageLayout . since: JAI 1.1 |
isValid | final public boolean isValid(int mask)(Code) | | Returns true if all the parameters specified by the argument are set.
Parameters: mask - a bitmask. a boolean truth value. |
setColorModel | public ImageLayout setColorModel(ColorModel colorModel)(Code) | | Sets colorModel to the supplied value and marks it as valid.
Parameters: colorModel - the new ColorModel . a reference to this ImageLayout following the change. |
setHeight | public ImageLayout setHeight(int height)(Code) | | Sets height to the supplied value and marks it as valid.
Parameters: height - the height of the image, as an int. a reference to this ImageLayout following the change. throws: IllegalArgumentException - if height is non-positive. |
setMinX | public ImageLayout setMinX(int minX)(Code) | | Sets minX to the supplied value and marks it as valid.
Parameters: minX - the minimum X coordinate of the image, as an int. a reference to this ImageLayout following the change. |
setMinY | public ImageLayout setMinY(int minY)(Code) | | Sets minY to the supplied value and marks it as valid.
Parameters: minY - the minimum Y coordinate of the image, as an int. a reference to this ImageLayout following the change. |
setSampleModel | public ImageLayout setSampleModel(SampleModel sampleModel)(Code) | | Sets sampleModel to the supplied value and marks it as valid.
Parameters: sampleModel - the new SampleModel . a reference to this ImageLayout following the change. |
setTileGridXOffset | public ImageLayout setTileGridXOffset(int tileGridXOffset)(Code) | | Sets tileGridXOffset to the supplied value and marks it as valid.
Parameters: tileGridXOffset - the X coordinate of tile (0, 0), as an int. a reference to this ImageLayout following the change. |
setTileGridYOffset | public ImageLayout setTileGridYOffset(int tileGridYOffset)(Code) | | Sets tileGridYOffset to the supplied value and marks it as valid.
Parameters: tileGridYOffset - the Y coordinate of tile (0, 0), as an int. a reference to this ImageLayout following the change. |
setTileHeight | public ImageLayout setTileHeight(int tileHeight)(Code) | | Sets tileHeight to the supplied value and marks it as valid.
Parameters: tileHeight - the height of a tile, as an int. a reference to this ImageLayout following the change. throws: IllegalArgumentException - if tileHeight isnon-positive. |
setTileWidth | public ImageLayout setTileWidth(int tileWidth)(Code) | | Sets tileWidth to the supplied value and marks it as valid.
Parameters: tileWidth - the width of a tile, as an int. a reference to this ImageLayout following the change. throws: IllegalArgumentException - if tileWidth isnon-positive. |
setValid | public ImageLayout setValid(int mask)(Code) | | Sets selected bits of the valid bitmask. The valid bitmask is
set to the logical 'or' of its prior value and a new value.
Parameters: mask - the new mask value to be 'or'-ed with the prior value. a reference to this ImageLayout following the change. |
setWidth | public ImageLayout setWidth(int width)(Code) | | Sets width to the supplied value and marks it as valid.
Parameters: width - the width of the image, as an int. a reference to this ImageLayout following the change. throws: IllegalArgumentException - if width is non-positive. |
toString | public String toString()(Code) | | Returns a String containing the values of all valid fields.
|
unsetImageBounds | public ImageLayout unsetImageBounds()(Code) | | Marks the parameters dealing with the image bounds
(minX, minY, width, and height) as being invalid.
a reference to this ImageLayout following the change. |
unsetTileLayout | public ImageLayout unsetTileLayout()(Code) | | Marks the parameters dealing with the tile layout (tileGridXOffset,
tileGridYOffset, tileWidth, and tileHeight) as being invalid.
a reference to this ImageLayout following the change. |
unsetValid | public ImageLayout unsetValid(int mask)(Code) | | Clears selected bits of the valid bitmask. The valid bitmask
is set to the logical 'and' of its prior value and the negation
of the new mask value. This effectively subtracts from the set of
valid parameters.
Parameters: mask - the new mask value to be negated and 'and'-ed withthe prior value. a reference to this ImageLayout following the change. |
|
|