TYPE_BYTE,
TYPE_USHORT,
TYPE_SHORT,
TYPE_INT,
TYPE_FLOAT, and
TYPE_DOUBLE datatypes
| Access | Constructor and Description |
|---|---|
| public | BandedSampleModel(int
The data type for storing samples. dataType, int The width (in pixels) of the region of
image data described. w, int The height (in pixels) of the region of image
data described. h, int The number of bands for the image data. numBands)Constructs a BandedSampleModel with the specified parameters. |
| public | BandedSampleModel(int
The data type for storing samples. dataType, int The width (in pixels) of the region of
image data described. w, int The height (in pixels) of the region of
image data described. h, int The line stride of the of the image data. scanlineStride, int[] The bank index for each band. bankIndices, int[] The band offset for each band. bandOffsets)Constructs a BandedSampleModel with the specified parameters. |
| Modifier and Type | Method and Description |
|---|---|
| public SampleModel | Returns: a newBandedSampleModel with the specified
width and height.the width of the resulting w, int BandedSampleModelthe height of the resulting h)BandedSampleModelOverrides java. Creates a new BandedSampleModel with the specified width and height. |
| public DataBuffer | createDataBuffer()
Overrides java. Creates a DataBuffer that corresponds to this BandedSampleModel, The DataBuffer's data type, number of banks, and size will be consistent with this BandedSampleModel. |
| private static int[] | |
| private static int[] | |
| public SampleModel | createSubsetSampleModel(int[] bands)
Overrides java. Creates a new BandedSampleModel with a subset of the bands of this BandedSampleModel. |
| public Object | Returns: the data for the specified pixel.The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, Object If non-null, a primitive array in which to return
the pixel data. obj, DataBuffer The DataBuffer containing the image data. data)Overrides java. Returns data for a single pixel in a primitive array of type TransferType. |
| public int[] | getPixel(int x, int y, int[] iArray, DataBuffer data)
Overrides java. Returns the samples for a specified pixel in an int array, one sample per array element. |
| public int[] | getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
Overrides java. Returns all samples for a rectangle of pixels in an int array, one sample per array element. |
| public int | getSample(int x, int y, int b, DataBuffer data)
Overrides java. Returns the sample in a specified band for the pixel located at (x,y) as an int. |
| public double | getSampleDouble(int x, int y, int b, DataBuffer data)
Overrides java. Returns the sample in a specified band for a pixel located at (x,y) as a double. |
| public float | getSampleFloat(int x, int y, int b, DataBuffer data)
Overrides java. Returns the sample in a specified band for the pixel located at (x,y) as a float. |
| public int[] | getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
Overrides java. Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element. |
| public int | hashCode()
Overrides java. Returns a hash code value for this object. |
| public void | setDataElements(int
The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, Object If non-null, returns the primitive array in this
object obj, DataBuffer The DataBuffer containing the image data data)Overrides java. Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType. |
| public void | setPixel(int x, int y, int[] iArray, DataBuffer data)
Overrides java. Sets a pixel in the DataBuffer using an int array of samples for input. |
| public void | setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
Overrides java. Sets all samples for a rectangle of pixels from an int array containing one sample per array element. |
| public void | setSample(int x, int y, int b, int s, DataBuffer data)
Overrides java. Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input. |
| public void | setSample(int x, int y, int b, float s, DataBuffer data)
Overrides java. Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input. |
| public void | setSample(int x, int y, int b, double s, DataBuffer data)
Overrides java. Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input. |
| public void | setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
Overrides java. Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element. |
| BandedSampleModel | back to summary |
|---|---|
| public BandedSampleModel(int dataType, int w, int h, int numBands) Constructs a BandedSampleModel with the specified parameters. The pixel stride will be one data element. The scanline stride will be the same as the width. Each band will be stored in a separate bank and all band offsets will be zero.
| |
| BandedSampleModel | back to summary |
|---|---|
| public BandedSampleModel(int dataType, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets) Constructs a BandedSampleModel with the specified parameters. The number of bands will be inferred from the lengths of the bandOffsets bankIndices arrays, which must be equal. The pixel stride will be one data element.
| |
| createCompatibleSampleModel | back to summary |
|---|---|
| public SampleModel createCompatibleSampleModel(int w, int h) Overrides java. Creates a new BandedSampleModel with the specified width and height. The new BandedSampleModel will have the same number of bands, storage data type, and bank indices as this BandedSampleModel. The band offsets will be compressed such that the offset between bands will be w*pixelStride and the minimum of all of the band offsets is zero.
| |
| createDataBuffer | back to summary |
|---|---|
| public DataBuffer createDataBuffer() Overrides java. Creates a DataBuffer that corresponds to this BandedSampleModel, The DataBuffer's data type, number of banks, and size will be consistent with this BandedSampleModel.
| |
| createIndicesArray | back to summary |
|---|---|
| private static int[] createIndicesArray(int numBands) | |
| createOffsetArray | back to summary |
|---|---|
| private static int[] createOffsetArray(int numBands) | |
| createSubsetSampleModel | back to summary |
|---|---|
| public SampleModel createSubsetSampleModel(int[] bands) Overrides java. Creates a new BandedSampleModel with a subset of the bands of this BandedSampleModel. The new BandedSampleModel can be used with any DataBuffer that the existing BandedSampleModel can be used with. The new BandedSampleModel/DataBuffer combination will represent an image with a subset of the bands of the original BandedSampleModel/DataBuffer combination.
| |
| getDataElements | back to summary |
|---|---|
| public Object getDataElements(int x, int y, Object obj, DataBuffer data) Overrides java. Returns data for a single pixel in a primitive array of type TransferType. For a BandedSampleModel, this will be the same as the data type, and samples will be returned one per array element. Generally, obj should be passed in as null, so that the Object will be created automatically and will be of the right primitive data type.
The following code illustrates transferring data for one pixel from
DataBuffer
BandedSampleModel bsm1, bsm2;
DataBufferInt db1, db2;
bsm2.setDataElements(x, y, bsm1.getDataElements(x, y, null, db1),
db2);
Using getDataElements/setDataElements to transfer between two
DataBuffer/SampleModel pairs is legitimate if the SampleModels have
the same number of bands, corresponding bands have the same number of
bits per sample, and the TransferTypes are the same.
If obj is non-null, it should be a primitive array of type TransferType. Otherwise, a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds, or if obj is non-null and is not large enough to hold the pixel data.
| |
| getPixel | back to summary |
|---|---|
| public int[] getPixel(int x, int y, int[] iArray, DataBuffer data) Overrides java. Doc from java. Returns the samples for a specified pixel in an int array, one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| getPixels | back to summary |
|---|---|
| public int[] getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data) Overrides java. Doc from java. Returns all samples for a rectangle of pixels in an int array, one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| getSample | back to summary |
|---|---|
| public int getSample(int x, int y, int b, DataBuffer data) Overrides java. Doc from java. Returns the sample in a specified band for the pixel located at (x,y) as an int. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| getSampleDouble | back to summary |
|---|---|
| public double getSampleDouble(int x, int y, int b, DataBuffer data) Overrides java. Doc from java. Returns the sample in a specified band for a pixel located at (x,y) as a double. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| getSampleFloat | back to summary |
|---|---|
| public float getSampleFloat(int x, int y, int b, DataBuffer data) Overrides java. Doc from java. Returns the sample in a specified band for the pixel located at (x,y) as a float. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| getSamples | back to summary |
|---|---|
| public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data) Overrides java. Doc from java. Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| setDataElements | back to summary |
|---|---|
| public void setDataElements(int x, int y, Object obj, DataBuffer data) Overrides java. Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType. For a BandedSampleModel, this will be the same as the data type, and samples are transferred one per array element.
The following code illustrates transferring data for one pixel from
DataBuffer
BandedSampleModel bsm1, bsm2;
DataBufferInt db1, db2;
bsm2.setDataElements(x, y, bsm1.getDataElements(x, y, null, db1),
db2);
Using getDataElements/setDataElements to transfer between two
DataBuffer/SampleModel pairs is legitimate if the SampleModels have
the same number of bands, corresponding bands have the same number of
bits per sample, and the TransferTypes are the same.
obj must be a primitive array of type TransferType. Otherwise, a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds, or if obj is not large enough to hold the pixel data.
| |
| setPixel | back to summary |
|---|---|
| public void setPixel(int x, int y, int[] iArray, DataBuffer data) Overrides java. Doc from java. Sets a pixel in the DataBuffer using an int array of samples for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| setPixels | back to summary |
|---|---|
| public void setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data) Overrides java. Doc from java. Sets all samples for a rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| setSample | back to summary |
|---|---|
| public void setSample(int x, int y, int b, int s, DataBuffer data) Overrides java. Doc from java. Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |
| setSample | back to summary |
|---|---|
| public void setSample(int x, int y, int b, float s, DataBuffer data) Overrides java. Doc from java. Sets a sample in the specified band for the pixel located at (x,y)
in the DataBuffer using a float for input.
The default implementation of this method casts the input
float sample to an int and then calls the
| |
| setSample | back to summary |
|---|---|
| public void setSample(int x, int y, int b, double s, DataBuffer data) Overrides java. Doc from java. Sets a sample in the specified band for the pixel located at (x,y)
in the DataBuffer using a double for input.
The default implementation of this method casts the input
double sample to an int and then calls the
| |
| setSamples | back to summary |
|---|---|
| public void setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data) Overrides java. Doc from java. Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
| |