|
|||||||||
| Home >> All >> java >> awt >> [ image overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt.image
Class ComponentSampleModel

java.lang.Objectjava.awt.image.SampleModel
java.awt.image.ComponentSampleModel
- Direct Known Subclasses:
- BandedSampleModel, PixelInterleavedSampleModel
- public class ComponentSampleModel
- extends SampleModel
ComponentSampleModel supports a flexible organization of pixel samples in memory, permitting pixel samples to be interleaved by band, by scanline, and by pixel. A DataBuffer for this sample model has K banks of data. Pixels have N samples, so there are N bands in the DataBuffer. Each band is completely contained in one bank of data, but a bank may contain more than one band. Each pixel sample is stored in a single data element. Within a bank, each band begins at an offset stored in bandOffsets. The banks containing the band is given by bankIndices. Within the bank, there are three dimensions - band, pixel, and scanline. The dimension ordering is controlled by bandOffset, pixelStride, and scanlineStride, which means that any combination of interleavings is supported.
| Field Summary | |
protected int[] |
bandOffsets
The offsets to the first sample for each band. |
protected int[] |
bankIndices
The indices of the bank used to store each band in a data buffer. |
protected int |
numBands
The number of bands in the image. |
protected int |
numBanks
Used when creating data buffers. |
protected int |
pixelStride
The number of data elements between a sample for one pixel and the corresponding sample for the next pixel in the same row. |
protected int |
scanlineStride
The number of data elements between a sample in one row and the corresponding sample in the next row. |
private boolean |
tightPixelPacking
|
| Fields inherited from class java.awt.image.SampleModel |
dataType, height, width |
| Constructor Summary | |
ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bandOffsets)
Creates a new sample model that assumes that all bands are stored in a single bank of the DataBuffer. |
|
ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bankIndices,
int[] bandOffsets)
Creates a new sample model that assumes that all bands are stored in a single bank of the DataBuffer. |
|
| Method Summary | |
SampleModel |
createCompatibleSampleModel(int w,
int h)
Creates a new sample model that is compatible with this one, but with the specified dimensions. |
DataBuffer |
createDataBuffer()
Creates a new data buffer that is compatible with this sample model. |
SampleModel |
createSubsetSampleModel(int[] bands)
Creates a new sample model that provides access to a subset of the bands that this sample model supports. |
boolean |
equals(java.lang.Object obj)
Tests this sample model for equality with an arbitrary object. |
int[] |
getBandOffsets()
Returns the offsets to the first sample in each band. |
int[] |
getBankIndices()
Returns the indices of the bank(s) in the DataBuffer used to store the samples for each band. |
java.lang.Object |
getDataElements(int x,
int y,
int w,
int h,
java.lang.Object obj,
DataBuffer data)
Returns the samples for the pixels in the region defined by (x, y, w, h) in a primitive array (the array type is
determined by the data type for this model). |
java.lang.Object |
getDataElements(int x,
int y,
java.lang.Object obj,
DataBuffer data)
Returns the samples for the pixel at location (x, y) in
a primitive array (the array type is determined by the data type for
this model). |
int |
getNumDataElements()
Returns the number of data elements used to store the samples for one pixel. |
int |
getOffset(int x,
int y)
Returns the offset of the sample in band 0 for the pixel at location (x, y). |
int |
getOffset(int x,
int y,
int b)
Returns the offset of the sample in band b for the pixel at
location (x, y). |
int[] |
getPixel(int x,
int y,
int[] iArray,
DataBuffer data)
Returns all the samples for the pixel at location (x, y)
stored in the specified data buffer. |
int[] |
getPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
Returns the samples for all the pixels in a rectangular region. |
int |
getPixelStride()
Returns the distance (in terms of element indices) between the sample for one pixel and the corresponding sample for the next pixel in a row. |
int |
getSample(int x,
int y,
int b,
DataBuffer data)
Returns the sample for band b of the pixel at
(x, y) that is stored in the specified data buffer. |
int[] |
getSampleSize()
Returns the size in bits for each sample (one per band). |
int |
getSampleSize(int band)
Returns the size in bits for the samples in the specified band. |
int |
getScanlineStride()
Returns the distance (in terms of element indices) between the sample for one pixel and the corresponding sample for the equivalent pixel in the next row. |
int |
hashCode()
Returns a hash code for this sample model. |
void |
setDataElements(int x,
int y,
int w,
int h,
java.lang.Object obj,
DataBuffer data)
Sets the samples for the pixels in the region defined by (x, y, w, h) from a supplied primitive array (the array type
must be consistent with the data type for this model). |
void |
setDataElements(int x,
int y,
java.lang.Object obj,
DataBuffer data)
Sets the samples for the pixel at location (x, y) from the
supplied primitive array (the array type must be consistent with the data
type for this model). |
void |
setPixel(int x,
int y,
int[] iArray,
DataBuffer data)
Sets the sample values for the pixel at location (x, y)
stored in the specified data buffer. |
void |
setSample(int x,
int y,
int b,
int s,
DataBuffer data)
Sets the sample value for band b of the pixel at location
(x, y) in the specified data buffer. |
| Methods inherited from class java.awt.image.SampleModel |
getDataType, getHeight, getNumBands, getPixel, getPixel, getPixels, getPixels, getSampleDouble, getSampleFloat, getSamples, getSamples, getSamples, getTransferType, getWidth, setPixel, setPixel, setPixels, setPixels, setPixels, setSample, setSample, setSamples, setSamples, setSamples |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
bandOffsets
protected int[] bandOffsets
- The offsets to the first sample for each band.
bankIndices
protected int[] bankIndices
- The indices of the bank used to store each band in a data buffer.
numBands
protected int numBands
- The number of bands in the image.
numBanks
protected int numBanks
- Used when creating data buffers.
scanlineStride
protected int scanlineStride
- The number of data elements between a sample in one row and the
corresponding sample in the next row.
pixelStride
protected int pixelStride
- The number of data elements between a sample for one pixel and the
corresponding sample for the next pixel in the same row.
tightPixelPacking
private boolean tightPixelPacking
| Constructor Detail |
ComponentSampleModel
public ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bandOffsets)
- Creates a new sample model that assumes that all bands are stored in a
single bank of the DataBuffer.
Note that the
bandOffsetsarray is copied to internal storage to prevent subsequent changes to the array from affecting this object.
ComponentSampleModel
public ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bankIndices,
int[] bandOffsets)
- Creates a new sample model that assumes that all bands are stored in a
single bank of the DataBuffer.
| Method Detail |
createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w, int h)
- Creates a new sample model that is compatible with this one, but with the
specified dimensions.
- Specified by:
createCompatibleSampleModelin classSampleModel
createSubsetSampleModel
public SampleModel createSubsetSampleModel(int[] bands)
- Creates a new sample model that provides access to a subset of the bands
that this sample model supports.
- Specified by:
createSubsetSampleModelin classSampleModel
createDataBuffer
public DataBuffer createDataBuffer()
- Creates a new data buffer that is compatible with this sample model.
- Specified by:
createDataBufferin classSampleModel
getOffset
public int getOffset(int x,
int y)
- Returns the offset of the sample in band 0 for the pixel at location
(x, y). This offset can be used to read a sample value from a DataBuffer.
getOffset
public int getOffset(int x,
int y,
int b)
- Returns the offset of the sample in band
bfor the pixel at location(x, y). This offset can be used to read a sample value from a DataBuffer.
getSampleSize
public final int[] getSampleSize()
- Returns the size in bits for each sample (one per band). For this sample
model, each band has the same sample size and this is determined by the
data type for the sample model.
- Specified by:
getSampleSizein classSampleModel
getSampleSize
public final int getSampleSize(int band)
- Returns the size in bits for the samples in the specified band. In this
class, the sample size is the same for every band and is determined from
the data type for the model.
- Specified by:
getSampleSizein classSampleModel
getBankIndices
public final int[] getBankIndices()
- Returns the indices of the bank(s) in the DataBuffer used to
store the samples for each band. The returned array is a copy, so that
altering it will not impact the sample model.
getBandOffsets
public final int[] getBandOffsets()
- Returns the offsets to the first sample in each band. The returned array
is a copy, so that altering it will not impact the sample model.
getScanlineStride
public final int getScanlineStride()
- Returns the distance (in terms of element indices) between the sample for
one pixel and the corresponding sample for the equivalent pixel in the
next row. This is used in the calculation of the element offset for
retrieving samples from a DataBuffer.
getPixelStride
public final int getPixelStride()
- Returns the distance (in terms of element indices) between the sample for
one pixel and the corresponding sample for the next pixel in a row. This
is used in the calculation of the element offset for retrieving samples
from a DataBuffer.
getNumDataElements
public final int getNumDataElements()
- Returns the number of data elements used to store the samples for one
pixel. In this model, this is the same as the number of bands.
- Specified by:
getNumDataElementsin classSampleModel
getDataElements
public java.lang.Object getDataElements(int x, int y, java.lang.Object obj, DataBuffer data)
- Returns the samples for the pixel at location
(x, y)in a primitive array (the array type is determined by the data type for this model). Theobjargument provides an option to supply an existing array to hold the result, if this isnulla new array will be allocated.- Specified by:
getDataElementsin classSampleModel
getDataElements
public java.lang.Object getDataElements(int x, int y, int w, int h, java.lang.Object obj, DataBuffer data)
- Returns the samples for the pixels in the region defined by
(x, y, w, h)in a primitive array (the array type is determined by the data type for this model). Theobjargument provides an option to supply an existing array to hold the result, if this isnulla new array will be allocated.- Overrides:
getDataElementsin classSampleModel
setDataElements
public void setDataElements(int x,
int y,
int w,
int h,
java.lang.Object obj,
DataBuffer data)
- Sets the samples for the pixels in the region defined by
(x, y, w, h)from a supplied primitive array (the array type must be consistent with the data type for this model).- Overrides:
setDataElementsin classSampleModel
getPixel
public int[] getPixel(int x,
int y,
int[] iArray,
DataBuffer data)
- Returns all the samples for the pixel at location
(x, y)stored in the specified data buffer.- Overrides:
getPixelin classSampleModel
getPixels
public int[] getPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
- Returns the samples for all the pixels in a rectangular region.
- Overrides:
getPixelsin classSampleModel
getSample
public int getSample(int x,
int y,
int b,
DataBuffer data)
- Returns the sample for band
bof the pixel at(x, y)that is stored in the specified data buffer.- Specified by:
getSamplein classSampleModel
setDataElements
public void setDataElements(int x,
int y,
java.lang.Object obj,
DataBuffer data)
- Sets the samples for the pixel at location
(x, y)from the supplied primitive array (the array type must be consistent with the data type for this model).- Specified by:
setDataElementsin classSampleModel
setPixel
public void setPixel(int x,
int y,
int[] iArray,
DataBuffer data)
- Sets the sample values for the pixel at location
(x, y)stored in the specified data buffer.- Overrides:
setPixelin classSampleModel
setSample
public void setSample(int x,
int y,
int b,
int s,
DataBuffer data)
- Sets the sample value for band
bof the pixel at location(x, y)in the specified data buffer.- Specified by:
setSamplein classSampleModel
equals
public boolean equals(java.lang.Object obj)
- Tests this sample model for equality with an arbitrary object. Returns
trueif and only if:objis notnull;objis an instance ofComponentSampleModel;- both models have the same values for the
dataType,width,height,pixelStride,scanlineStride,bandOffsetsandbankIndicesfields.
hashCode
public int hashCode()
- Returns a hash code for this sample model.
|
|||||||||
| Home >> All >> java >> awt >> [ image overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC