All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.image.MultiBandPackedSampleModel
java.lang.Object
|
+----java.awt.image.SampleModel
|
+----java.awt.image.MultiBandPackedSampleModel
- public class MultiBandPackedSampleModel
- extends SampleModel
This class extends SampleModel. It stores the N samples which make
up a pixel in 1 data array element. All data array elements reside
in the first bank of a DataBuffer. Accessor methods are provided so
that the image data can be manipulated directly. Scanlinestride is the
number of data array elements between a given sample and the sample in
the same column of the next scanline. Bit Masks are the masks required
to extract the samples representing the bands of the pixel.
MultiBandPackedSampleModel(int, int, int, int, int[])
- Constructs a MultiBandPackedSampleModel with bitMasks.length bands
and a scanline stride equal to scanlineStride data array elements.
MultiBandPackedSampleModel(int, int, int, int[])
- Constructs a MultiBandPackedSampleModel with bitMasks.length bands.
createCompatibleDataBuffer()
- Creates a DataBuffer that corresponds to this MultiBandPackedSampleModel.
createCompatibleDataBuffer(int, int)
- Creates a DataBuffer that corresponds to this MultiBandPackedSampleModel,
with a different width and height.
createCompatibleSampleModel(int, int)
- This creates a new MultiBandPackedSampleModel with the specified
width and height.
createSubsetSampleModel(int, int, int[])
- This creates a new MultiBandPackedSampleModel with the specified
width and height and with a subset of the bands of this
MultiBandPackedSampleModel.
getBitMasks()
- Returns the bit masks for each band.
getBitOffsets()
- Returns the bit offset into the data array element representing
a pixel for each band.
getBitSizes()
- Returns the size in bits of each band.
getNumDataElements()
- Returns the number of data elements that are required to store
one pixel.
getOffset(int, int)
- Returns the offset (in data array elements) 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 array element.
getPixel(int, int, int[], DataBuffer)
- Returns all samples in for the specified pixel in an int array.
getPixelBitSize()
- Returns the size of a pixel in bits.
getPixelData(int, int, Object, DataBuffer)
- Returns the pixel data in an array of primitives that can be byte,
short or int.
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 MultiBandPackedSampleModel.
getTransferType()
- Returns the transfer type of the data
setPixel(int, int, int, int, int[], DataBuffer)
- Sets all samples for a rectangle of pixels from an int array containing
one sample per data 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.
MultiBandPackedSampleModel
public MultiBandPackedSampleModel(int dataType,
int w,
int h,
int[] bitMasks)
- Constructs a MultiBandPackedSampleModel with bitMasks.length bands.
Each sample is stored in a data array element in the position of
its corresponding bit mask. Bit masks should be contiguous and
should not overlap.
- Parameters:
- dataType - The data type for storing samples.
- w - The width (in pixels) of the region of the
image data described.
- h - The height (in pixels) of the region of the
image data described.
- bitMasks - The bit masks for various bands.
MultiBandPackedSampleModel
public MultiBandPackedSampleModel(int dataType,
int w,
int h,
int scanlineStride,
int[] bitMasks)
- Constructs a MultiBandPackedSampleModel with bitMasks.length bands
and a scanline stride equal to scanlineStride data array elements.
Each sample is stored in a data array element in the position of
its corresponding bit mask. Bit masks should be contiguous and
should not overlap.
- 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.
- scanlineStride - The line stride of the region of image
data described.
- bitMasks - The bit masks for various bands.
getNumDataElements
public int getNumDataElements()
- Returns the number of data elements that are required to store
one pixel. For a MultiBandPackedSampleModel, this is always one.
- Overrides:
- getNumDataElements in class SampleModel
createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w,
int h)
- This creates a new MultiBandPackedSampleModel with the specified
width and height.
- Overrides:
- createCompatibleSampleModel in class SampleModel
createCompatibleDataBuffer
public DataBuffer createCompatibleDataBuffer()
- Creates a DataBuffer that corresponds to this MultiBandPackedSampleModel.
The DataBuffer's width and height will match this
MultiBandPackedSampleModel's.
- Overrides:
- createCompatibleDataBuffer in class SampleModel
createCompatibleDataBuffer
public DataBuffer createCompatibleDataBuffer(int desiredWidth,
int desiredHeight)
- Creates a DataBuffer that corresponds to this MultiBandPackedSampleModel,
with a different width and height.
- Overrides:
- createCompatibleDataBuffer in class SampleModel
getPixelBitSize
public int getPixelBitSize()
- Returns the size of a pixel in bits.
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
getOffset
public long getOffset(int x,
int y)
- Returns the offset (in data array elements) of pixel (x,y).
A sample of the first band can be retrieved from a dataBuffer
data with a MultiBandPackedSampleModel msm as
data.getElem(msm.getOffset(x, y));
getBitOffsets
public int[] getBitOffsets()
- Returns the bit offset into the data array element representing
a pixel for each band.
getBitSizes
public int[] getBitSizes()
- Returns the size in bits of each band.
getBitMasks
public int[] getBitMasks()
- Returns the bit masks for each band.
getScanlineStride
public int getScanlineStride()
- Returns the scanline stride of this MultiBandPackedSampleModel.
getTransferType
public int getTransferType()
- Returns the transfer type of the data
- Overrides:
- getTransferType in class SampleModel
createSubsetSampleModel
public SampleModel createSubsetSampleModel(int w,
int h,
int[] bands)
- This creates a new MultiBandPackedSampleModel with the specified
width and height and with a subset of the bands of this
MultiBandPackedSampleModel.
- Overrides:
- createSubsetSampleModel 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.
MultiBandPackedSampleModel mpsm1, mpsm2;
DataBufferInt db1, db2;
mpsm2.setPixelData(x, y, mpsm1.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 in 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 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.
MultiBandPackedSampleModel mpsm1, mpsm2;
DataBufferInt db1, db2;
mpsm2.setPixelData(x, y, mpsm1.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 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 - 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 samples in an int 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