Modifier and Type | Field and Description |
---|---|
pack-priv byte[][] | data
The image data array. |
pack-priv int[] | dataOffsets
Data offsets for each band of image data. |
private int | maxX
A cached copy of minX + width for use in bounds checks. |
private int | maxY
A cached copy of minY + height for use in bounds checks. |
pack-priv int | scanlineStride
Scanline stride of the image data contained in this Raster. |
Access | Constructor and Description |
---|---|
public | ByteBandedRaster(SampleModel
The SampleModel that specifies the layout. sampleModel, Point The Point that specifies the origin. origin)Constructs a ByteBandedRaster with the given sampleModel. |
public | ByteBandedRaster(SampleModel
The SampleModel that specifies the layout. sampleModel, DataBufferByte The DataBufferByte that contains the image data. dataBuffer, Point The Point that specifies the origin. origin)Constructs a ByteBanded Raster with the given sampleModel and DataBuffer. |
public | ByteBandedRaster(SampleModel
The SampleModel that specifies the layout. sampleModel, DataBufferByte The DataBufferByte that contains the image data. dataBuffer, Rectangle The Rectangle that specifies the image area. aRegion, Point The Point that specifies the origin. origin, ByteBandedRaster The parent (if any) of this raster. parent)Constructs a ByteBandedRaster with the given sampleModel, DataBuffer, and parent. |
Modifier and Type | Method and Description |
---|---|
public Raster | createChild(int
X offset. x, int Y offset. y, int Width (in pixels) of the subraster. width, int Height (in pixels) of the subraster. height, int Translated X origin of the subraster. x0, int Translated Y origin of the subraster. y0, int[] Array of band indices. bandList)Overrides java. |
public WritableRaster | createCompatibleWritableRaster(int
the specified width of the new w, int WritableRaster the specified height of the new h)WritableRaster Overrides java. |
public WritableRaster | createCompatibleWritableRaster()
Overrides java. |
public WritableRaster | createWritableChild(int
X offset. x, int Y offset. y, int Width of the subraster. width, int Height of the subraster. height, int Translated X origin of the subraster. x0, int Translated Y origin of the subraster. y0, int[] Array of band indices. bandList)Overrides java. |
public byte[] | Returns: Data array with data elements for all bands.The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, int The band to return. band, byte[] If non-null, data elements for all bands
at the specified location are returned in this array. outData)Returns a byte array of data elements from the specified rectangular region for the specified band. |
public byte[] | Returns: Data array with data elements for all bands.The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, byte[] If non-null, data elements for all bands
at the specified location are returned in this array. outData)Returns a byte array of data elements from the specified rectangular region. |
public Object | Returns: An object reference to an array of type defined by getTransferType() with the request pixel data.The X coordinate of the pixel location. x, int The Y coordinate of the pixel location. y, Object An object reference to an array of type defined by
getTransferType() and length getNumDataElements().
If null an array of appropriate type and size will be
allocated. obj)Overrides java. |
public Object | Returns: An object reference to an array of type defined by getTransferType() with the request pixel data.The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, Object An object reference to an array of type defined by
getTransferType() and length w*h*getNumDataElements().
If null an array of appropriate type and size will be
allocated. obj)Overrides java. |
public int | getDataOffset(int
The band whose offset is returned. band)Returns data offset for the specified band. |
public int[] | |
public byte[][] | |
public byte[] | |
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 void | putByteData(int
The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, int The band to set. band, byte[] The data elements to be stored. inData)Stores a byte array of data elements into the specified rectangular region. |
public void | putByteData(int
The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, byte[] The data elements to be stored. inData)Stores a byte array of data elements into the specified rectangular region. |
public void | setDataElements(int
The X coordinate of the pixel location. x, int The Y coordinate of the pixel location. y, Object An object reference to an array of type defined by
getTransferType() and length getNumDataElements()
containing the pixel data to place at x,y. obj)
Stores the data elements for all bands at the specified location.
|
public void | setDataElements(int
The X coordinate of the pixel location. x, int The Y coordinate of the pixel location. y, Raster Raster of data to place at x,y location. inRaster)
Stores the Raster data at the specified location.
|
private void | setDataElements(int
The absolute X coordinate of the destination pixel
that will receive a copy of the upper-left pixel of the
inRaster dstX, int The absolute Y coordinate of the destination pixel
that will receive a copy of the upper-left pixel of the
inRaster dstY, int The number of pixels to store horizontally width, int The number of pixels to store vertically height, Raster Raster of data to place at x,y location. inRaster)Stores the Raster data at the specified location. |
public void | setDataElements(int
The X coordinate of the upper left pixel location. x, int The Y coordinate of the upper left pixel location. y, int Width of the pixel rectangle. w, int Height of the pixel rectangle. h, Object An object reference to an array of type defined by
getTransferType() and length w*h*getNumDataElements()
containing the pixel data to place between x,y and
x+h, y+h. obj)
Stores an array of data elements into the specified rectangular
region.
|
public String | |
private void |
data | back to summary |
---|---|
pack-priv byte[][] data The image data array. |
dataOffsets | back to summary |
---|---|
pack-priv int[] dataOffsets Data offsets for each band of image data. |
maxX | back to summary |
---|---|
private int maxX A cached copy of minX + width for use in bounds checks. |
maxY | back to summary |
---|---|
private int maxY A cached copy of minY + height for use in bounds checks. |
scanlineStride | back to summary |
---|---|
pack-priv int scanlineStride Scanline stride of the image data contained in this Raster. |
ByteBandedRaster | back to summary |
---|---|
public ByteBandedRaster(SampleModel sampleModel, Point origin) Constructs a ByteBandedRaster 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.
|
ByteBandedRaster | back to summary |
---|---|
public ByteBandedRaster(SampleModel sampleModel, DataBufferByte dataBuffer, Point origin) Constructs a ByteBanded Raster 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 DataBufferShort compatible with SampleModel. SampleModel must be of type BandedSampleModel.
|
ByteBandedRaster | back to summary |
---|---|
public ByteBandedRaster(SampleModel sampleModel, DataBufferByte dataBuffer, Rectangle aRegion, Point origin, ByteBandedRaster parent) Constructs a ByteBandedRaster with the given sampleModel, DataBuffer, and parent. DataBuffer must be a DataBufferShort 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.
|
createChild | back to summary |
---|---|
public Raster createChild(int x, int y, int width, int height, int x0, int y0, int[] bandList) Overrides java. 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.
|
createCompatibleWritableRaster | back to summary |
---|---|
public WritableRaster createCompatibleWritableRaster(int w, int h) Overrides java. Creates a Raster with the same layout but using a different width and height, and with new zeroed data arrays.
|
createCompatibleWritableRaster | back to summary |
---|---|
public WritableRaster createCompatibleWritableRaster() Overrides java. 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 | back to summary |
---|---|
public WritableRaster createWritableChild(int x, int y, int width, int height, int x0, int y0, int[] bandList) Overrides java. 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.
|
getByteData | back to summary |
---|---|
public byte[] getByteData(int x, int y, int w, int h, int band, byte[] outData) Returns a byte 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. byte[] bandData = raster.getByteData(x, y, w, h, null); // To find the data element at location (x2, y2) byte bandElement = bandData[((y2-y)*w + (x2-x))];
|
getByteData | back to summary |
---|---|
public byte[] getByteData(int x, int y, int w, int h, byte[] outData) Returns a byte 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. byte[] bandData = raster.getByteData(x, y, w, h, null); int numDataElements = raster.getNumDataElements(); byte[] pixel = new byte[numDataElements]; // To find a data element at location (x2, y2) System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements, pixel, 0, numDataElements);
|
getDataElements | back to summary |
---|---|
public Object getDataElements(int x, int y, Object obj) Overrides java. 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.
|
getDataElements | back to summary |
---|---|
public Object getDataElements(int x, int y, int w, int h, Object obj) Overrides java. 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. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType. byte[] bandData = (byte[])raster.getDataElement(x, y, w, h, null); int numDataElements = raster.getNumDataElements(); byte[] pixel = new byte[numDataElements]; // To find a data element at location (x2, y2) System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements, pixel, 0, numDataElements);
|
getDataOffset | back to summary |
---|---|
public int getDataOffset(int band) Returns 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.
|
getDataOffsets | back to summary |
---|---|
public int[] getDataOffsets() 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 | back to summary |
---|---|
public byte[][] getDataStorage() Returns a reference to the entire data array. |
getDataStorage | back to summary |
---|---|
public byte[] getDataStorage(int band) Returns a reference to the specific band data array. |
getPixelStride | back to summary |
---|---|
public int getPixelStride() Returns the pixel stride, which is always equal to one for a Raster with a BandedSampleModel. |
getScanlineStride | back to summary |
---|---|
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. |
putByteData | back to summary |
---|---|
public void putByteData(int x, int y, int w, int h, int band, byte[] inData) Stores a byte 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]
|
putByteData | back to summary |
---|---|
public void putByteData(int x, int y, int w, int h, byte[] inData) Stores a byte 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]
|
setDataElements | back to summary |
---|---|
public void setDataElements(int x, int y, Object obj) Overrides java. Stores 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.
|
setDataElements | back to summary |
---|---|
public void setDataElements(int x, int y, Raster inRaster) Overrides java. Stores the Raster data at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinate is out of bounds.
|
setDataElements | back to summary |
---|---|
private void setDataElements(int dstX, int dstY, int width, int height, Raster inRaster) Stores the Raster data at the specified location.
|
setDataElements | back to summary |
---|---|
public void setDataElements(int x, int y, int w, int h, Object obj) Overrides java. 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]
|
toString | back to summary |
---|---|
public String toString() Overrides java. Doc from java. Returns a string representation of the object.
|
verify | back to summary |
---|---|
private void verify() Verify that the layout parameters are consistent with the data. Verifies whether the data buffer has enough data for the raster, taking into account offsets, after ensuring all offsets are >=0.
|