|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.image.SampleModel
![]()
![]()
![]()
java.awt.image.ComponentSampleModel
, PixelInterleavedSampleModel

public class ComponentSampleModel

This class represents image data which is stored such that each sample
of a pixel occupies one data element of the DataBuffer. It stores the
N samples which make up a pixel in N separate data array elements.
Different bands may be in different banks of the DataBuffer.
Accessor methods are provided so that image data can be manipulated
directly. This class can support different kinds of interleaving, e.g.
band interleaving, scanline interleaving, and pixel interleaving.
Pixel stride is the number of data array elements between two samples
for the same band on the same scanline. Scanline stride is the number
of data array elements between a given sample and the corresponding sample
in the same column of the next scanline. Band offsets denote the number
of data array elements from the first data array element of the bank
of the DataBuffer holding each band to the first sample of the band.
The bands are numbered from 0 to N-1. This class can represent image
data for which each sample is an unsigned integral number which can be
stored in 8, 16, or 32 bits (using 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
,
PixelInterleavedSampleModel
,
BandedSampleModel

| Field Summary | |
|---|---|
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
The number of bands in this ComponentSampleModel. |
protected int |
numBanks
The number of banks in this ComponentSampleModel. |
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. |
Fields inherited from class java.awt.image.SampleModel ![]() |
|---|
dataType |
| Constructor Summary | |
|---|---|
ComponentSampleModel
Constructs a ComponentSampleModel with the specified parameters. |
|
ComponentSampleModel
Constructs a ComponentSampleModel with the specified parameters. |
|
| Method Summary | |
|---|---|
SampleModel |
createCompatibleSampleModel
Creates a new ComponentSampleModel with the specified
width and height. |
DataBuffer |
createDataBuffer
Creates a DataBuffer that corresponds to this
ComponentSampleModel. |
SampleModel |
createSubsetSampleModel
Creates a new ComponentSampleModel with a subset of the bands of this ComponentSampleModel. |
boolean |
equals
Indicates whether some other object is "equal to" this one. |
int[] |
getBandOffsets
Returns the band offset for all bands. |
int[] |
getBankIndices
Returns the bank indices for all bands. |
Object |
getDataElements
Returns data for a single pixel in a primitive array of type TransferType. |
int |
getNumDataElements
Returns the number of data elements needed to transfer a pixel with the getDataElements(int, int, Object, DataBuffer) and
setDataElements(int, int, Object, DataBuffer)
methods. |
int |
getOffset
Gets the offset for the first band of pixel (x,y). |
int |
getOffset
Gets the offset for band b of pixel (x,y). |
int[] |
getPixel
Returns all samples for the specified pixel in an int array, one sample per array element. |
int[] |
getPixels
Returns all samples for the specified rectangle of pixels in an int array, one sample per array element. |
int |
getPixelStride
Returns the pixel stride of this ComponentSampleModel. |
int |
getSample
Returns as int the sample in a specified band for the pixel located at (x,y). |
double |
getSampleDouble
Returns the sample in a specified band for a pixel located at (x,y) as a double. |
float |
getSampleFloat
Returns the sample in a specified band for the pixel located at (x,y) as a float. |
int[] |
getSamples
Returns the samples in a specified band for the specified rectangle of pixels in an int array, one sample per data array element. |
int[] |
getSampleSize
Returns the number of bits per sample for all bands. |
int |
getSampleSize
Returns the number of bits per sample for the specified band. |
int |
getScanlineStride
Returns the scanline stride of this ComponentSampleModel. |
int |
hashCode
Returns a hash code value for the object. |
void |
setDataElements
Sets the data for a single pixel in the specified DataBuffer from a primitive array of type
TransferType. |
void |
setPixel
Sets a pixel in the DataBuffer using an int array of
samples for input. |
void |
setPixels
Sets all samples for a rectangle of pixels from an int array containing one sample per array element. |
void |
setSample
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input. |
void |
setSample
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input. |
void |
setSample
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input. |
void |
setSamples
Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per data array element. |
Methods inherited from class java.awt.image.SampleModel ![]() |
|---|
getDataElements |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Field Detail |
|---|

protected int[] bandOffsets

protected int[] bankIndices

protected int numBands
ComponentSampleModel.

protected int numBanks
ComponentSampleModel.

protected int scanlineStride

protected int pixelStride
| Constructor Detail |
|---|

public ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bandOffsets)
dataType - the data type for storing samplesw - the width (in pixels) of the region of
image data describedh - the height (in pixels) of the region of
image data describedpixelStride - the pixel stride of the region of image
data describedscanlineStride - the line stride of the region of image
data describedbandOffsets - the offsets of all bands
IllegalArgumentException

- if w or
h is not greater than 0
IllegalArgumentException

- if pixelStride
is less than 0
IllegalArgumentException

- if scanlineStride
is less than 0
IllegalArgumentException

- if numBands
is less than 1
IllegalArgumentException

- if the product of w
and h is greater than
Integer.MAX_VALUE
IllegalArgumentException

- if dataType is not
one of the supported data types

public ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bankIndices,
int[] bandOffsets)
dataType - the data type for storing samplesw - the width (in pixels) of the region of
image data describedh - the height (in pixels) of the region of
image data describedpixelStride - the pixel stride of the region of image
data describedscanlineStride - The line stride of the region of image
data describedbankIndices - the bank indices of all bandsbandOffsets - the band offsets of all bands
IllegalArgumentException

- if w or
h is not greater than 0
IllegalArgumentException

- if pixelStride
is less than 0
IllegalArgumentException

- if scanlineStride
is less than 0
IllegalArgumentException

- if the length of
bankIndices does not equal the length of
bankOffsets
IllegalArgumentException

- if any of the bank indices
of bandIndices is less than 0
IllegalArgumentException

- if dataType is not
one of the supported data types| Method Detail |
|---|

public SampleModel![]()
![]()
createCompatibleSampleModel(int w, int h)
ComponentSampleModel with the specified
width and height. The new SampleModel will have the same
number of bands, storage data type, interleaving scheme, and
pixel stride as this SampleModel.
createCompatibleSampleModel

in class SampleModel

w - the width of the resulting SampleModelh - the height of the resulting SampleModel
ComponentSampleModel with the specified size
IllegalArgumentException

- if w or
h is not greater than 0

public SampleModel![]()