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.


Constructor Index

 o MultiBandPackedSampleModel(int, int, int, int, int[])
Constructs a MultiBandPackedSampleModel with bitMasks.length bands and a scanline stride equal to scanlineStride data array elements.
 o MultiBandPackedSampleModel(int, int, int, int[])
Constructs a MultiBandPackedSampleModel with bitMasks.length bands.

Method Index

 o createCompatibleDataBuffer()
Creates a DataBuffer that corresponds to this MultiBandPackedSampleModel.
 o createCompatibleDataBuffer(int, int)
Creates a DataBuffer that corresponds to this MultiBandPackedSampleModel, with a different width and height.
 o createCompatibleSampleModel(int, int)
This creates a new MultiBandPackedSampleModel with the specified width and height.
 o 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.
 o getBitMasks()
Returns the bit masks for each band.
 o getBitOffsets()
Returns the bit offset into the data array element representing a pixel for each band.
 o getBitSizes()
Returns the size in bits of each band.
 o getNumDataElements()
Returns the number of data elements that are required to store one pixel.
 o getOffset(int, int)
Returns the offset (in data array elements) of pixel (x,y).
 o 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.
 o getPixel(int, int, int[], DataBuffer)
Returns all samples in for the specified pixel in an int array.
 o getPixelBitSize()
Returns the size of a pixel in bits.
 o getPixelData(int, int, Object, DataBuffer)
Returns the pixel data in an array of primitives that can be byte, short or int.
 o getSample(int, int, int, DataBuffer)
Returns as int the sample in a specified band for the pixel located at (x,y).
 o 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.
 o getSampleSize()
Returns the size in bits of samples for all bands.
 o getSampleSize(int)
Returns the size in bits of samples for the specified band.
 o getScanlineStride()
Returns the scanline stride of this MultiBandPackedSampleModel.
 o getTransferType()
Returns the transfer type of the data
 o 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.
 o setPixel(int, int, int[], DataBuffer)
Sets a pixel in the DataBuffer using an int array of samples for input.
 o 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.
 o 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.
 o 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.

Constructors

 o 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.
 o 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.

Methods

 o 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
 o createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w,
                                               int h)
This creates a new MultiBandPackedSampleModel with the specified width and height.

Overrides:
createCompatibleSampleModel in class SampleModel
 o 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
 o 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
 o getPixelBitSize
public int getPixelBitSize()
Returns the size of a pixel in bits.

 o getSampleSize
public int[] getSampleSize()
Returns the size in bits of samples for all bands.

Overrides:
getSampleSize in class SampleModel
 o getSampleSize
public int getSampleSize(int band)
Returns the size in bits of samples for the specified band.

Overrides:
getSampleSize in class SampleModel
 o 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));
 

 o getBitOffsets
public int[] getBitOffsets()
Returns the bit offset into the data array element representing a pixel for each band.

 o getBitSizes
public int[] getBitSizes()
Returns the size in bits of each band.

 o getBitMasks
public int[] getBitMasks()
Returns the bit masks for each band.

 o getScanlineStride
public int getScanlineStride()
Returns the scanline stride of this MultiBandPackedSampleModel.

 o getTransferType
public int getTransferType()
Returns the transfer type of the data

Overrides:
getTransferType in class SampleModel
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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