All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.image.SingleBandPackedSampleModel
java.lang.Object
|
+----java.awt.image.SampleModel
|
+----java.awt.image.SingleBandPackedSampleModel
- public class SingleBandPackedSampleModel
- extends SampleModel
This class extends SampleModel. It only stores one-banded images,
but it can pack multiple one-sample pixels into one data element.
Note that pixels are not allowed to span data element. In addition,
each pixel must be a power of 2 number of bits and a power of 2
number of pixels must fit exactly in one data element. Pixel bit stride
is equal to the number of bits per pixel. Scanline stride is in
data elements so the last data element may be padded with unused pixels.
Data bit offset must be a multiple of pixel bit stride.
SingleBandPackedSampleModel(int, int, int, int)
- Constructs a SingleBandPackedSampleModel with the given data type,
width, height and number of bits per pixel.
SingleBandPackedSampleModel(int, int, int, int, int, int)
- Constructs a SingleBandPackedSampleModel with given data type, width,
height, number of bits per pixel, scanline stride and data bit
offset.
createCompatibleDataBuffer()
- Creates a DataBuffer of the correct type big enough to hold all
pixels described by this SingleBandPackedSampleModel.
createCompatibleDataBuffer(int, int)
- Creates a DataBuffer of the correct type big enough to hold all
pixels described by this SingleBandPackedSampleModel with
the desired height and width.
createCompatibleSampleModel(int, int)
- Creates a new SinglePackedSampleModel with the requested
width and height.
createSubsetSampleModel(int, int, int[])
- This creates a new SampleModel with the requested physical
width and height and with a subset of the components of this
SampleModel.
getBitOffset(int)
- Returns offset in bits of the xth pixel of a scanline into the
data element in which it's stored.
getDataBitOffset()
- Returns the data bit offset in bits.
getNumDataElements()
- Returns the number of data elements required to store one pixel.
getOffset(int, int)
- Returns the offset (in data array elements) of pixel (x,y).
getPixel(int, int, int[], DataBuffer)
- Returns the requested pixel as an int.
getPixelBitSize()
- Returns the size of a pixel in bits.
getPixelBitStride()
- Returns the pixel bit stride 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 the sample in a specified band for a pixel as an int.
getSampleSize()
- Returns the size of all bands in bits.
getSampleSize(int)
- Returns the size of the requested bands in bits.
getScanlineStride()
- Returns the scanline stride.
getTransferType()
- Returns the tranfer type of the data
setPixel(int, int, int[], DataBuffer)
- Sets a pixel in the DataBuffer using an int 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 DataBuffer using an int for input.
SingleBandPackedSampleModel
public SingleBandPackedSampleModel(int dataType,
int w,
int h,
int numberOfBits)
- Constructs a SingleBandPackedSampleModel with the given data type,
width, height and number of bits per pixel.
- 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.
- numofBits - The pixelBitStride for the region of image data
described.
SingleBandPackedSampleModel
public SingleBandPackedSampleModel(int dataType,
int w,
int h,
int pixelBitStride,
int scanlineStride,
int dataBitOffset)
- Constructs a SingleBandPackedSampleModel with given data type, width,
height, number of bits per pixel, scanline stride and data bit
offset.
- 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.
- pixelBitStride - The pixelBitStride of the region of image data
described.
- scanlineStride - The line stride of the region of the
image data described.
- dataBitOffset - The data bit offset for the region of image
data described.
createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w,
int h)
- Creates a new SinglePackedSampleModel with the requested
width and height.
- Overrides:
- createCompatibleSampleModel in class SampleModel
createCompatibleDataBuffer
public DataBuffer createCompatibleDataBuffer()
- Creates a DataBuffer of the correct type big enough to hold all
pixels described by this SingleBandPackedSampleModel.
- Overrides:
- createCompatibleDataBuffer in class SampleModel
createCompatibleDataBuffer
public DataBuffer createCompatibleDataBuffer(int desiredWidth,
int desiredHeight)
- Creates a DataBuffer of the correct type big enough to hold all
pixels described by this SingleBandPackedSampleModel with
the desired height and width.
- Overrides:
- createCompatibleDataBuffer in class SampleModel
getPixelBitSize
public int getPixelBitSize()
- Returns the size of a pixel in bits. This is equal to the
pixel bit stride.
getNumDataElements
public int getNumDataElements()
- Returns the number of data elements required to store one pixel.
- Overrides:
- getNumDataElements in class SampleModel
getSampleSize
public int[] getSampleSize()
- Returns the size of all bands in bits.
- Overrides:
- getSampleSize in class SampleModel
getSampleSize
public int getSampleSize(int band)
- Returns the size of the requested bands in bits.
- Overrides:
- getSampleSize in class SampleModel
getOffset
public long getOffset(int x,
int y)
- Returns the offset (in data array elements) of pixel (x,y).
getBitOffset
public int getBitOffset(int x)
- Returns offset in bits of the xth pixel of a scanline into the
data element in which it's stored.
getScanlineStride
public int getScanlineStride()
- Returns the scanline stride.
getPixelBitStride
public int getPixelBitStride()
- Returns the pixel bit stride in bits. Same as pixel bit size.
getDataBitOffset
public int getDataBitOffset()
- Returns the data bit offset in bits.
getTransferType
public int getTransferType()
- Returns the tranfer type of the data
- Overrides:
- getTransferType in class SampleModel
createSubsetSampleModel
public SampleModel createSubsetSampleModel(int w,
int h,
int[] bands)
- This creates a new SampleModel with the requested physical
width and height and with a subset of the components of this
SampleModel.
- Overrides:
- createSubsetSampleModel in class SampleModel
getSample
public int getSample(int x,
int y,
int b,
DataBuffer data)
- Returns the sample in a specified band for a pixel as an int.
- Parameters:
- x - The X coordinate of the pixel location
- y - The Y coordinate of the pixel location
- b - The band to return (assumed to be 0)
- data - The DataBuffer where image data is stored.
- Overrides:
- getSample in class SampleModel
setSample
public void setSample(int x,
int y,
int b,
int s,
DataBuffer data)
- Sets a sample 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 return (assumed to be 0)
- s - The input sample as an int
- data - The DataBuffer where image data is stored
- Overrides:
- setSample 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.
SingleBandPackedSampleModel spsm1, spsm2;
DataBufferInt db1, db2;
spsm2.setPixelData(x, y, spsm1.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 the requested pixel as an int.
- Parameters:
- x - The X coordinate of the pixel location.
- y - The Y coordinate of the pixel location.
- data - The DataBuffer where image data is stored.
- Overrides:
- getPixel 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.
SingleBandPackedSampleModel spsm1, spsm2;
DataBufferInt db1, db2;
spsm2.setPixelData(x, y, spsm1.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 for input.
- Parameters:
- x - The X coordinate of the pixel location
- y - The Y coordinate of the pixel location
- s - The input sample as an int
- data - The DataBuffer where image data is stored
- Overrides:
- setPixel in class SampleModel
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature