All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.image.BandedSampleModel
java.lang.Object
|
+----java.awt.image.SampleModel
|
+----java.awt.image.BandedSampleModel
- public class BandedSampleModel
- extends SampleModel
This class extends the SampleModel. It provides more efficent
implementations for accessing image data than are provided in
SampleModel. This class will be used when working with images
which store sample data for each band in a different bank of the
DataBuffer. Accessor methods are provided so that image data can be
manipulated directly. Pixelstride is the number of
data array elements between two samples for the same band on the same
scanline. Scanlinestride is the number of data array elements between
a given sample and the sample in the same column of the next scanline.
Bank Index denotes the correspondence between a bank of the data buffer
and a band of image data. The image bands and the DataBuffer banks are
numbered from 0 to n-1.
BandedSampleModel(int, int, int, int)
- Constructs a BandedSampleModel with the specified parameters.
BandedSampleModel(int, int, int, int, int, int, int[])
- Constructs a BandedSampleModel with the specified parameters.
createCompatibleDataBuffer()
- Creates a DataBuffer that corresponds to this BandedSampleModel,
The DataBuffer's width and height will match this BandedSampleModel's.
createCompatibleDataBuffer(int, int)
- Creates a DataBuffer that corresponds to this BandedSampleModel,
with a different width and height.
createCompatibleSampleModel(int, int)
- This creates a new BandedSampleModel with the specified
width and height.
createSubsetSampleModel(int, int, int[])
- This creates a new SampleModel with the specified
width and height and with a subset of the bands of this
SampleModel.
getBankIndices()
- Returns the bank indices for all bands.
getNumDataElements()
- Returns the number of data elements required to store
one pixel.
getOffset(int, int)
- Gets offset of the first band of pixel (x,y).
getPixel(int, int, int, int, int[], DataBuffer)
- Returns all samples for the specified rectangle of pixels in
an int array, one sample per data array element.
getPixel(int, int, int[], DataBuffer)
- Returns all samples for the specified pixel in an int array.
getPixelData(int, int, Object, DataBuffer)
- Returns the pixel data in an array of primitives that can be byte,
short or int.
getPixelStride()
- Returns the pixel stride of this BandedSampleModel.
getSample(int, int, int, DataBuffer)
- Returns as int the sample in a specified band for the pixel
located at (x,y).
getSample(int, int, int, int, int, int[], DataBuffer)
- Returns the samples in a specified band for the specified rectangle
of pixels in an int array, one sample per data array element.
getSampleSize()
- Returns the size in bits of samples for all bands.
getSampleSize(int)
- Returns the size in bits of samples for the specified band.
getScanlineStride()
- Returns the scanline stride of this BandedSampleModel.
getTransferType()
- Returns the transfer type of the underlying data.
setPixel(int, int, int, int, int[], DataBuffer)
- Sets all samples for a rectangle of pixels from an int array containing
one sample per array element.
setPixel(int, int, int[], DataBuffer)
- Sets a pixel in the DataBuffer using an int array of samples for input.
setPixelData(int, int, Object, DataBuffer)
- Puts the pixel data from an Object that contains an
array of primitives that can be byte,
short or int.
setSample(int, int, int, int, DataBuffer)
- Sets a sample in the specified band for the pixel located at (x,y)
in the DataBuffer using an int for input.
setSample(int, int, int, int, int, int[], DataBuffer)
- Sets the samples in the specified band for the specified rectangle
of pixels from an int array containing one sample per data array element.
BandedSampleModel
public BandedSampleModel(int dataType,
int w,
int h,
int numBands)
- Constructs a BandedSampleModel with the specified parameters.
The number of bands will be given by the length of the bandOffsets array.
- Parameters:
- dataType - The data type for storing samples.
- w - The width (in pixels) of the region of
image data described.
- h - The height (in pixels) of the region of image
data described.
- numBands - The number of bands for the region of image data
described.
BandedSampleModel
public BandedSampleModel(int dataType,
int w,
int h,
int numBands,
int scanlineStride,
int pixelStride,
int[] bankIndices)
- Constructs a BandedSampleModel with the specified parameters.
- Parameters:
- dataType - The data type for storing samples.
- w - The width (in pixels) of the region of
image data described.
- h - The height (in pixels) of the region of
image data described.
- numBands - The number of bands for the region of image data
described.
- scanlineStride - The line stride of the region of the
image data described.
- pixelStride - The pixel stride of the region of image
data described.
- bankIndices - The bank index for each band.
createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w,
int h)
- This creates a new BandedSampleModel with the specified
width and height. As much as possible the 'style' of the
current BandedSampleModel will be preserved.
- Overrides:
- createCompatibleSampleModel in class SampleModel
createSubsetSampleModel
public SampleModel createSubsetSampleModel(int w,
int h,
int[] bands)
- This creates a new SampleModel with the specified
width and height and with a subset of the bands of this
SampleModel. Here there will be no explicit check made to ensure that
the subset bands asked for actually exist in the parent.
- Overrides:
- createSubsetSampleModel in class SampleModel
createCompatibleDataBuffer
public DataBuffer createCompatibleDataBuffer()
- Creates a DataBuffer that corresponds to this BandedSampleModel,
The DataBuffer's width and height will match this BandedSampleModel's.
- Overrides:
- createCompatibleDataBuffer in class SampleModel
createCompatibleDataBuffer
public DataBuffer createCompatibleDataBuffer(int desiredWidth,
int desiredHeight)
- Creates a DataBuffer that corresponds to this BandedSampleModel,
with a different width and height.
- Overrides:
- createCompatibleDataBuffer in class SampleModel
getOffset
public long getOffset(int x,
int y)
- Gets offset of the first band of pixel (x,y).
A sample of the first band can be retrieved from a dataBuffer
data with a BandedSampleModel bsm as
data.getElem(bsm.getOffset(x, y));
getSampleSize
public int[] getSampleSize()
- Returns the size in bits of samples for all bands.
- Overrides:
- getSampleSize in class SampleModel
getSampleSize
public int getSampleSize(int band)
- Returns the size in bits of samples for the specified band.
- Overrides:
- getSampleSize in class SampleModel
getBankIndices
public int[] getBankIndices()
- Returns the bank indices for all bands.
getScanlineStride
public int getScanlineStride()
- Returns the scanline stride of this BandedSampleModel.
getPixelStride
public int getPixelStride()
- Returns the pixel stride of this BandedSampleModel.
getNumDataElements
public int getNumDataElements()
- Returns the number of data elements required to store
one pixel. For a BandedSampleModel, this is identical to the
number of bands.
- Overrides:
- getNumDataElements in class SampleModel
getTransferType
public int getTransferType()
- Returns the transfer type of the underlying data. For a
ComponentSampleModel, this is identical to the dataType.
- Overrides:
- getTransferType in class SampleModel
getPixelData
public Object getPixelData(int x,
int y,
Object obj,
DataBuffer data)
- Returns the pixel data in an array of primitives that can be byte,
short or int. Which primitive type is returned depends on
the transfer type. Data is returned in the packed format,
thus increasing efficiency for data transfers. 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.
BandedSampleModel bsm1, bsm2;
DataBufferInt db1, db2;
bsm2.setPixelData(x, y, bsm1.getPixelData(x, y, null, db1), db2);
- Parameters:
- x - The X coordinate of the pixel location.
- y - The Y coordinate of the pixel location.
- obj - If non-null, returns the primitive array in this object.
- data - The DataBuffer containing the image data.
- Overrides:
- getPixelData in class SampleModel
getPixel
public int[] getPixel(int x,
int y,
int[] iArray,
DataBuffer data)
- Returns all samples for the specified pixel in an int array.
- Parameters:
- x - The X coordinate of the pixel location.
- y - The Y coordinate of the pixel location.
- iArray - If non-null, returns the samples in this array.
- data - The DataBuffer containing the image data.
- Overrides:
- getPixel in class SampleModel
getPixel
public int[] getPixel(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
- Returns all samples for the specified rectangle of pixels in
an int array, one sample per data array element.
- Parameters:
- x - The X coordinate of the upper left pixel location.
- y - The Y coordinate of the upper left pixel location.
- w - The width of the pixel rectangle.
- h - The height of the pixel rectangle.
- iArray - If non-null, returns the samples in this array.
- data - The DataBuffer containing the image data.
- Overrides:
- getPixel in class SampleModel
getSample
public int getSample(int x,
int y,
int b,
DataBuffer data)
- Returns as int the sample in a specified band for the pixel
located at (x,y).
- Parameters:
- x - The X coordinate of the pixel location.
- y - The Y coordinate of the pixel location.
- b - The band to return.
- data - The DataBuffer containing the image data.
- Overrides:
- getSample in class SampleModel
getSample
public int[] getSample(int x,
int y,
int w,
int h,
int b,
int[] iArray,
DataBuffer data)
- Returns the samples in a specified band for the specified rectangle
of pixels in an int array, one sample per data array element.
- Parameters:
- x - The X coordinate of the upper left pixel location.
- y - The Y coordinate of the upper left pixel location.
- w - The width of the pixel rectangle.
- h - The height of the pixel rectangle.
- b - The band to return.
- iArray - If non-null, returns the samples in this array.
- data - The DataBuffer containing the image data.
- Overrides:
- getSample in class SampleModel
setPixelData
public void setPixelData(int x,
int y,
Object obj,
DataBuffer data)
- Puts the pixel data from an Object that contains an
array of primitives that can be byte,
short or int. Which primitive type it contains depends on
the transfer type. Data in the Object is in the packed format,
thus increasing efficiency for data transfers.
BandedSampleModel bsm1, bsm2;
DataBufferInt db1, db2;
bsm2.setPixelData(x, y, bsm1.getPixelData(x, y, null, db1), db2);
- Parameters:
- x - The X coordinate of the pixel location.
- y - The Y coordinate of the pixel location.
- obj - If non-null, returns the primitive array in this object.
- data - The DataBuffer containing the image data.
- Overrides:
- setPixelData in class SampleModel
setPixel
public void setPixel(int x,
int y,
int[] iArray,
DataBuffer data)
- Sets a pixel in the DataBuffer using an int array of samples for input.
- Parameters:
- x - The X coordinate of the pixel location.
- y - The Y coordinate of the pixel location.
- iArray - The input samples in an int array.
- data - The DataBuffer containing the image data.
- Overrides:
- setPixel in class SampleModel
setPixel
public void setPixel(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
- Sets all samples for a rectangle of pixels from an int array containing
one sample per array element.
- Parameters:
- x - The X coordinate of the upper left pixel location.
- y - The Y coordinate of the upper left pixel location.
- w - The width of the pixel rectangle.
- h - The height of the pixel rectangle.
- iArray - The input samples in an int array.
- data - The DataBuffer containing the image data.
- Overrides:
- setPixel in class SampleModel
setSample
public void setSample(int x,
int y,
int b,
int s,
DataBuffer data)
- Sets a sample in the specified band for the pixel located at (x,y)
in the DataBuffer using an int for input.
- Parameters:
- x - The X coordinate of the pixel location.
- y - The Y coordinate of the pixel location.
- b - The band to set.
- s - The input sample as an int.
- data - The DataBuffer containing the image data.
- Overrides:
- setSample in class SampleModel
setSample
public void setSample(int x,
int y,
int w,
int h,
int b,
int[] iArray,
DataBuffer data)
- Sets the samples in the specified band for the specified rectangle
of pixels from an int array containing one sample per data array element.
- Parameters:
- x - The X coordinate of the upper left pixel location.
- y - The Y coordinate of the upper left pixel location.
- w - The width of the pixel rectangle.
- h - The height of the pixel rectangle.
- b - The band to set.
- iArray - The input sample array.
- data - The DataBuffer containing the image data.
- Overrides:
- setSample in class SampleModel
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature