| sun.awt.image.SunWritableRaster sun.awt.image.ShortBandedRaster
ShortBandedRaster | public class ShortBandedRaster extends SunWritableRaster (Code) | | This class defines a Raster with pixels consisting of multiple 16-bit
samples stored in separate arrays for each band. Operations on
sets of pixels are performed on a given band of each pixel
in the set before moving on to the next band. The arrays used
for storage may be distinct or shared between some or all of
the bands.
There is only one pixel stride and one scanline stride for all
bands. This type of Raster can be used with a
ComponentColorModel. This class requires a BandedSampleModel.
version: 10 Feb 1997 |
Field Summary | |
short[][] | data The image data array. | int[] | dataOffsets Data offsets for each band of image data. | int | scanlineStride Scanline stride of the image data contained in this Raster. |
Constructor Summary | |
public | ShortBandedRaster(SampleModel sampleModel, Point origin) Constructs a ShortBandedRaster with the given SampleModel.
The Raster's upper left corner is origin and it is the same
size as the SampleModel. | public | ShortBandedRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) Constructs a ShortBandedRaster with the given SampleModel
and DataBuffer. | public | ShortBandedRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point origin, ShortBandedRaster parent) Constructs a ShortBandedRaster with the given SampleModel,
DataBuffer, and parent. |
Method Summary | |
public Raster | createChild(int x, int y, int width, int height, int x0, int y0, int bandList) Creates a subraster given a region of the raster. | public WritableRaster | createCompatibleWritableRaster(int w, int h) Creates a Raster with the same layout but using a different
width and height, and with new zeroed data arrays. | public WritableRaster | createCompatibleWritableRaster() Creates a Raster with the same layout and the same
width and height, and with new zeroed data arrays. | public WritableRaster | createWritableChild(int x, int y, int width, int height, int x0, int y0, int bandList) Creates a Writable subRaster given a region of the Raster. | public Object | getDataElements(int x, int y, Object obj) Returns the data elements for all bands at the specified
location. | public Object | getDataElements(int x, int y, int w, int h, Object obj) Returns an array of data elements from the specified rectangular
region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
short[] bandData = (short[])Raster.getDataElements(x, y, w, h, null);
int numDataElements = Raster.getnumDataElements();
short[] pixel = new short[numDataElements];
// To find a data element at location (x2, y2)
System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
pixel, 0, numDataElements);
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: width - Width of the pixel rectangle. Parameters: height - Height of the pixel rectangle. Parameters: outData - An object reference to an array of type defined bygetTransferType() and length w*h*getNumDataElements().If null an array of appropriate type and size will beallocated. | public int | getDataOffset(int band) Returns the data offset for the specified band. | public int[] | getDataOffsets() Returns a copy of the data offsets array. | public short[][] | getDataStorage() Returns a reference to the entire data array. | public short[] | getDataStorage(int band) Returns a reference to the specific band data array. | public int | getPixelStride() Returns the pixel stride, which is always equal to one for
a Raster with a BandedSampleModel. | public int | getScanlineStride() Returns the scanline stride -- the number of data array elements between
a given sample and the sample in the same column
of the next row in the same band. | public short[] | getShortData(int x, int y, int w, int h, int band, short[] outData) Returns a short array of data elements from the specified rectangular
region for the specified band.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
short[] bandData = Raster.getShortData(x, y, w, h, null);
// To find the data element at location (x2, y2)
short bandElement = bandData[((y2-y)*w + (x2-x))];
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: width - Width of the pixel rectangle. Parameters: height - Height of the pixel rectangle. Parameters: band - The band to return. Parameters: outData - If non-null, data elements for all bandsat the specified location are returned in this array. | public short[] | getShortData(int x, int y, int w, int h, short[] outData) Returns a short array of data elements from the specified rectangular
region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
short[] bandData = Raster.getShortData(x, y, w, h, null);
int numDataElements = Raster.getnumDataElements();
short[] pixel = new short[numDataElements];
// To find a data element at location (x2, y2)
System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
pixel, 0, numDataElements);
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: width - Width of the pixel rectangle. Parameters: height - Height of the pixel rectangle. Parameters: outData - If non-null, data elements for all bandsat the specified location are returned in this array. | public void | putShortData(int x, int y, int w, int h, int band, short[] inData) Stores a short array of data elements into the specified
rectangular region for the specified band.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
The data elements in the
data array are assumed to be packed. | public void | putShortData(int x, int y, int w, int h, short[] inData) Stores a short integer array of data elements into the specified
rectangular region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
The data elements in the
data array are assumed to be packed. | public void | setDataElements(int x, int y, Object obj) Stores the data element for all bands at the specified location. | public void | setDataElements(int x, int y, Raster inRaster) Stores the Raster data at the specified location. | public void | setDataElements(int x, int y, int w, int h, Object obj) Stores an array of data elements into the specified rectangular
region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
A ClassCastException will be thrown if the input object is non null
and references anything other than an array of transferType.
The data elements in the
data array are assumed to be packed. | public String | toString() |
data | short[][] data(Code) | | The image data array.
|
dataOffsets | int[] dataOffsets(Code) | | Data offsets for each band of image data.
|
scanlineStride | int scanlineStride(Code) | | Scanline stride of the image data contained in this Raster.
|
ShortBandedRaster | public ShortBandedRaster(SampleModel sampleModel, Point origin)(Code) | | Constructs a ShortBandedRaster with the given SampleModel.
The Raster's upper left corner is origin and it is the same
size as the SampleModel. A DataBuffer large enough to describe the
Raster is automatically created. SampleModel must be of type
BandedSampleModel.
Parameters: sampleModel - The SampleModel that specifies the layout. Parameters: origin - The Point that specified the origin. |
ShortBandedRaster | public ShortBandedRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin)(Code) | | Constructs a ShortBandedRaster with the given SampleModel
and DataBuffer. The Raster's upper left corner is origin and
it is the same size as the SampleModel. The DataBuffer is not
initialized and must be a DataBufferUShort compatible with SampleModel.
SampleModel must be of type BandedSampleModel.
Parameters: sampleModel - The SampleModel that specifies the layout. Parameters: dataBuffer - The DataBufferUShort that contains the image data. Parameters: origin - The Point that specifies the origin. |
ShortBandedRaster | public ShortBandedRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point origin, ShortBandedRaster parent)(Code) | | Constructs a ShortBandedRaster with the given SampleModel,
DataBuffer, and parent. DataBuffer must be a DataBufferUShort and
SampleModel must be of type BandedSampleModel.
When translated into the base Raster's
coordinate system, aRegion must be contained by the base Raster.
Origin is the coordinate in the new Raster's coordinate system of
the origin of the base Raster. (The base Raster is the Raster's
ancestor which has no parent.)
Note that this constructor should generally be called by other
constructors or create methods, it should not be used directly.
Parameters: sampleModel - The SampleModel that specifies the layout. Parameters: dataBuffer - The DataBufferUShort that contains the image data. Parameters: aRegion - The Rectangle that specifies the image area. Parameters: origin - The Point that specifies the origin. Parameters: parent - The parent (if any) of this raster. |
createChild | public Raster createChild(int x, int y, int width, int height, int x0, int y0, int bandList)(Code) | | Creates a subraster given a region of the raster. The x and y
coordinates specify the horizontal and vertical offsets
from the upper-left corner of this raster to the upper-left corner
of the subraster. A subset of the bands of the parent Raster may
be specified. If this is null, then all the bands are present in the
subRaster. A translation to the subRaster may also be specified.
Note that the subraster will reference the same
DataBuffers as the parent raster, but using different offsets.
Parameters: x - X offset. Parameters: y - Y offset. Parameters: width - Width (in pixels) of the subraster. Parameters: height - Height (in pixels) of the subraster. Parameters: x0 - Translated X origin of the subraster. Parameters: y0 - Translated Y origin of the subraster. Parameters: bandList - Array of band indices. exception: RasterFormatException - if the specified bounding box is outside of the parent raster. |
createCompatibleWritableRaster | public WritableRaster createCompatibleWritableRaster(int w, int h)(Code) | | Creates a Raster with the same layout but using a different
width and height, and with new zeroed data arrays.
|
createCompatibleWritableRaster | public WritableRaster createCompatibleWritableRaster()(Code) | | Creates a Raster with the same layout and the same
width and height, and with new zeroed data arrays. If
the Raster is a subRaster, this will call
createCompatibleRaster(width, height).
|
createWritableChild | public WritableRaster createWritableChild(int x, int y, int width, int height, int x0, int y0, int bandList)(Code) | | Creates a Writable subRaster given a region of the Raster. The x and y
coordinates specify the horizontal and vertical offsets
from the upper-left corner of this Raster to the upper-left corner
of the subRaster. A subset of the bands of the parent Raster may
be specified. If this is null, then all the bands are present in the
subRaster. A translation to the subRaster may also be specified.
Note that the subRaster will reference the same
DataBuffers as the parent Raster, but using different offsets.
Parameters: x - X offset. Parameters: y - Y offset. Parameters: width - Width (in pixels) of the subraster. Parameters: height - Height (in pixels) of the subraster. Parameters: x0 - Translated X origin of the subraster. Parameters: y0 - Translated Y origin of the subraster. Parameters: bandList - Array of band indices. exception: RasterFormatException - if the specified bounding box is outside of the parent Raster. |
getDataElements | public Object getDataElements(int x, int y, Object obj)(Code) | | Returns the data elements for all bands at the specified
location.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinate is out of bounds.
A ClassCastException will be thrown if the input object is non null
and references anything other than an array of transferType.
Parameters: x - The X coordinate of the pixel location. Parameters: y - The Y coordinate of the pixel location. Parameters: outData - An object reference to an array of type defined bygetTransferType() and length getNumDataElements().If null an array of appropriate type and size will beallocated. An object reference to an array of type defined bygetTransferType() with the request pixel data. |
getDataElements | public Object getDataElements(int x, int y, int w, int h, Object obj)(Code) | | Returns an array of data elements from the specified rectangular
region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
short[] bandData = (short[])Raster.getDataElements(x, y, w, h, null);
int numDataElements = Raster.getnumDataElements();
short[] pixel = new short[numDataElements];
// To find a data element at location (x2, y2)
System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
pixel, 0, numDataElements);
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: width - Width of the pixel rectangle. Parameters: height - Height of the pixel rectangle. Parameters: outData - An object reference to an array of type defined bygetTransferType() and length w*h*getNumDataElements().If null an array of appropriate type and size will beallocated. An object reference to an array of type defined bygetTransferType() with the request pixel data. |
getDataOffset | public int getDataOffset(int band)(Code) | | Returns the data offset for the specified band. The data offset
is the index into the band's data array
in which the first sample of the first scanline is stored.
Parameters: The - band whose offset is returned. |
getDataOffsets | public int[] getDataOffsets()(Code) | | Returns a copy of the data offsets array. For each band the data offset
is the index into the band's data array, of the first sample of the
band.
|
getDataStorage | public short[][] getDataStorage()(Code) | | Returns a reference to the entire data array.
|
getDataStorage | public short[] getDataStorage(int band)(Code) | | Returns a reference to the specific band data array.
|
getPixelStride | public int getPixelStride()(Code) | | Returns the pixel stride, which is always equal to one for
a Raster with a BandedSampleModel.
|
getScanlineStride | public int getScanlineStride()(Code) | | Returns the scanline stride -- the number of data array elements between
a given sample and the sample in the same column
of the next row in the same band.
|
getShortData | public short[] getShortData(int x, int y, int w, int h, int band, short[] outData)(Code) | | Returns a short array of data elements from the specified rectangular
region for the specified band.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
short[] bandData = Raster.getShortData(x, y, w, h, null);
// To find the data element at location (x2, y2)
short bandElement = bandData[((y2-y)*w + (x2-x))];
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: width - Width of the pixel rectangle. Parameters: height - Height of the pixel rectangle. Parameters: band - The band to return. Parameters: outData - If non-null, data elements for all bandsat the specified location are returned in this array. Data array with data elements for all bands. |
getShortData | public short[] getShortData(int x, int y, int w, int h, short[] outData)(Code) | | Returns a short array of data elements from the specified rectangular
region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
short[] bandData = Raster.getShortData(x, y, w, h, null);
int numDataElements = Raster.getnumDataElements();
short[] pixel = new short[numDataElements];
// To find a data element at location (x2, y2)
System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
pixel, 0, numDataElements);
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: width - Width of the pixel rectangle. Parameters: height - Height of the pixel rectangle. Parameters: outData - If non-null, data elements for all bandsat the specified location are returned in this array. Data array with data elements for all bands. |
putShortData | public void putShortData(int x, int y, int w, int h, int band, short[] inData)(Code) | | Stores a short array of data elements into the specified
rectangular region for the specified band.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
The data elements in the
data array are assumed to be packed. That is, a data element
at location (x2, y2) would be found at:
inData[((y2-y)*w + (x2-x))]
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: w - Width of the pixel rectangle. Parameters: h - Height of the pixel rectangle. Parameters: band - The band to set. Parameters: inData - The data elements to be stored. |
putShortData | public void putShortData(int x, int y, int w, int h, short[] inData)(Code) | | Stores a short integer array of data elements into the specified
rectangular region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
The data elements in the
data array are assumed to be packed. That is, a data element
for the nth band at location (x2, y2) would be found at:
inData[((y2-y)*w + (x2-x))*numDataElements + n]
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: w - Width of the pixel rectangle. Parameters: h - Height of the pixel rectangle. Parameters: inData - The data elements to be stored. |
setDataElements | public void setDataElements(int x, int y, Object obj)(Code) | | Stores the data element for all bands at the specified location.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinate is out of bounds.
A ClassCastException will be thrown if the input object is non null
and references anything other than an array of transferType.
Parameters: x - The X coordinate of the pixel location. Parameters: y - The Y coordinate of the pixel location. Parameters: inData - An object reference to an array of type defined bygetTransferType() and length getNumDataElements()containing the pixel data to place at x,y. |
setDataElements | public void setDataElements(int x, int y, Raster inRaster)(Code) | | Stores the Raster data at the specified location.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
Parameters: x - The X coordinate of the pixel location. Parameters: y - The Y coordinate of the pixel location. Parameters: inRaster - Raster of data to place at x,y location. |
setDataElements | public void setDataElements(int x, int y, int w, int h, Object obj)(Code) | | Stores an array of data elements into the specified rectangular
region.
An ArrayIndexOutOfBounds exception will be thrown at runtime
if the pixel coordinates are out of bounds.
A ClassCastException will be thrown if the input object is non null
and references anything other than an array of transferType.
The data elements in the
data array are assumed to be packed. That is, a data element
for the nth band at location (x2, y2) would be found at:
inData[((y2-y)*w + (x2-x))*numDataElements + n]
Parameters: x - The X coordinate of the upper left pixel location. Parameters: y - The Y coordinate of the upper left pixel location. Parameters: w - Width of the pixel rectangle. Parameters: h - Height of the pixel rectangle. Parameters: inData - An object reference to an array of type defined bygetTransferType() and length w*h*getNumDataElements()containing the pixel data to place between x,y andx+h, y+h. |
|
|