DataBuffer.TYPE_BYTE
,
DataBuffer.TYPE_USHORT
, or DataBuffer.TYPE_INT
,
respectively), data for which each sample is a signed integral number
which can be stored in 16 bits (using DataBuffer.TYPE_SHORT
),
or data for which each sample is a signed float or double quantity
(using DataBuffer.TYPE_FLOAT
or
DataBuffer.TYPE_DOUBLE
, respectively).
All samples of a given ComponentSampleModel
are stored with the same precision. All strides and offsets must be
non-negative. This class supports
TYPE_BYTE
,
TYPE_USHORT
,
TYPE_SHORT
,
TYPE_INT
,
TYPE_FLOAT
,
TYPE_DOUBLE
,
java.awt.image.PixelInterleavedSampleModel
, java.awt.image.BandedSampleModel
Modifier and Type | Field and Description |
---|---|
protected int[] | bandOffsets
Offsets for all bands in data array elements. |
protected int[] | bankIndices
Index for each bank storing a band of image data. |
protected int | numBands
Hides java. ComponentSampleModel .
|
protected int | numBanks
The number of banks in this
|
protected int | pixelStride
Pixel stride (in data array elements) of the region of image data described by this ComponentSampleModel. |
protected int | scanlineStride
Line stride (in data array elements) of the region of image data described by this ComponentSampleModel. |
Access | Constructor and Description |
---|---|
public | ComponentSampleModel(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 pixel stride of the region of image
data described pixelStride, int the line stride of the region of image
data described scanlineStride, int[] the offsets of all bands bandOffsets)Constructs a ComponentSampleModel with the specified parameters. |
public | ComponentSampleModel(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 pixel stride of the region of image
data described pixelStride, int The line stride of the region of image
data described scanlineStride, int[] the bank indices of all bands bankIndices, int[] the band offsets of all bands bandOffsets)Constructs a ComponentSampleModel with the specified parameters. |
Modifier and Type | Method and Description |
---|---|
public SampleModel | Returns: a newComponentSampleModel with the specified sizethe width of the resulting w, int SampleModel the height of the resulting h)SampleModel Implements abstract java. ComponentSampleModel with the specified
width and height.
|
public DataBuffer | Returns: aDataBuffer whose data type, number of banks
and size are consistent with this
ComponentSampleModel .Implements abstract java. DataBuffer that corresponds to this
ComponentSampleModel .
|
public SampleModel | Returns: aComponentSampleModel created with a subset
of bands from this ComponentSampleModel .a subset of bands from this
bands)ComponentSampleModel Implements abstract java. |
public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
public final int[] | |
public final int[] | |
private int | getBufferSize()
Returns the size of the data buffer (in data elements) needed for a data buffer that matches this ComponentSampleModel. |
public Object | Returns: the data of the specified pixelthe X coordinate of the pixel location x, int the Y coordinate of the pixel location y, Object if non- obj, DataBuffer null , a primitive array
in which to return the pixel datathe data)DataBuffer containing the image dataImplements abstract java. TransferType .
|
public final int | Returns: the number of data elements needed to transfer a pixel with thegetDataElements and
setDataElements methods.Implements abstract java. getDataElements(int, int, Object, DataBuffer) and
setDataElements(int, int, Object, DataBuffer)
methods.
|
public int | Returns: the offset for the first band of the specified pixel.the X location of the pixel x, int the Y location of the pixel y)Gets the offset for the first band of pixel (x,y). |
public int | Returns: the offset for the specified band of the specified pixel.the X location of the specified pixel x, int the Y location of the specified pixel y, int the specified band b)Gets the offset for band b of pixel (x,y). |
public int[] | Returns: the samples of the specified pixel.the X coordinate of the pixel location x, int the Y coordinate of the pixel location y, int[] If non-null, returns the samples in this array iArray, DataBuffer The DataBuffer containing the image data data)Overrides java. |
public int[] | Returns: the samples of the pixels within the specified region.The X coordinate of the upper left pixel location x, int The Y coordinate of the upper left pixel location y, int The width of the pixel rectangle w, int The height of the pixel rectangle h, int[] If non-null, returns the samples in this array iArray, DataBuffer The DataBuffer containing the image data data)Overrides java. |
public final int | Returns: the pixel stride of thisComponentSampleModel .Returns the pixel stride of this ComponentSampleModel. |
public int | Returns: the sample in a specified band for the specified pixelthe X coordinate of the pixel location x, int the Y coordinate of the pixel location y, int the band to return b, DataBuffer the data)DataBuffer containing the image dataImplements abstract java. |
public double | Returns: a double value representing the sample in the specified band for the specified pixel.The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, int The band to return b, DataBuffer The DataBuffer containing the image data data)Overrides java. |
public float | Returns: a float value representing the sample in the specified band for the specified pixel.The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, int The band to return b, DataBuffer The DataBuffer containing the image data data)Overrides java. |
public int[] | Returns: the samples in the specified band of the specified pixelThe X coordinate of the upper left pixel location x, int The Y coordinate of the upper left pixel location y, int the width of the pixel rectangle w, int the height of the pixel rectangle h, int the band to return b, int[] if non- iArray, DataBuffer null , returns the samples
in this arraythe data)DataBuffer containing the image dataOverrides java. |
public final int[] | Returns: an array containing the number of bits per sample for all bands, where each element in the array represents a band.Implements abstract java. |
public final int | Returns: the number of bits per sample for the specified band.the specified band band)Implements abstract java. |
public final int | Returns: the scanline stride of thisComponentSampleModel .Returns the scanline stride of this ComponentSampleModel. |
public int | |
pack-priv int[] | |
public void | setDataElements(int
the X coordinate of the pixel location x, int the Y coordinate of the pixel location y, Object a primitive array containing pixel data obj, DataBuffer the DataBuffer containing the image data data)Implements abstract java. DataBuffer from a primitive array of type
TransferType .
|
public void | setPixel(int
The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, int[] The input samples in an int array iArray, DataBuffer The DataBuffer containing the image data data)Overrides java. DataBuffer using an int array of
samples for input.
|
public void | setPixels(int
The X coordinate of the upper left pixel location x, int The Y coordinate of the upper left pixel location y, int The width of the pixel rectangle w, int The height of the pixel rectangle h, int[] The input samples in an int array iArray, DataBuffer The DataBuffer containing the image data data)Overrides java. |
public void | setSample(int
The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, int the band to set b, int the input sample as an int s, DataBuffer the DataBuffer containing the image data data)Implements abstract java. DataBuffer using an int for input.
|
public void | setSample(int
The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, int The band to set b, float The input sample as a float s, DataBuffer The DataBuffer containing the image data data)Overrides java. DataBuffer using a float for input.
|
public void | setSample(int
The X coordinate of the pixel location x, int The Y coordinate of the pixel location y, int The band to set b, double The input sample as a double s, DataBuffer The DataBuffer containing the image data data)Overrides java. DataBuffer using a double for input.
|
public void | setSamples(int
The X coordinate of the upper left pixel location x, int The Y coordinate of the upper left pixel location y, int The width of the pixel rectangle w, int The height of the pixel rectangle h, int The band to set b, int[] The input samples in an int array iArray, DataBuffer The DataBuffer containing the image data data)Overrides java. |
private void |
bandOffsets | back to summary |
---|---|
protected int[] bandOffsets Offsets for all bands in data array elements. |
bankIndices | back to summary |
---|---|
protected int[] bankIndices Index for each bank storing a band of image data. |
numBands | back to summary |
---|---|
protected int numBands Hides java. The number of bands in this
|
numBanks | back to summary |
---|---|
protected int numBanks The number of banks in this
|
pixelStride | back to summary |
---|---|
protected int pixelStride Pixel stride (in data array elements) of the region of image data described by this ComponentSampleModel. |
scanlineStride | back to summary |
---|---|
protected int scanlineStride Line stride (in data array elements) of the region of image data described by this ComponentSampleModel. |
ComponentSampleModel | back to summary |
---|---|
public ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, int[] bandOffsets) Constructs a ComponentSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. All bands will be stored in the first bank of the DataBuffer.
|
ComponentSampleModel | back to summary |
---|---|
public ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, int[] bankIndices, int[] bandOffsets) Constructs a ComponentSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. Different bands may be stored in different banks of the DataBuffer.
|
createCompatibleSampleModel | back to summary |
---|---|
public SampleModel createCompatibleSampleModel(int w, int h) Implements abstract java. Creates a new
|
createDataBuffer | back to summary |
---|---|
public DataBuffer createDataBuffer() Implements abstract java. Creates a
|
createSubsetSampleModel | back to summary |
---|---|
public SampleModel createSubsetSampleModel(int[] bands) Implements abstract java. Creates a new ComponentSampleModel with a subset of the bands of this ComponentSampleModel. The new ComponentSampleModel can be used with any DataBuffer that the existing ComponentSampleModel can be used with. The new ComponentSampleModel/DataBuffer combination will represent an image with a subset of the bands of the original ComponentSampleModel/DataBuffer combination.
|
equals | back to summary |
---|---|
public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
|
getBandOffsets | back to summary |
---|---|
public final int[] getBandOffsets() Returns the band offset for all bands.
|
getBankIndices | back to summary |
---|---|
public final int[] getBankIndices() Returns the bank indices for all bands.
|
getBufferSize | back to summary |
---|---|
private int getBufferSize() Returns the size of the data buffer (in data elements) needed for a data buffer that matches this ComponentSampleModel. |
getDataElements | back to summary |
---|---|
public Object getDataElements(int x, int y, Object obj, DataBuffer data) Implements abstract java. Returns data for a single pixel in a primitive array of type
The following code illustrates transferring data for one pixel from
ComponentSampleModel csm1, csm2; DataBufferInt db1, db2; csm2.setDataElements(x, y, csm1.getDataElements(x, y, null, db1), db2);Using getDataElements and setDataElements
to transfer between two DataBuffer/SampleModel
pairs is legitimate if the SampleModel objects have
the same number of bands, corresponding bands have the same number of
bits per sample, and the TransferType s are the same.
If
|
getNumDataElements | back to summary |
---|---|
public final int getNumDataElements() Implements abstract java. Returns the number of data elements needed to transfer a pixel
with the
|
getOffset | back to summary |
---|---|
public int getOffset(int x, int y) Gets the offset for the first band of pixel (x,y).
A sample of the first band can be retrieved from a
data.getElem(csm.getOffset(x, y));
|
getOffset | back to summary |
---|---|
public int getOffset(int x, int y, int b) Gets the offset for band b of pixel (x,y).
A sample of band data.getElem(csm.getOffset(x, y, b));
|
getPixel | back to summary |
---|---|
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data) Overrides java. Returns all samples for the specified pixel in an int array,
one sample per array element.
An
|
getPixels | back to summary |
---|---|
public int[] getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data) Overrides java. Returns all samples for the specified rectangle of pixels in
an int array, one sample per array element.
An
|
getPixelStride | back to summary |
---|---|
public final int getPixelStride() Returns the pixel stride of this ComponentSampleModel.
|
getSample | back to summary |
---|---|
public int getSample(int x, int y, int b, DataBuffer data) Implements abstract java. Returns as int the sample in a specified band for the pixel
located at (x,y).
An
|
getSampleDouble | back to summary |
---|---|
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.
An
|
getSampleFloat | back to summary |
---|---|
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.
An
|
getSamples | back to summary |
---|---|
public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data) Overrides java. Returns the samples in a specified band for the specified rectangle
of pixels in an int array, one sample per data array element.
An
|
getSampleSize | back to summary |
---|---|
public final int[] getSampleSize() Implements abstract java. Returns the number of bits per sample for all bands.
|
getSampleSize | back to summary |
---|---|
public final int getSampleSize(int band) Implements abstract java. Returns the number of bits per sample for the specified band.
|
getScanlineStride | back to summary |
---|---|
public final int getScanlineStride() Returns the scanline stride of this ComponentSampleModel.
|
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
|
orderBands | back to summary |
---|---|
pack-priv int[] orderBands(int[] orig, int step) Preserves band ordering with new step factor... |
setDataElements | back to summary |
---|---|
public void setDataElements(int x, int y, Object obj, DataBuffer data) Implements abstract java. Sets the data for a single pixel in the specified
The following code illustrates transferring data for one pixel from
ComponentSampleModel csm1, csm2; DataBufferInt db1, db2; csm2.setDataElements(x, y, csm1.getDataElements(x, y, null, db1), db2);Using getDataElements and setDataElements
to transfer between two DataBuffer/SampleModel pairs
is legitimate if the SampleModel objects have
the same number of bands, corresponding bands have the same number of
bits per sample, and the TransferType s are the same.
A
|
setPixel | back to summary |
---|---|
public void setPixel(int x, int y, int[] iArray, DataBuffer data) Overrides java. Sets a pixel in the
|
setPixels | back to summary |
---|---|
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.
An
|
setSample | back to summary |
---|---|
public void setSample(int x, int y, int b, int s, DataBuffer data) Implements abstract java. Sets a sample in the specified band for the pixel located at (x,y)
in the
|
setSample | back to summary |
---|---|
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
|
setSample | back to summary |
---|---|
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
|
setSamples | back to summary |
---|---|
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 data array element.
An
|
verify | back to summary |
---|---|
private void verify() |