|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.image.SampleModel
java.awt.image.MultiPixelPackedSampleModel
public class MultiPixelPackedSampleModel
MultiPixelPackedSampleModel provides a single band model that supports multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit per data element.
Field Summary |
---|
Fields inherited from class java.awt.image.SampleModel |
---|
dataType, height, numBands, width |
Constructor Summary | |
---|---|
MultiPixelPackedSampleModel(int dataType,
int w,
int h,
int numberOfBits)
Creates a new MultiPixelPackedSampleModel with the specified
data type, which should be one of:
DataBuffer.TYPE_BYTE ;
DataBuffer.TYPE_USHORT ;
DataBuffer.TYPE_INT ;
|
|
MultiPixelPackedSampleModel(int dataType,
int w,
int h,
int numberOfBits,
int scanlineStride,
int dataBitOffset)
Creates a new MultiPixelPackedSampleModel with the specified
data type, which should be one of:
DataBuffer.TYPE_BYTE ;
DataBuffer.TYPE_USHORT ;
DataBuffer.TYPE_INT ;
|
Method Summary | |
---|---|
SampleModel |
createCompatibleSampleModel(int w,
int h)
Creates a new MultiPixelPackedSample model with the same
data type and bits per pixel as this model, but with the specified
dimensions. |
DataBuffer |
createDataBuffer()
Creates a DataBuffer for holding pixel data in the format and layout described by this SampleModel. |
SampleModel |
createSubsetSampleModel(int[] bands)
Normally this method returns a sample model for accessing a subset of bands of image data, but since MultiPixelPackedSampleModel
only supports a single band, this overridden implementation just returns
a new instance of MultiPixelPackedSampleModel , with the same
attributes as this instance. |
boolean |
equals(Object obj)
Tests this sample model for equality with an arbitrary object. |
int |
getBitOffset(int x)
The bit offset (within an element in the data buffer) of the pixels with the specified x-coordinate. |
int |
getDataBitOffset()
Returns the offset to the first data bit. |
Object |
getDataElements(int x,
int y,
Object obj,
DataBuffer data)
Extract one pixel and return in an array of transfer type. |
int |
getNumDataElements()
Returns the number of data elements required to transfer a pixel in the get/setDataElements() methods. |
int |
getOffset(int x,
int y)
Returns the index in the data buffer that stores the pixel at (x, y). |
int[] |
getPixel(int x,
int y,
int[] iArray,
DataBuffer data)
Returns an array (of length 1) containing the sample for the pixel at (x, y) in the specified data buffer. |
int |
getPixelBitStride()
Returns the number of bits per pixel. |
int |
getSample(int x,
int y,
int b,
DataBuffer data)
Returns the sample value for the pixel at (x, y) in the specified data buffer. |
int[] |
getSampleSize()
Returns an array containing the size (in bits) of the samples in each band. |
int |
getSampleSize(int band)
Returns the size of the samples in the specified band. |
int |
getScanlineStride()
Returns the number of data elements from a pixel in one row to the corresponding pixel in the next row. |
int |
getTransferType()
Returns the transfer type, which is one of the following (depending on the number of bits per sample for this model): DataBuffer.TYPE_BYTE ;
DataBuffer.TYPE_USHORT ;
DataBuffer.TYPE_INT ;
|
int |
hashCode()
Returns a hash code for this MultiPixelPackedSampleModel . |
void |
setDataElements(int x,
int y,
Object obj,
DataBuffer data)
Set the pixel at x, y to the value in the first element of the primitive array obj. |
void |
setPixel(int x,
int y,
int[] iArray,
DataBuffer data)
Sets the sample value for the pixel at (x, y) in the specified data buffer to the specified value. |
void |
setSample(int x,
int y,
int b,
int s,
DataBuffer data)
Sets the sample value for a band for the pixel at (x, y) in the specified data buffer. |
String |
toString()
Creates a String with some information about this SampleModel. |
Methods inherited from class java.awt.image.SampleModel |
---|
getDataElements, getDataType, getHeight, getNumBands, getPixel, getPixel, getPixels, getPixels, getPixels, getSampleDouble, getSampleFloat, getSamples, getSamples, getSamples, getWidth, setDataElements, setPixel, setPixel, setPixels, setPixels, setPixels, setSample, setSample, setSamples, setSamples, setSamples |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits)
MultiPixelPackedSampleModel
with the specified
data type, which should be one of:
dataType
- the data type.w
- the width (in pixels).h
- the height (in pixels).numberOfBits
- the number of bits per pixel (must be a power of 2).public MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits, int scanlineStride, int dataBitOffset)
MultiPixelPackedSampleModel
with the specified
data type, which should be one of:
dataType
- the data type.w
- the width (in pixels).h
- the height (in pixels).numberOfBits
- the number of bits per pixel (must be a power of 2).scanlineStride
- the number of data elements from a pixel on one
row to the corresponding pixel in the next row.dataBitOffset
- the offset to the first data bit.Method Detail |
---|
public SampleModel createCompatibleSampleModel(int w, int h)
MultiPixelPackedSample
model with the same
data type and bits per pixel as this model, but with the specified
dimensions.
createCompatibleSampleModel
in class SampleModel
w
- the width (in pixels).h
- the height (in pixels).
public DataBuffer createDataBuffer()
createDataBuffer
in class SampleModel
public int getNumDataElements()
getNumDataElements
in class SampleModel
1
.public int[] getSampleSize()
MultiPixelPackedSampleModel
class supports only
one band, so this method returns an array with length 1
.
getSampleSize
in class SampleModel
getSampleSize(int)
public int getSampleSize(int band)
MultiPixelPackedSampleModel
supports only one band -- this
method ignored the band
argument, and always returns the size
of band zero.
getSampleSize
in class SampleModel
band
- the band (this parameter is ignored).
getSampleSize()
public int getOffset(int x, int y)
x
- the x-coordinate.y
- the y-coordinate.
getBitOffset(int)
public int getBitOffset(int x)
x
- the x-coordinate.
public int getDataBitOffset()
public int getScanlineStride()
public int getPixelBitStride()
public int getTransferType()
getTransferType
in class SampleModel
public SampleModel createSubsetSampleModel(int[] bands)
MultiPixelPackedSampleModel
only supports a single band, this overridden implementation just returns
a new instance of MultiPixelPackedSampleModel
, with the same
attributes as this instance.
createSubsetSampleModel
in class SampleModel
bands
- the bands to include in the subset (this is ignored, except
that if it is non-null
a check is made to ensure that the
array length is equal to 1
).
RasterFormatException
- if bands
is not
null
and bands.length != 1
.public Object getDataElements(int x, int y, Object obj, DataBuffer data)
getDataElements
in class SampleModel
x
- The x-coordinate of the pixel rectangle to store in
obj
.y
- The y-coordinate of the pixel rectangle to store in
obj
.obj
- The primitive array to store the pixels into or null to force
creation.data
- The DataBuffer that is the source of the pixel data.
SampleModel.getDataElements(int, int, Object,
DataBuffer)
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
iArray
is not
null
, it will be populated with the sample value and
returned as the result of this function (this avoids allocating a new
array instance).
getPixel
in class SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.iArray
- an array to populate with the sample values and return as
the result (if null
, a new array will be allocated).data
- the data buffer (null
not permitted).
NullPointerException
- if data
is null
.public int getSample(int x, int y, int b, DataBuffer data)
getSample
in class SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range 0
to
getNumBands() - 1
).data
- the data buffer (null
not permitted).
NullPointerException
- if data
is null
.public void setDataElements(int x, int y, Object obj, DataBuffer data)
setDataElements
in class SampleModel
x
- The x-coordinate of the data elements in obj
.y
- The y-coordinate of the data elements in obj
.obj
- The primitive array containing the data elements to set.data
- The DataBuffer to store the data elements into.public void setPixel(int x, int y, int[] iArray, DataBuffer data)
setPixel
in class SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.iArray
- the sample value (null
not permitted).data
- the data buffer (null
not permitted).
NullPointerException
- if either iArray
or
data
is null
.setSample(int, int, int, int, DataBuffer)
public void setSample(int x, int y, int b, int s, DataBuffer data)
setSample
in class SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range 0
to
getNumBands() - 1
).s
- the sample value.data
- the data buffer (null
not permitted).
NullPointerException
- if data
is null
.public boolean equals(Object obj)
true
if and only if:
obj
is not null
;
obj
is an instance of
MultiPixelPackedSampleModel
;
dataType
;
width
;
height
;
numberOfBits
;
scanlineStride
;
dataBitOffsets
.
equals
in class Object
obj
- the object (null
permitted)
true
if this model is equal to obj
, and
false
otherwise.Object.hashCode()
public int hashCode()
MultiPixelPackedSampleModel
.
hashCode
in class Object
Object.equals(Object)
,
System.identityHashCode(Object)
public String toString()
toString
in class Object
Object.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |