Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.image.MultiPixelPackedSampleModel

java.lang.Object
    |
    +----java.awt.image.SampleModel
            |
            +----java.awt.image.MultiPixelPackedSampleModel

public class MultiPixelPackedSampleModel
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.


Fields inherited from class java.awt.image.SampleModel
 dataType, height, numBands, width
 

Constructor Summary
 MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits)
Constructs a MultiPixelPackedSampleModel with the given data type, width, height and number of bits per pixel.
 MultiPixelPackedSampleModel(int dataType, int w, int h, int pixelBitStride, int scanlineStride, int dataBitOffset)
Constructs a MultiPixelPackedSampleModel with given data type, width, height, number of bits per pixel, scanline stride and data bit offset.
 

Method Summary
DataBuffer  createCompatibleDataBuffer()
Creates a DataBuffer of the correct type big enough to hold all pixels described by this MultiPixelPackedSampleModel.
DataBuffer  createCompatibleDataBuffer(int desiredWidth, int desiredHeight)
Creates a DataBuffer of the correct type big enough to hold all pixels described by this MultiPixelPackedSampleModel with the desired height and width.
SampleModel  createCompatibleSampleModel(int w, int h)
Creates a new SinglePackedSampleModel with the requested width and height.
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.
int  getBitOffset(int x)
Returns offset in bits of the xth pixel of a scanline into the data element in which it's stored.
int  getDataBitOffset()
Returns the data bit offset in bits.
int  getNumDataElements()
Returns the number of data elements required to store one pixel.
long  getOffset(int x, int y)
Returns the offset (in data array elements) of pixel (x,y).
int[]  getPixel(int x, int y, int[] iArray, DataBuffer data)
Returns the requested pixel as an int.
int  getPixelBitSize()
Returns the size of a pixel in bits.
int  getPixelBitStride()
Returns the pixel bit stride in bits.
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.
int  getSample(int x, int y, int b, DataBuffer data)
Returns the sample in a specified band for a pixel as an int.
int[]  getSampleSize()
Returns the size of all bands in bits.
int  getSampleSize(int band)
Returns the size of the requested bands in bits.
int  getScanlineStride()
Returns the scanline stride.
int  getTransferType()
Returns the tranfer type of the data
void  setPixel(int x, int y, int[] iArray, DataBuffer data)
Sets a pixel in the DataBuffer using an int for input.
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.
void  setSample(int x, int y, int b, int s, DataBuffer data)
Sets a sample in the DataBuffer using an int for input.
 
Methods inherited from class java.awt.image.SampleModel
 createCompatibleDataBuffer, createCompatibleDataBuffer, createCompatibleSampleModel, createSubsetSampleModel, getDataType, getHeight, getMaxSampleValue, getMaxSampleValue, getMinSampleValue, getMinSampleValue, getNumBands, getNumDataElements, getPixel, getPixel, getPixel, getPixel, getPixel, getPixel, getPixelData, getPixelData, getSample, getSample, getSample, getSample, getSampleDouble, getSampleFloat, getSampleSize, getSampleSize, getTransferType, getWidth, setPixel, setPixel, setPixel, setPixel, setPixel, setPixel, setPixelData, setSample, setSample, setSample, setSample, setSample, setSample
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPixelPackedSampleModel

public MultiPixelPackedSampleModel(int dataType,
                                   int w,
                                   int h,
                                   int numberOfBits)
Constructs a MultiPixelPackedSampleModel 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.

MultiPixelPackedSampleModel

public MultiPixelPackedSampleModel(int dataType,
                                   int w,
                                   int h,
                                   int pixelBitStride,
                                   int scanlineStride,
                                   int dataBitOffset)
Constructs a MultiPixelPackedSampleModel 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.
Method Detail

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 MultiPixelPackedSampleModel.
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 MultiPixelPackedSampleModel 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.
 	     MultiPixelPackedSampleModel mppsm1, mppsm2;
	     DataBufferInt db1, db2;
 	     mppsm2.setPixelData(x, y, mppsm1.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.
 	     MultiPixelPackedSampleModel mppsm1, mppsm2;
	     DataBufferInt db1, db2;
 	     mppsm2.setPixelData(x, y, mppsm1.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

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.