|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--javax.media.jai.ImageLayout
A class describing the desired layout of an OpImage.
The ImageLayout class encapsulates three types of information about
an image:
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 | |
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 |
public static final int MIN_X_MASK
minX.public static final int MIN_Y_MASK
minY.public static final int WIDTH_MASK
width.public static final int HEIGHT_MASK
height.public static final int TILE_GRID_X_OFFSET_MASK
tileGridXOffset.public static final int TILE_GRID_Y_OFFSET_MASK
tileGridYOffset.public static final int TILE_WIDTH_MASK
tileWidth.public static final int TILE_HEIGHT_MASK
tileHeight.public static final int SAMPLE_MODEL_MASK
sampleModel.public static final int COLOR_MODEL_MASK
colorModel.protected int validMask
| Constructor Detail |
public ImageLayout()
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)
ImageLayout with all its parameters set.
The sampleModel and colorModel parameters are ignored if null.minX - the image's minimum X coordinate.minY - the image's minimum Y coordinate.width - the image's width.height - the image's height.tileGridXOffset - the X coordinate of tile (0, 0).tileGridYOffset - the Y coordinate of tile (0, 0).tileWidth - the width of a tile.tileHeight - the height of a tile.sampleModel - the image's SampleModel.colorModel - the image's ColorModel.
public ImageLayout(int minX,
int minY,
int width,
int height)
ImageLayout with only the image dimension
parameters set.minX - the image's minimum X coordinate.minY - the image's minimum Y coordinate.width - the image's width.height - the image's height.
public ImageLayout(int tileGridXOffset,
int tileGridYOffset,
int tileWidth,
int tileHeight,
SampleModel sampleModel,
ColorModel colorModel)
ImageLayout with its tile grid layout,
SampleModel, and ColorModel parameters set.
The sampleModel and colorModel parameters are ignored if null.tileGridXOffset - the X coordinate of tile (0, 0).tileGridYOffset - the Y coordinate of tile (0, 0).tileWidth - the width of a tile.tileHeight - the height of a tile.sampleModel - the image's SampleModel.colorModel - the image's ColorModel.public ImageLayout(RenderedImage im)
ImageLayout with all its parameters set
to equal those of a given RenderedImage.im - a RenderedImage whose layout will be copied.| Method Detail |
public int getValidMask()
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.
public final boolean isValid(int mask)
true if all the parameters specified by the argument are set.mask - a bitmask.public ImageLayout setValid(int mask)
mask - the new mask value to be 'or'-ed with the prior value.ImageLayout following the change.public ImageLayout unsetValid(int mask)
mask - the new mask value to be negated and 'and'-ed with
the prior value.ImageLayout following the change.public ImageLayout unsetImageBounds()
ImageLayout following the change.public ImageLayout unsetTileLayout()
ImageLayout following the change.public int getMinX(RenderedImage fallback)
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.fallback - the RenderedImage fallback.public ImageLayout setMinX(int minX)
minX to the supplied value and marks it as valid.minX - the minimum X coordinate of the image, as an int.ImageLayout following the change.public int getMinY(RenderedImage fallback)
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.fallback - the RenderedImage fallback.public ImageLayout setMinY(int minY)
minY to the supplied value and marks it as valid.minY - the minimum Y coordinate of the image, as an int.ImageLayout following the change.public int getWidth(RenderedImage fallback)
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.fallback - the RenderedImage fallback.public ImageLayout setWidth(int width)
width to the supplied value and marks it as valid.width - the width of the image, as an int.ImageLayout following the change.width is non-positive.public int getHeight(RenderedImage fallback)
RenderedImage.
If height is not valid and fallback is null, 0 is returned.fallback - the RenderedImage fallback.public ImageLayout setHeight(int height)
height - the height of the image, as an int.ImageLayout following the change.height is non-positive.public int getTileGridXOffset(RenderedImage fallback)
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.fallback - the RenderedImage fallback.public ImageLayout setTileGridXOffset(int tileGridXOffset)
tileGridXOffset to the supplied value and marks it as valid.tileGridXOffset - the X coordinate of tile (0, 0), as an int.ImageLayout following the change.public int getTileGridYOffset(RenderedImage fallback)
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.fallback - the RenderedImage fallback.public ImageLayout setTileGridYOffset(int tileGridYOffset)
tileGridYOffset to the supplied value and marks it as valid.tileGridYOffset - the Y coordinate of tile (0, 0), as an int.ImageLayout following the change.public int getTileWidth(RenderedImage fallback)
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.fallback - the RenderedImage fallback.public ImageLayout setTileWidth(int tileWidth)
tileWidth to the supplied value and marks it as valid.tileWidth - the width of a tile, as an int.ImageLayout following the change.tileWidth is
non-positive.public int getTileHeight(RenderedImage fallback)
RenderedImage.
If tileHeight is not valid and fallback is null, 0 is returned.fallback - the RenderedImage fallback.public ImageLayout setTileHeight(int tileHeight)
tileHeight - the height of a tile, as an int.ImageLayout following the change.tileHeight is
non-positive.public SampleModel getSampleModel(RenderedImage fallback)
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.fallback - the RenderedImage fallback.sampleModel.public ImageLayout setSampleModel(SampleModel sampleModel)
sampleModel to the supplied value and marks it as valid.sampleModel - the new SampleModel.ImageLayout following the change.public ColorModel getColorModel(RenderedImage fallback)
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.fallback - the RenderedImage fallback.colorModel.public ImageLayout setColorModel(ColorModel colorModel)
colorModel to the supplied value and marks it as valid.colorModel - the new ColorModel.ImageLayout following the change.public String toString()
public Object clone()
ImageLayout as an Object.public boolean equals(Object obj)
Object equals this
ImageLayout.obj - the Object to test for equalitytrue if the specified Object
is an instance of ImageLayout and equals this
ImageLayout; false otherwise.public int hashCode()
ImageLayout.ImageLayout.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||