GNU Classpath (0.95) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.image.SampleModel
public abstract class SampleModel
extends Object
Field Summary | |
protected int |
|
protected int |
|
protected int |
|
protected int |
|
Constructor Summary | |
|
Method Summary | |
abstract SampleModel |
|
abstract DataBuffer |
|
abstract SampleModel |
|
Object |
|
abstract Object |
|
int |
|
int |
|
int |
|
abstract int | |
double[] |
|
float[] |
|
int[] |
|
double[] |
|
float[] |
|
int[] |
|
abstract int |
|
double |
|
float |
|
abstract int[] |
|
abstract int |
|
double[] |
|
float[] |
|
int[] |
|
int | |
int |
|
void |
|
abstract void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
abstract void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected int dataType
The DataBuffer type that is used to store the data of the image described.
protected int numBands
Number of bands in the image described. Package-private here, shadowed by ComponentSampleModel.
public SampleModel(int dataType, int w, int h, int numBands)
Creates a new sample model with the specified attributes.
- Parameters:
dataType
- the data type (one ofDataBuffer.TYPE_BYTE
,DataBuffer.TYPE_USHORT
,DataBuffer.TYPE_SHORT
,DataBuffer.TYPE_INT
,DataBuffer.TYPE_FLOAT
,DataBuffer.TYPE_DOUBLE
orDataBuffer.TYPE_UNDEFINED
).w
- the width in pixels (must be greater than zero).h
- the height in pixels (must be greater than zero).numBands
- the number of bands (must be greater than zero).
- Throws:
IllegalArgumentException
- ifdataType
is not one of the listed values.IllegalArgumentException
- ifw
is less than or equal to zero.IllegalArgumentException
- ifh
is less than or equal to zero.IllegalArgumentException
- ifw * h
is greater thanInteger.MAX_VALUE
.
public abstract SampleModel createCompatibleSampleModel(int w, int h)
Creates a newSampleModel
that is compatible with this model and has the specified width and height.
- Parameters:
w
- the width (in pixels).h
- the height (in pixels).
- Returns:
- The new sample model.
public abstract DataBuffer createDataBuffer()
Creates a newDataBuffer
of the correct type and size for thisSampleModel
.
- Returns:
- The data buffer.
public abstract SampleModel createSubsetSampleModel(int[] bands)
Return a SampleModel with a subset of the bands in this model. Selects bands.length bands from this sample model. The bands chosen are specified in the indices of bands[]. This also permits permuting the bands as well as taking a subset. Thus, giving an array with 1, 2, 3, ..., numbands, will give an identical sample model.
- Parameters:
bands
- Array with band indices to include.
- Returns:
- A new sample model
public Object getDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)
public abstract Object getDataElements(int x, int y, Object obj, DataBuffer data)
This method is provided as a faster alternative to getPixel(), that can be used when there is no need to decode the pixel into separate sample values.
- Parameters:
obj
- An array to return the pixel data in. If null, an array of the right type and size will be created.
- Returns:
- A single pixel as an array object of a primitive type, based on the transfer type. Eg. if transfer type is DataBuffer.TYPE_USHORT, then a short[] object is returned.
public final int getDataType()
Returns the type of theDataBuffer
that thisSampleModel
accesses.
- Returns:
- The data buffer type.
public final int getHeight()
Returns the height of the pixel data accessible via thisSampleModel
.
- Returns:
- The height.
- See Also:
getWidth()
public final int getNumBands()
Returns the number of bands for thisSampleModel
.
- Returns:
- The number of bands.
public double[] getPixel(int x, int y, double[] dArray, DataBuffer data)
Returns an array containing the samples for the pixel at (x, y) in the specified data buffer. IfdArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.dArray
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The pixel sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public float[] getPixel(int x, int y, float[] fArray, DataBuffer data)
Returns an array containing the samples for the pixel at (x, y) in the specified data buffer. IffArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.fArray
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The pixel sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
Returns an array containing the samples for the pixel at (x, y) in the specified data buffer. IfiArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- Parameters:
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 (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The pixel sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public double[] getPixels(int x, int y, int w, int h, double[] dArray, DataBuffer data)
Returns an array containing the samples 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). IfdArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- 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.dArray
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The pixel sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public float[] getPixels(int x, int y, int w, int h, float[] fArray, DataBuffer data)
Returns an array containing the samples 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). IffArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- 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.fArray
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The pixel sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public int[] getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
Returns an array containing the samples 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). IfiArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- 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
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The pixel sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public abstract 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.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range0
togetNumBands() - 1
).data
- the data buffer (null
not permitted).
- Returns:
- The sample value.
- Throws:
NullPointerException
- ifdata
isnull
.
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.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range0
togetNumBands() - 1
).data
- the data buffer (null
not permitted).
- Returns:
- The sample value.
- Throws:
NullPointerException
- ifdata
isnull
.
- See Also:
getSample(int,int,int,DataBuffer)
public float getSampleFloat(int x, int y, int b, DataBuffer data)
Returns the sample value for the pixel at (x, y) in the specified data buffer.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range0
togetNumBands() - 1
).data
- the data buffer (null
not permitted).
- Returns:
- The sample value.
- Throws:
NullPointerException
- ifdata
isnull
.
- See Also:
getSample(int,int,int,DataBuffer)
public abstract int[] getSampleSize()
Returns an array containing the size (in bits) for each band accessed by theSampleModel
.
- Returns:
- An array.
- See Also:
getSampleSize(int)
public abstract int getSampleSize(int band)
Returns the size (in bits) of the samples for the specified band.
- Parameters:
band
- the band (in the range0
togetNumBands() - 1
).
- Returns:
- The sample size (in bits).
public double[] getSamples(int x, int y, int w, int h, int b, double[] dArray, DataBuffer data)
Returns an array containing the samples from one band for the pixels in the region specified by (x, y, w, h) in the specified data buffer. IfdArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- 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 range0
to getNumBands() - 1).dArray
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public float[] getSamples(int x, int y, int w, int h, int b, float[] fArray, DataBuffer data)
Returns an array containing the samples from one band for the pixels in the region specified by (x, y, w, h) in the specified data buffer. IffArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- 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 range0
to getNumBands() - 1).fArray
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
Returns an array containing the samples from one band for the pixels in the region specified by (x, y, w, h) in the specified data buffer. IfiArray
is notnull
, it will be populated with the sample values and returned as the result of this function (this avoids allocating a new array instance).
- 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 range0
to getNumBands() - 1).iArray
- an array to populate with the sample values and return as the result (ifnull
, a new array will be allocated).data
- the data buffer (null
not permitted).
- Returns:
- The sample values.
- Throws:
NullPointerException
- ifdata
isnull
.
public final int getWidth()
Returns the width of the pixel data accessible via thisSampleModel
.
- Returns:
- The width.
- See Also:
getHeight()
public void setPixel(int x, int y, double[] dArray, DataBuffer data)
Sets the samples for the pixel at (x, y) in the specified data buffer to the specified values.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.dArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitherdArray
ordata
isnull
.
public void setPixel(int x, int y, float[] fArray, DataBuffer data)
Sets the samples for the pixel at (x, y) in the specified data buffer to the specified values.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.fArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitherfArray
ordata
isnull
.
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.
- Parameters:
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).
- Throws:
NullPointerException
- if eitheriArray
ordata
isnull
.
public void setPixels(int x, int y, int w, int h, double[] dArray, 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).
- 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.dArray
- the pixel sample values (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitherdArray
ordata
isnull
.
public void setPixels(int x, int y, int w, int h, float[] fArray, 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).
- 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.fArray
- the pixel sample values (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitherfArray
ordata
isnull
.
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).
- 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 (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitheriArray
ordata
isnull
.
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.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range0
togetNumBands() - 1
).s
- the sample value.data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- ifdata
isnull
.
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.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range0
togetNumBands() - 1
).s
- the sample value.data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- ifdata
isnull
.
public abstract 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.
- Parameters:
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range0
togetNumBands() - 1
).s
- the sample value.data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- ifdata
isnull
.
public void setSamples(int x, int y, int w, int h, int b, double[] dArray, 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.
- 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 range0
to getNumBands() - 1).dArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitheriArray
ordata
isnull
.
public void setSamples(int x, int y, int w, int h, int b, float[] fArray, 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.
- 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 range0
to getNumBands() - 1).fArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitheriArray
ordata
isnull
.
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.
- 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 range0
to getNumBands() - 1).iArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
- Throws:
NullPointerException
- if eitheriArray
ordata
isnull
.
GNU Classpath (0.95) |