| java.lang.Object javax.media.jai.RasterFormatTag
RasterFormatTag | final public class RasterFormatTag (Code) | | This class encapsulates the information needed for
RasterAccessor to understand how a Raster is laid out. It's
designed so that one RasterFormatTag can be constructed per
source and that RasterFormatTag can cache information that
the RasterAccessor would otherwise have to extract from the
Raster each time it's constructed (generally each time
OpImage.computeRect() is called.) Additionally, it can
cache various arrays (i.e. bankIndices[] and bandOffsets[])
that would otherwise be cloned everytime they were requested.
Because of the way SampleModel.createCompatibleSampleModel()
is designed not all fields of a particular SampleModel will
match those of the SampleModel returned by
SampleModel.createCompatibleSampleModel(). Values like
pixelStride and numBands won't change, but values like
bankIndicies[] and bandOffsets[] might if the underlying
Raster is not pixelSequential. Rasters which are pixelSequential
meet the following conditions 1) The SampleModel is a
ComponentSampleModel. 2) The pixelStride is equal to the number
of bands. 3) All the bankIndices[] are equal. 4) All the
bandOffsets[] values are less than pixelStride 5) No two
bandOffsets[] values are equal. For that reason,
RasterFormatTags representing non pixelSequential rasters don't
attempt to cache the bandOffsets[] or bankIndices[]. For such
rasters, this information should be taken directly from the
raster itself. Note that any RasterFormatTag that will cause
data to be copied from the Raster will be pixelSequential as that
is the format in which data is returned from Raster.getPixels()
returns.
|
Constructor Summary | |
public | RasterFormatTag(SampleModel sampleModel, int formatTagID) Constructs a RasterFormatTag given a sampleModel and a
formatTagID. |
Method Summary | |
final public int[] | getBandOffsets() Returns the bandOffsets for the Raster if isPixelSequential() is
true. | final public int[] | getBankIndices() Returns the bankIndices for the Raster if isPixelSequential()
is true. | final public int | getFormatTagID() Returns the FormatTagID used to construct this RasterFormatTag. | final public int | getNumBands() | final public int | getPixelStride() | final public boolean | isPixelSequential() Returns whether or not the SampleModel represented by the
RasterFormatTag is PixelSequential. |
RasterFormatTag | public RasterFormatTag(SampleModel sampleModel, int formatTagID)(Code) | | Constructs a RasterFormatTag given a sampleModel and a
formatTagID. Generally, this constructor is called by
RasterAccessor.findCompatibleTags(RenderedImage[] srcs,
RenderedImage dst) and it takes care of setting the values
correctly. In special cases, OpImages need to construct
a RasterFormatTag without creating a RenderedImage. In this
case a RasterFormatTag can be created using a formatTagID
returned from
RasterAccessor.findCompatibleTag(SampleModel[] srcs, SampleModel dst)
and a sampleModel that was either passed in to the
findCompatibleTag() call or one that was created using
createCompatibleSampleModel() on one of the passed in
SampleModels. Attempting to use arbitrary SampleModels
with arbitrary formatTagIDs has undefined results.
param sampleModel A SampleModel for the RasterFormagTag
param formatTagID An int to indicate format tag id
|
getBandOffsets | final public int[] getBandOffsets()(Code) | | Returns the bandOffsets for the Raster if isPixelSequential() is
true. Returns null otherwise. In the COPIED case, bankIndices
will be numBands sequential integers starting with 0.
|
getBankIndices | final public int[] getBankIndices()(Code) | | Returns the bankIndices for the Raster if isPixelSequential()
is true. Returns null otherwise. In the COPIED case, the
bankIndices will all be 0.
|
getFormatTagID | final public int getFormatTagID()(Code) | | Returns the FormatTagID used to construct this RasterFormatTag.
Valid values are defined in javax.media.jai.RasterAccessor.
|
getNumBands | final public int getNumBands()(Code) | | Returns the number of bands in the underlying Raster
|
getPixelStride | final public int getPixelStride()(Code) | | Returns the pixelStride of the underlying Raster
|
isPixelSequential | final public boolean isPixelSequential()(Code) | | Returns whether or not the SampleModel represented by the
RasterFormatTag is PixelSequential.
Note that RasterFormatTag's that indicate
data should be copied out of the Raster by the RasterAccessor
will always return true for isPixelSequential().
RasterFormatTags that indicate no copying is needed will only
return true, if 1) The SampleModel is a ComponentSampleModel.
2) The pixelStride is equal to the number of bands.
3) All the bankIndices[] are equal. 4) All the bandOffsets[]
values are less than pixelStride 5) No two bandOffset values
are equal.
|
|
|