| java.lang.Object com.sun.media.jai.mlib.MediaLibAccessor
MediaLibAccessor | public class MediaLibAccessor (Code) | | An adapter class for presenting image data in a mediaLibImage
format, even if the data isn't stored that way. MediaLibAccessor
is meant to make the common case (ComponentRasters) and allow
them to be accelerated via medialib. Note that unlike RasterAccessor,
MediaLibAccessor does not work with all cases. In the event that
MediaLibAccessor can not deal with a give collection of Rasters,
findCompatibleTag will return the value MediaLibAccessor.TAG_INCOMPATIBLE.
OpImages that use MediaLibAccessor should be paired with RIF's
which check that findCompatibleTag returns a valid tag before
actually constructing the Mlib OpImage.
|
Field Summary | |
final public static int | BINARY Flag indicating data are binary. | final public static int | BINARY_MASK The bits of a FormatTag associated with binary data. | final public static int | COPIED Flag indicating data is a copy of the raster's data. | final public static int | COPY_MASK The bits of a FormatTag associated with how dataArrays are obtained. | final public static int | DATATYPE_MASK The bits of a FormatTag associated with pixel datatype. | final public static int | NONBINARY Flag indicating data are not binary. | final public static int | TAG_BYTE_COPIED FormatTag indicating data in byte arrays and uncopied. | final public static int | TAG_BYTE_UNCOPIED FormatTag indicating data in byte arrays and uncopied. | final public static int | TAG_DOUBLE_COPIED FormatTag indicating data in double arrays and copied. | final public static int | TAG_DOUBLE_UNCOPIED FormatTag indicating data in double arrays and uncopied. | final public static int | TAG_FLOAT_COPIED FormatTag indicating data in float arrays and copied. | final public static int | TAG_FLOAT_UNCOPIED FormatTag indicating data in float arrays and uncopied. | final public static int | TAG_INT_COPIED FormatTag indicating data in short arrays and copied. | final public static int | TAG_INT_UNCOPIED FormatTag indicating data in integer arrays and uncopied. | final public static int | TAG_SHORT_COPIED FormatTag indicating data in short arrays and copied. | final public static int | TAG_SHORT_UNCOPIED FormatTag indicating data in short arrays and uncopied. | final public static int | TAG_USHORT_COPIED FormatTag indicating data in unsigned short arrays and copied. | final public static int | TAG_USHORT_UNCOPIED FormatTag indicating data in unsigned short arrays and uncopied. | final public static int | UNCOPIED Flag indicating data is raster's data. | protected int | bandOffsets | protected int | formatTag | protected mediaLibImage | mlimages | protected int | numBands The number of bands per pixel in the data array. | protected Raster | raster The raster that is the source of pixel data. | protected Rectangle | rect The rectangle of the raster that MediaLibAccessor addresses. |
Constructor Summary | |
public | MediaLibAccessor(Raster raster, Rectangle rect, int formatTag, boolean preferPacked) Constructs a MediaLibAccessor object out of a Raster, Rectangle
and formatTag returned from MediaLibAccessor.findCompatibleTag().
In the case of binary data the copy mask bits of the formatTag
will be reset within the constructor according to whether the
data are in fact copied. | public | MediaLibAccessor(Raster raster, Rectangle rect, int formatTag) Constructs a MediaLibAccessor object out of a Raster, Rectangle
and formatTag returned from MediaLibAccessor.findCompatibleTag(). |
Method Summary | |
public void | clampDataArrays() Clamps data array values to a range that the underlying raster
can deal with. | public void | copyDataToRaster() Copies data back into the MediaLibAccessor's raster. | public static int | findCompatibleTag(Raster srcs, Raster dst) Returns the most efficient FormatTag that is compatible with
the destination raster and all source rasters. | public int[] | getBandOffsets() Returns the bandOffsets. | public int | getDataType() Returns the data type of the RasterAccessor object. | public double[] | getDoubleParameters(int band, double params) | public int[][] | getIntArrayParameters(int band, int[][] params) | public int[] | getIntParameters(int band, int params) | public static int | getMediaLibDataType(int formatTag) | public mediaLibImage[] | getMediaLibImages() Returns an array of mediaLibImages which represents the input raster. | public static boolean | hasMatchingBandOffsets(ComponentSampleModel dst, ComponentSampleModel src) Determines if the src ComponentSampleModel and dst
ComponentSampleModel have matching band offsets. | public static boolean | hasSameNumBands(ParameterBlock args, ImageLayout layout) Returns true if the number of bands of all the
RenderedImage sources and destination are the same. | public boolean | isBinary() Returns true if the MediaLibAccessor
represents binary data. | public boolean | isDataCopy() Returns true if the MediaLibAccessors's data is copied from it's
raster. | public static boolean | isMediaLibBinaryCompatible(ParameterBlock args, ImageLayout layout) Returns true if mediaLib is able to handle the
source(s) and destination image format as binary (also known
as bit or bilevel) image data. | public static boolean | isMediaLibCompatible(ParameterBlock args, ImageLayout layout) Returns true if mediaLib is able to handle the
source(s) and destination image format. | public static boolean | isMediaLibCompatible(ParameterBlock args) Returns true if mediaLib is able to handle the
source(s) image format. | public static boolean | isMediaLibCompatible(RenderedImage image) Returns true if mediaLib is able to handle the
image. | public static boolean | isMediaLibCompatible(SampleModel sm, ColorModel cm) Returns true if mediaLib is able to handle
an image having the supplied SampleModel and
ColorModel . | public static boolean | isPixelSequential(SampleModel sm) |
BINARY | final public static int BINARY(Code) | | Flag indicating data are binary.
|
BINARY_MASK | final public static int BINARY_MASK(Code) | | The bits of a FormatTag associated with binary data.
|
COPIED | final public static int COPIED(Code) | | Flag indicating data is a copy of the raster's data.
|
COPY_MASK | final public static int COPY_MASK(Code) | | The bits of a FormatTag associated with how dataArrays are obtained.
|
DATATYPE_MASK | final public static int DATATYPE_MASK(Code) | | The bits of a FormatTag associated with pixel datatype.
|
NONBINARY | final public static int NONBINARY(Code) | | Flag indicating data are not binary.
|
TAG_BYTE_COPIED | final public static int TAG_BYTE_COPIED(Code) | | FormatTag indicating data in byte arrays and uncopied.
|
TAG_BYTE_UNCOPIED | final public static int TAG_BYTE_UNCOPIED(Code) | | FormatTag indicating data in byte arrays and uncopied.
|
TAG_DOUBLE_COPIED | final public static int TAG_DOUBLE_COPIED(Code) | | FormatTag indicating data in double arrays and copied.
|
TAG_DOUBLE_UNCOPIED | final public static int TAG_DOUBLE_UNCOPIED(Code) | | FormatTag indicating data in double arrays and uncopied.
|
TAG_FLOAT_COPIED | final public static int TAG_FLOAT_COPIED(Code) | | FormatTag indicating data in float arrays and copied.
|
TAG_FLOAT_UNCOPIED | final public static int TAG_FLOAT_UNCOPIED(Code) | | FormatTag indicating data in float arrays and uncopied.
|
TAG_INT_COPIED | final public static int TAG_INT_COPIED(Code) | | FormatTag indicating data in short arrays and copied.
|
TAG_INT_UNCOPIED | final public static int TAG_INT_UNCOPIED(Code) | | FormatTag indicating data in integer arrays and uncopied.
|
TAG_SHORT_COPIED | final public static int TAG_SHORT_COPIED(Code) | | FormatTag indicating data in short arrays and copied.
|
TAG_SHORT_UNCOPIED | final public static int TAG_SHORT_UNCOPIED(Code) | | FormatTag indicating data in short arrays and uncopied.
|
TAG_USHORT_COPIED | final public static int TAG_USHORT_COPIED(Code) | | FormatTag indicating data in unsigned short arrays and copied.
|
TAG_USHORT_UNCOPIED | final public static int TAG_USHORT_UNCOPIED(Code) | | FormatTag indicating data in unsigned short arrays and uncopied.
|
UNCOPIED | final public static int UNCOPIED(Code) | | Flag indicating data is raster's data.
|
bandOffsets | protected int bandOffsets(Code) | | The offsets of each band in the src image
|
formatTag | protected int formatTag(Code) | | Tag indicating the data type of the data and whether its copied
|
mlimages | protected mediaLibImage mlimages(Code) | | Area of mediaLib images that represent image data
|
numBands | protected int numBands(Code) | | The number of bands per pixel in the data array.
|
raster | protected Raster raster(Code) | | The raster that is the source of pixel data.
|
rect | protected Rectangle rect(Code) | | The rectangle of the raster that MediaLibAccessor addresses.
|
MediaLibAccessor | public MediaLibAccessor(Raster raster, Rectangle rect, int formatTag, boolean preferPacked)(Code) | | Constructs a MediaLibAccessor object out of a Raster, Rectangle
and formatTag returned from MediaLibAccessor.findCompatibleTag().
In the case of binary data the copy mask bits of the formatTag
will be reset within the constructor according to whether the
data are in fact copied. This cannot be easily determined before
the data are actually copied.
|
MediaLibAccessor | public MediaLibAccessor(Raster raster, Rectangle rect, int formatTag)(Code) | | Constructs a MediaLibAccessor object out of a Raster, Rectangle
and formatTag returned from MediaLibAccessor.findCompatibleTag().
|
clampDataArrays | public void clampDataArrays()(Code) | | Clamps data array values to a range that the underlying raster
can deal with. For example, if the underlying raster stores
data as bytes, but the samples ares unpacked into integer arrays by
the RasterAccessor object for an operation, the operation will
need to call clampDataArrays() so that the data in the int
arrays is restricted to the range 0..255 before a setPixels()
call is made on the underlying raster. Note that some
operations (for example, lookup) can guarantee that their
results don't need clamping so they can call
RasterAccessor.copyDataToRaster() without first calling this
function.
|
copyDataToRaster | public void copyDataToRaster()(Code) | | Copies data back into the MediaLibAccessor's raster. Note that
the data is casted from the intermediate data format to
the raster's format. If clamping is needed, the call
clampDataArrays() method needs to be called before
calling the copyDataToRaster() method.
|
findCompatibleTag | public static int findCompatibleTag(Raster srcs, Raster dst)(Code) | | Returns the most efficient FormatTag that is compatible with
the destination raster and all source rasters.
Parameters: srcs - the source Raster ; may be null . Parameters: dst - the destination Raster . |
getBandOffsets | public int[] getBandOffsets()(Code) | | Returns the bandOffsets.
|
getDataType | public int getDataType()(Code) | | Returns the data type of the RasterAccessor object. Note that
this datatype is not necessarily the same data type as the
underlying raster.
|
getDoubleParameters | public double[] getDoubleParameters(int band, double params)(Code) | | Returns parameters in the appropriate order if MediaLibAccessor
has reordered the bands or is attempting to make a
BandSequential image look like multiple PixelSequentialImages
|
getIntArrayParameters | public int[][] getIntArrayParameters(int band, int[][] params)(Code) | | Returns parameters in the appropriate order if MediaLibAccessor
has reordered the bands or is attempting to make a
BandSequential image look like multiple PixelSequentialImages
|
getIntParameters | public int[] getIntParameters(int band, int params)(Code) | | Returns parameters in the appropriate order if MediaLibAccessor
has reordered the bands or is attempting to make a
BandSequential image look like multiple PixelSequentialImages
|
getMediaLibDataType | public static int getMediaLibDataType(int formatTag)(Code) | | |
getMediaLibImages | public mediaLibImage[] getMediaLibImages()(Code) | | Returns an array of mediaLibImages which represents the input raster.
An array is returned instead of a single mediaLibImage because
in some cases, an input Raster can't be represented by one
mediaLibImage (unless copying is done) but can be represented
by several mediaLibImages without copying.
|
hasMatchingBandOffsets | public static boolean hasMatchingBandOffsets(ComponentSampleModel dst, ComponentSampleModel src)(Code) | | Determines if the src ComponentSampleModel and dst
ComponentSampleModel have matching band offsets. If they
don't mediaLib can't deal with the image without a copy.
|
hasSameNumBands | public static boolean hasSameNumBands(ParameterBlock args, ImageLayout layout)(Code) | | Returns true if the number of bands of all the
RenderedImage sources and destination are the same.
throws: ClassCastException - if any source is notRenderedImage . |
isBinary | public boolean isBinary()(Code) | | Returns true if the MediaLibAccessor
represents binary data.
|
isDataCopy | public boolean isDataCopy()(Code) | | Returns true if the MediaLibAccessors's data is copied from it's
raster.
|
isMediaLibBinaryCompatible | public static boolean isMediaLibBinaryCompatible(ParameterBlock args, ImageLayout layout)(Code) | | Returns true if mediaLib is able to handle the
source(s) and destination image format as binary (also known
as bit or bilevel) image data. Currently, all of the
following conditions must be met in order for this method to
return true .
- MediaLib is available.
- All sources must be
RenderedImage s.
- All sources and destination must have a
MultiPixelPackedSampleModel .
- All sources and destination must have represent
single-bit data.
- All sources and destination must have
a single band of pixel data.
Additional checks for each individual OpImage
should be done in its corresponding RIF .
Parameters: args - Input arguments that include sources. Parameters: layout - Destination image layout; may be null . |
isMediaLibCompatible | public static boolean isMediaLibCompatible(ParameterBlock args, ImageLayout layout)(Code) | | Returns true if mediaLib is able to handle the
source(s) and destination image format. Currently, all of the
following conditions must be met in order for this method to
return true .
- MediaLib is available.
- All sources must be
RenderedImage .
- All sources and destination must have
ComponentSampleModel and
ComponentColorModel .
- All sources and destination must have less than or equal
to 4 bands of pixel data.
Additional checks for each individual OpImage
should be done in its corresponding RIF .
Parameters: args - Input arguments that include sources. Parameters: layout - Destination image layout; may be null . |
isMediaLibCompatible | public static boolean isMediaLibCompatible(ParameterBlock args)(Code) | | Returns true if mediaLib is able to handle the
source(s) image format. Currently, all of the following
conditions must be met in order for this method to return
true .
- MediaLib is available.
- All sources must be
RenderedImage .
- All sources must have
ComponentSampleModel and
ComponentColorModel .
- All sources must have less than or equal to 4 bands of pixel
data.
Additional checks for each individual OpImage
should be done in its corresponding RIF .
Parameters: args - Input arguments that include sources. |
isMediaLibCompatible | public static boolean isMediaLibCompatible(RenderedImage image)(Code) | | Returns true if mediaLib is able to handle the
image. Currently, all of the following conditions must be
met in order for this method to return true .
- MediaLib is available.
- The image must have
ComponentSampleModel and
ComponentColorModel .
- The image must have less than or equal to 4 bands of pixel
data.
Additional checks for each individual OpImage
should be done in its corresponding RIF .
Parameters: image - The image the compatibility of which is to be checked. |
isMediaLibCompatible | public static boolean isMediaLibCompatible(SampleModel sm, ColorModel cm)(Code) | | Returns true if mediaLib is able to handle
an image having the supplied SampleModel and
ColorModel . Currently, all of the following conditions
must be met in order for this method to return true :
- mediaLib is available.
- The
SampleModel is an instance of
ComponentSampleModel or one of its subclasses.
- The
ColorModel is null or an
instance of ComponentColorModel or a subclass thereof.
- The image must have no more than 4 bands of pixel data.
Parameters: sm - The image SampleModel . Parameters: cm - The image ColorModel . throws: NullPointerException - if sm is null . |
isPixelSequential | public static boolean isPixelSequential(SampleModel sm)(Code) | | Determines if the SampleModel stores data in a way that can
be represented by a mediaLibImage without copying
|
|
|