| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectjava.awt.image.SampleModeljava.awt.image.ComponentSampleModeljava.awt.image.BandedSampleModelpublic final class BandedSampleModelextends ComponentSampleModelDataBuffer.
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, numBands, width | |
Constructor Summary | |
| |
| |
Method Summary | |
SampleModel |
|
DataBuffer |
|
SampleModel |
|
Object |
|
int[] |
|
int[] |
|
int |
|
double |
|
float |
|
int[] |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
String |
|
Methods inherited from class java.awt.image.ComponentSampleModel | |
createCompatibleSampleModel, createDataBuffer, createSubsetSampleModel, equals, getBandOffsets, getBankIndices, getDataElements, getNumDataElements, getOffset, getOffset, getPixel, getPixelStride, getPixels, getSample, getSampleSize, getSampleSize, getScanlineStride, hashCode, setDataElements, setPixel, setSample | |
Methods inherited from class java.awt.image.SampleModel | |
createCompatibleSampleModel, createDataBuffer, createSubsetSampleModel, getDataElements, getDataElements, getDataType, getHeight, getNumBands, getNumDataElements, getPixel, getPixel, getPixel, getPixels, getPixels, getPixels, getSample, getSampleDouble, getSampleFloat, getSampleSize, getSampleSize, getSamples, getSamples, getSamples, getTransferType, getWidth, setDataElements, setDataElements, setPixel, setPixel, setPixel, setPixels, setPixels, setPixels, setSample, setSample, setSample, setSamples, setSamples, setSamples | |
Methods inherited from class java.lang.Object | |
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait | |
public BandedSampleModel(int dataType, int w, int h, int numBands)
Creates a newBandedSampleModel.
- Parameters:
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)
Creates a newBandedSampleModel.
- Parameters:
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.
public SampleModel createCompatibleSampleModel(int w, int h)
Creates a newSampleModelthat is compatible with this model and has the specified width and height.
- Overrides:
- createCompatibleSampleModel in interface ComponentSampleModel
- Parameters:
w- the width (in pixels, must be greater than zero).h- the height (in pixels, must be greater than zero).
- Returns:
- The new sample model.
- Throws:
IllegalArgumentException- ifworhis not greater than zero.IllegalArgumentException- ifw * hexceedsInteger.MAX_VALUE.
public DataBuffer createDataBuffer()
Creates a new data buffer that is compatible with this sample model.
- Overrides:
- createDataBuffer in interface ComponentSampleModel
- Returns:
- The new data buffer.
public SampleModel createSubsetSampleModel(int[] bands)
- Overrides:
- createSubsetSampleModel in interface ComponentSampleModel
public Object getDataElements(int x, int y, Object obj, DataBuffer data)
Extract all samples of one pixel and return in an array of transfer type. Extracts the pixel at x, y from data and stores samples into the array obj. If obj is null, a new array of getTransferType() is created.
- Overrides:
- getDataElements in interface ComponentSampleModel
- Parameters:
x- The x-coordinate of the pixel rectangle to store inobj.y- The y-coordinate of the pixel rectangle to store inobj.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.
- Returns:
- The primitive array containing the pixel data.
public 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.
- Overrides:
- getPixel in interface ComponentSampleModel
- Parameters:
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 isnull, a new array is created.data- the data buffer (nullnot permitted).
- Returns:
- The samples for the specified pixel.
- See Also:
setPixel(int,int,int[],DataBuffer)
public int[] getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
Copy pixels from a region into an array. Copies the samples of the pixels in the rectangle starting at x, y that is w pixels wide and h scanlines high. When there is more than one band, the samples stored in order before the next pixel. This ordering isn't well specified in Sun's docs as of 1.4.2. If iArray is null, a new array is allocated, filled, and returned.
- Overrides:
- getPixels in interface ComponentSampleModel
- Parameters:
x- The x-coordinate of the pixel rectangle to store iniArray.y- The y-coordinate of the pixel rectangle to store iniArray.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.
- Returns:
- The primitive array containing the pixel data.
public 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.
- Overrides:
- getSample in interface ComponentSampleModel
- Parameters:
x- the x-coordinate of the pixel.y- the y-coordinate of the pixel.b- the band (in the range0togetNumBands() - 1).data- the data buffer (nullnot permitted).
- Returns:
- The sample value.
- Throws:
NullPointerException- ifdataisnull.
public 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.
- Overrides:
- getSampleDouble in interface SampleModel
- Parameters:
x- the x-coordinate of the pixel.y- the y-coordinate of the pixel.b- the band (in the range0togetNumBands() - 1).data- the data buffer (nullnot permitted).
- Returns:
- The sample value.
- Throws:
NullPointerException- ifdataisnull.
- See Also:
getSample(int,int,int,DataBuffer)
public 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.
- Overrides:
- getSampleFloat in interface SampleModel
- Parameters:
x- the x-coordinate of the pixel.y- the y-coordinate of the pixel.b- the band (in the range0togetNumBands() - 1).data- the data buffer (nullnot permitted).
- Returns:
- The sample value.
- Throws:
NullPointerException- ifdataisnull.
- See Also:
getSample(int,int,int,DataBuffer)
public 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. Copies from one band the samples of the pixels in the rectangle starting at x, y that is w pixels wide and h scanlines high. If iArray is null, a new array is allocated, filled, and returned.
- Overrides:
- getSamples in interface SampleModel
- Parameters:
x- The x-coordinate of the pixel rectangle to store iniArray.y- The y-coordinate of the pixel rectangle to store iniArray.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.
- Returns:
- The primitive array containing the pixel data.
public 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.
- Overrides:
- setDataElements in interface ComponentSampleModel
- Parameters:
x- The x-coordinate of the data elements inobj.y- The y-coordinate of the data elements inobj.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)
Sets the samples for the pixel at (x, y) in the specified data buffer to the specified values.
- Overrides:
- setPixel in interface ComponentSampleModel
- Parameters:
x- the x-coordinate of the pixel.y- the y-coordinate of the pixel.iArray- the sample values (nullnot permitted).data- the data buffer (nullnot permitted).
- Throws:
NullPointerException- if eitheriArrayordataisnull.
public 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. The array is ordered by pixels (that is, all the samples for the first pixel are grouped together, followed by all the samples for the second pixel, and so on).
- Overrides:
- setPixels in interface SampleModel
- Parameters:
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 (nullnot permitted).data- the data buffer (nullnot permitted).
- Throws:
NullPointerException- if eitheriArrayordataisnull.
public 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.
- Overrides:
- setSample in interface SampleModel
- Parameters:
x- the x-coordinate of the pixel.y- the y-coordinate of the pixel.b- the band (in the range0togetNumBands() - 1).s- the sample value.data- the data buffer (nullnot permitted).
- Throws:
NullPointerException- ifdataisnull.
public 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.
- Overrides:
- setSample in interface SampleModel
- Parameters:
x- the x-coordinate of the pixel.y- the y-coordinate of the pixel.b- the band (in the range0togetNumBands() - 1).s- the sample value.data- the data buffer (nullnot permitted).
- Throws:
NullPointerException- ifdataisnull.
public void setSample(int x, int y, int b, int s, DataBuffer data)
Sets the sample value for bandbof the pixel at location(x, y)in the specified data buffer.
- Overrides:
- setSample in interface ComponentSampleModel
- Parameters:
x- the x-coordinate.y- the y-coordinate.b- the band index.s- the sample value.data- the data buffer (nullnot permitted).
- See Also:
getSample(int,int,int,DataBuffer)
public 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.
- Overrides:
- setSamples in interface SampleModel
- Parameters:
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 range0to getNumBands() - 1).iArray- the sample values (nullnot permitted).data- the data buffer (nullnot permitted).
- Throws:
NullPointerException- if eitheriArrayordataisnull.
public String toString()
Creates a String with some information about this SampleModel.
- Returns:
- A String describing this SampleModel.
- See Also:
Object.toString()