|
|||||||||
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.ComponentSampleModel
java.awt.image.BandedSampleModel
public final class BandedSampleModel
A sample model that reads each sample value from a separate band in the
DataBuffer
.
Field Summary |
---|
Fields inherited from class java.awt.image.ComponentSampleModel |
---|
bandOffsets, bankIndices, numBands, numBanks, pixelStride, scanlineStride |
Fields inherited from class java.awt.image.SampleModel |
---|
dataType, height, width |
Constructor Summary | |
---|---|
BandedSampleModel(int dataType,
int w,
int h,
int numBands)
Creates a new BandedSampleModel . |
|
BandedSampleModel(int dataType,
int w,
int h,
int scanlineStride,
int[] bankIndices,
int[] bandOffsets)
Creates a new BandedSampleModel . |
Method Summary | |
---|---|
SampleModel |
createCompatibleSampleModel(int w,
int h)
Creates a new SampleModel that is compatible with this
model and has the specified width and height. |
DataBuffer |
createDataBuffer()
Creates a new data buffer that is compatible with this sample model. |
SampleModel |
createSubsetSampleModel(int[] bands)
Creates a new sample model that provides access to a subset of the bands that this sample model supports. |
Object |
getDataElements(int x,
int y,
Object obj,
DataBuffer data)
Extract all samples of one pixel and return in an array of transfer type. |
int[] |
getPixel(int x,
int y,
int[] iArray,
DataBuffer data)
Returns all the samples for the pixel at location (x, y)
stored in the specified data buffer. |
int[] |
getPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
Copy pixels from a region into an array. |
int |
getSample(int x,
int y,
int b,
DataBuffer data)
Returns a sample value for the pixel at (x, y) in the specified data buffer. |
double |
getSampleDouble(int x,
int y,
int b,
DataBuffer data)
Returns the sample value for the pixel at (x, y) in the specified data buffer. |
float |
getSampleFloat(int x,
int y,
int b,
DataBuffer data)
Returns a sample value for the pixel at (x, y) in the specified data buffer. |
int[] |
getSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray,
DataBuffer data)
Copy one band's samples from a region into an array. |
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 samples for the pixel at (x, y) in the specified data buffer to the specified values. |
void |
setPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
Sets the sample values for the pixels in the region specified by (x, y, w, h) in the specified data buffer. |
void |
setSample(int x,
int y,
int b,
double s,
DataBuffer data)
Sets the sample value for a band for the pixel at (x, y) in the specified data buffer. |
void |
setSample(int x,
int y,
int b,
float s,
DataBuffer data)
Sets the sample value for a band for the pixel at (x, y) in the specified data buffer. |
void |
setSample(int x,
int y,
int b,
int s,
DataBuffer data)
Sets the sample value for band b of the pixel at location
(x, y) in the specified data buffer. |
void |
setSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray,
DataBuffer data)
Sets the sample values for one band for the pixels in the region specified by (x, y, w, h) in the specified data buffer. |
String |
toString()
Creates a String with some information about this SampleModel. |
Methods inherited from class java.awt.image.ComponentSampleModel |
---|
equals, getBandOffsets, getBankIndices, getNumDataElements, getOffset, getOffset, getPixelStride, getSampleSize, getSampleSize, getScanlineStride, hashCode |
Methods inherited from class java.awt.image.SampleModel |
---|
getDataElements, getDataType, getHeight, getNumBands, getPixel, getPixel, getPixels, getPixels, getSamples, getSamples, getTransferType, getWidth, setDataElements, setPixel, setPixel, setPixels, setPixels, setSamples, setSamples |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BandedSampleModel(int dataType, int w, int h, int numBands)
BandedSampleModel
.
dataType
- the data buffer type.w
- the width (in pixels).h
- the height (in pixels).numBands
- the number of bands.public BandedSampleModel(int dataType, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets)
BandedSampleModel
.
dataType
- the data buffer type.w
- the width (in pixels).h
- the height (in pixels).scanlineStride
- the number of data elements from a pixel in one
row to the corresponding pixel in the next row.bankIndices
- the bank indices.bandOffsets
- the band offsets.Method Detail |
---|
public DataBuffer createDataBuffer()
createDataBuffer
in class ComponentSampleModel
public SampleModel createCompatibleSampleModel(int w, int h)
SampleModel
that is compatible with this
model and has the specified width and height.
createCompatibleSampleModel
in class ComponentSampleModel
w
- the width (in pixels, must be greater than zero).h
- the height (in pixels, must be greater than zero).
IllegalArgumentException
- if w
or h
is
not greater than zero.
IllegalArgumentException
- if w * h
exceeds
Integer.MAX_VALUE
.public SampleModel createSubsetSampleModel(int[] bands)
ComponentSampleModel
createSubsetSampleModel
in class ComponentSampleModel
bands
- the bands (null
not permitted).
public Object getDataElements(int x, int y, Object obj, DataBuffer data)
getDataElements
in class ComponentSampleModel
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,
java.lang.Object, java.awt.image.DataBuffer)
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
(x, y)
stored in the specified data buffer.
getPixel
in class ComponentSampleModel
x
- the x-coordinate.y
- the y-coordinate.iArray
- an array that will be populated with the sample values and
returned as the result. The size of this array should be equal to the
number of bands in the model. If the array is null
, a new
array is created.data
- the data buffer (null
not permitted).
setPixel(int, int, int[], DataBuffer)
public int[] getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
getPixels
in class ComponentSampleModel
x
- The x-coordinate of the pixel rectangle to store in
iArray
.y
- The y-coordinate of the pixel rectangle to store in
iArray
.w
- The width in pixels of the rectangle.h
- The height in pixels of the rectangle.iArray
- The int array to store the pixels into or null to force
creation.data
- The DataBuffer that is the source of the pixel data.
public int getSample(int x, int y, int b, DataBuffer data)
getSample
in class ComponentSampleModel
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
.ComponentSampleModel.setSample(int, int, int, int, DataBuffer)
public float getSampleFloat(int x, int y, int b, DataBuffer data)
getSampleFloat
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
.getSample(int, int, int, DataBuffer)
public double getSampleDouble(int x, int y, int b, DataBuffer data)
getSampleDouble
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
.getSample(int, int, int, DataBuffer)
public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
getSamples
in class SampleModel
x
- The x-coordinate of the pixel rectangle to store in
iArray
.y
- The y-coordinate of the pixel rectangle to store in
iArray
.w
- The width in pixels of the rectangle.h
- The height in pixels of the rectangle.b
- The band to retrieve.iArray
- The int array to store the pixels into or null to force
creation.data
- The DataBuffer that is the source of the pixel data.
public void setDataElements(int x, int y, Object obj, DataBuffer data)
setDataElements
in class ComponentSampleModel
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.SampleModel.setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
setPixel
in class ComponentSampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.iArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
NullPointerException
- if either iArray
or
data
is null
.ComponentSampleModel.getPixel(int, int, int[], DataBuffer)
public void setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
setPixels
in class SampleModel
x
- the x-coordinate of the top-left pixel.y
- the y-coordinate of the top-left pixel.w
- the width of the region of pixels.h
- the height of the region of pixels.iArray
- the pixel sample values (null
not permitted).data
- the data buffer (null
not permitted).
NullPointerException
- if either iArray
or
data
is null
.public void setSample(int x, int y, int b, int s, DataBuffer data)
b
of the pixel at location
(x, y)
in the specified data buffer.
setSample
in class ComponentSampleModel
x
- the x-coordinate.y
- the y-coordinate.b
- the band index.s
- the sample value.data
- the data buffer (null
not permitted).getSample(int, int, int, DataBuffer)
public void setSample(int x, int y, int b, float 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 void setSample(int x, int y, int b, double 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 void setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
setSamples
in class SampleModel
x
- the x-coordinate of the top-left pixel.y
- the y-coordinate of the top-left pixel.w
- the width of the region of pixels.h
- the height of the region of pixels.b
- the band (in the range 0
to
getNumBands() - 1).iArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
NullPointerException
- if either iArray
or
data
is null
.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 |