Method from java.awt.image.Raster Detail: |
public static WritableRaster createBandedRaster(int dataType,
int w,
int h,
int bands,
Point location) {
if (bands < 1) {
throw new ArrayIndexOutOfBoundsException("Number of bands ("+
bands+") must"+
" be greater than 0");
}
int[] bankIndices = new int[bands];
int[] bandOffsets = new int[bands];
for (int i = 0; i < bands; i++) {
bankIndices[i] = i;
bandOffsets[i] = 0;
}
return createBandedRaster(dataType, w, h, w,
bankIndices, bandOffsets,
location);
}
Creates a Raster based on a BandedSampleModel with the
specified data type, width, height, and number of bands.
The upper left corner of the Raster is given by the
location argument. If location is null, (0, 0) will be used.
The dataType parameter should be one of the enumerated values
defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT,
and TYPE_INT. |
public static WritableRaster createBandedRaster(int dataType,
int w,
int h,
int scanlineStride,
int[] bankIndices,
int[] bandOffsets,
Point location) {
DataBuffer d;
int bands = bandOffsets.length;
if (bankIndices == null) {
throw new
ArrayIndexOutOfBoundsException("Bank indices array is null");
}
if (bandOffsets == null) {
throw new
ArrayIndexOutOfBoundsException("Band offsets array is null");
}
// Figure out the #banks and the largest band offset
int maxBank = bankIndices[0];
int maxBandOff = bandOffsets[0];
for (int i = 1; i < bands; i++) {
if (bankIndices[i] > maxBank) {
maxBank = bankIndices[i];
}
if (bandOffsets[i] > maxBandOff) {
maxBandOff = bandOffsets[i];
}
}
int banks = maxBank + 1;
int size = maxBandOff + scanlineStride*(h-1) + (w-1) + 1;
switch(dataType) {
case DataBuffer.TYPE_BYTE:
d = new DataBufferByte(size, banks);
break;
case DataBuffer.TYPE_USHORT:
d = new DataBufferUShort(size, banks);
break;
case DataBuffer.TYPE_INT:
d = new DataBufferInt(size, banks);
break;
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
return createBandedRaster(d, w, h, scanlineStride,
bankIndices, bandOffsets, location);
}
Creates a Raster based on a BandedSampleModel with the
specified data type, width, height, scanline stride, bank
indices and band offsets. The number of bands is inferred from
bankIndices.length and bandOffsets.length, which must be the
same.
The upper left corner of the Raster is given by the
location argument. The dataType parameter should be one of the
enumerated values defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT,
and TYPE_INT. |
public static WritableRaster createBandedRaster(DataBuffer dataBuffer,
int w,
int h,
int scanlineStride,
int[] bankIndices,
int[] bandOffsets,
Point location) {
if (dataBuffer == null) {
throw new NullPointerException("DataBuffer cannot be null");
}
if (location == null) {
location = new Point(0,0);
}
int dataType = dataBuffer.getDataType();
int bands = bankIndices.length;
if (bandOffsets.length != bands) {
throw new IllegalArgumentException(
"bankIndices.length != bandOffsets.length");
}
BandedSampleModel bsm =
new BandedSampleModel(dataType, w, h,
scanlineStride,
bankIndices, bandOffsets);
switch(dataType) {
case DataBuffer.TYPE_BYTE:
return new ByteBandedRaster(bsm, dataBuffer, location);
case DataBuffer.TYPE_USHORT:
return new ShortBandedRaster(bsm, dataBuffer, location);
case DataBuffer.TYPE_INT:
return new SunWritableRaster(bsm, dataBuffer, location);
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
}
Creates a Raster based on a BandedSampleModel with the
specified DataBuffer, width, height, scanline stride, bank
indices, and band offsets. The number of bands is inferred
from bankIndices.length and bandOffsets.length, which must be
the same. The upper left corner of the Raster is given by the
location argument. If location is null, (0, 0) will be used. |
public Raster createChild(int parentX,
int parentY,
int width,
int height,
int childMinX,
int childMinY,
int[] bandList) {
if (parentX < this.minX) {
throw new RasterFormatException("parentX lies outside raster");
}
if (parentY < this.minY) {
throw new RasterFormatException("parentY lies outside raster");
}
if ((parentX + width < parentX) ||
(parentX + width > this.width + this.minX)) {
throw new RasterFormatException("(parentX + width) is outside raster");
}
if ((parentY + height < parentY) ||
(parentY + height > this.height + this.minY)) {
throw new RasterFormatException("(parentY + height) is outside raster");
}
SampleModel subSampleModel;
// Note: the SampleModel for the child Raster should have the same
// width and height as that for the parent, since it represents
// the physical layout of the pixel data. The child Raster's width
// and height represent a "virtual" view of the pixel data, so
// they may be different than those of the SampleModel.
if (bandList == null) {
subSampleModel = sampleModel;
} else {
subSampleModel = sampleModel.createSubsetSampleModel(bandList);
}
int deltaX = childMinX - parentX;
int deltaY = childMinY - parentY;
return new Raster(subSampleModel, getDataBuffer(),
new Rectangle(childMinX, childMinY, width, height),
new Point(sampleModelTranslateX + deltaX,
sampleModelTranslateY + deltaY), this);
}
Returns a new Raster which shares all or part of this Raster's
DataBuffer. The new Raster will possess a reference to the
current Raster, accessible through its getParent() method.
The parentX, parentY, width and height parameters
form a Rectangle in this Raster's coordinate space,
indicating the area of pixels to be shared. An error will
be thrown if this Rectangle is not contained with the bounds
of the current Raster.
The new Raster may additionally be translated to a
different coordinate system for the plane than that used by the current
Raster. The childMinX and childMinY parameters give the new
(x, y) coordinate of the upper-left pixel of the returned
Raster; the coordinate (childMinX, childMinY) in the new Raster
will map to the same pixel as the coordinate (parentX, parentY)
in the current Raster.
The new Raster may be defined to contain only a subset of
the bands of the current Raster, possibly reordered, by means
of the bandList parameter. If bandList is null, it is taken to
include all of the bands of the current Raster in their current
order.
To create a new Raster that contains a subregion of the current
Raster, but shares its coordinate system and bands,
this method should be called with childMinX equal to parentX,
childMinY equal to parentY, and bandList equal to null. |
public WritableRaster createCompatibleWritableRaster() {
return new SunWritableRaster(sampleModel, new Point(0,0));
}
Create a compatible WritableRaster the same size as this Raster with
the same SampleModel and a new initialized DataBuffer. |
public WritableRaster createCompatibleWritableRaster(Rectangle rect) {
if (rect == null) {
throw new NullPointerException("Rect cannot be null");
}
return createCompatibleWritableRaster(rect.x, rect.y,
rect.width, rect.height);
}
Create a compatible WritableRaster with location (minX, minY)
and size (width, height) specified by rect, a
new SampleModel, and a new initialized DataBuffer. |
public WritableRaster createCompatibleWritableRaster(int w,
int h) {
if (w < = 0 || h < =0) {
throw new RasterFormatException("negative " +
((w < = 0) ? "width" : "height"));
}
SampleModel sm = sampleModel.createCompatibleSampleModel(w,h);
return new SunWritableRaster(sm, new Point(0,0));
}
Create a compatible WritableRaster with the specified size, a new
SampleModel, and a new initialized DataBuffer. |
public WritableRaster createCompatibleWritableRaster(int x,
int y,
int w,
int h) {
WritableRaster ret = createCompatibleWritableRaster(w, h);
return ret.createWritableChild(0,0,w,h,x,y,null);
}
Create a compatible WritableRaster with the specified
location (minX, minY) and size (width, height), a
new SampleModel, and a new initialized DataBuffer. |
public static WritableRaster createInterleavedRaster(int dataType,
int w,
int h,
int bands,
Point location) {
int[] bandOffsets = new int[bands];
for (int i = 0; i < bands; i++) {
bandOffsets[i] = i;
}
return createInterleavedRaster(dataType, w, h, w*bands, bands,
bandOffsets, location);
}
Creates a Raster based on a PixelInterleavedSampleModel with the
specified data type, width, height, and number of bands.
The upper left corner of the Raster is given by the
location argument. If location is null, (0, 0) will be used.
The dataType parameter should be one of the enumerated values
defined in the DataBuffer class.
Note that interleaved DataBuffer.TYPE_INT
Rasters are not supported. To create a 1-band Raster of type
DataBuffer.TYPE_INT , use
Raster.createPackedRaster().
The only dataTypes supported currently are TYPE_BYTE
and TYPE_USHORT. |
public static WritableRaster createInterleavedRaster(int dataType,
int w,
int h,
int scanlineStride,
int pixelStride,
int[] bandOffsets,
Point location) {
DataBuffer d;
int bands = bandOffsets.length;
int maxBandOff = bandOffsets[0];
for (int i=1; i < bands; i++) {
if (bandOffsets[i] > maxBandOff) {
maxBandOff = bandOffsets[i];
}
}
int size = maxBandOff + scanlineStride*(h-1) + pixelStride*(w-1) + 1;
switch(dataType) {
case DataBuffer.TYPE_BYTE:
d = new DataBufferByte(size);
break;
case DataBuffer.TYPE_USHORT:
d = new DataBufferUShort(size);
break;
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
return createInterleavedRaster(d, w, h, scanlineStride,
pixelStride, bandOffsets, location);
}
Creates a Raster based on a PixelInterleavedSampleModel with the
specified data type, width, height, scanline stride, pixel
stride, and band offsets. The number of bands is inferred from
bandOffsets.length.
The upper left corner of the Raster is given by the
location argument. If location is null, (0, 0) will be used.
The dataType parameter should be one of the enumerated values
defined in the DataBuffer class.
Note that interleaved DataBuffer.TYPE_INT
Rasters are not supported. To create a 1-band Raster of type
DataBuffer.TYPE_INT , use
Raster.createPackedRaster().
The only dataTypes supported currently are TYPE_BYTE
and TYPE_USHORT. |
public static WritableRaster createInterleavedRaster(DataBuffer dataBuffer,
int w,
int h,
int scanlineStride,
int pixelStride,
int[] bandOffsets,
Point location) {
if (dataBuffer == null) {
throw new NullPointerException("DataBuffer cannot be null");
}
if (location == null) {
location = new Point(0, 0);
}
int dataType = dataBuffer.getDataType();
PixelInterleavedSampleModel csm =
new PixelInterleavedSampleModel(dataType, w, h,
pixelStride,
scanlineStride,
bandOffsets);
switch(dataType) {
case DataBuffer.TYPE_BYTE:
return new ByteInterleavedRaster(csm, dataBuffer, location);
case DataBuffer.TYPE_USHORT:
return new ShortInterleavedRaster(csm, dataBuffer, location);
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
}
Creates a Raster based on a PixelInterleavedSampleModel with the
specified DataBuffer, width, height, scanline stride, pixel
stride, and band offsets. The number of bands is inferred from
bandOffsets.length. The upper left corner of the Raster
is given by the location argument. If location is null, (0, 0)
will be used.
Note that interleaved DataBuffer.TYPE_INT
Rasters are not supported. To create a 1-band Raster of type
DataBuffer.TYPE_INT , use
Raster.createPackedRaster(). |
public static WritableRaster createPackedRaster(int dataType,
int w,
int h,
int[] bandMasks,
Point location) {
DataBuffer d;
switch(dataType) {
case DataBuffer.TYPE_BYTE:
d = new DataBufferByte(w*h);
break;
case DataBuffer.TYPE_USHORT:
d = new DataBufferUShort(w*h);
break;
case DataBuffer.TYPE_INT:
d = new DataBufferInt(w*h);
break;
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
return createPackedRaster(d, w, h, w, bandMasks, location);
}
Creates a Raster based on a SinglePixelPackedSampleModel with
the specified data type, width, height, and band masks.
The number of bands is inferred from bandMasks.length.
The upper left corner of the Raster is given by the
location argument. If location is null, (0, 0) will be used.
The dataType parameter should be one of the enumerated values
defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT,
and TYPE_INT. |
public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
int w,
int h,
int bitsPerPixel,
Point location) {
if (dataBuffer == null) {
throw new NullPointerException("DataBuffer cannot be null");
}
if (location == null) {
location = new Point(0,0);
}
int dataType = dataBuffer.getDataType();
if (dataType != DataBuffer.TYPE_BYTE &&
dataType != DataBuffer.TYPE_USHORT &&
dataType != DataBuffer.TYPE_INT) {
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
if (dataBuffer.getNumBanks() != 1) {
throw new
RasterFormatException("DataBuffer for packed Rasters"+
" must only have 1 bank.");
}
MultiPixelPackedSampleModel mppsm =
new MultiPixelPackedSampleModel(dataType, w, h, bitsPerPixel);
if (dataType == DataBuffer.TYPE_BYTE &&
(bitsPerPixel == 1 || bitsPerPixel == 2 || bitsPerPixel == 4)) {
return new BytePackedRaster(mppsm, dataBuffer, location);
} else {
return new SunWritableRaster(mppsm, dataBuffer, location);
}
}
Creates a Raster based on a MultiPixelPackedSampleModel with the
specified DataBuffer, width, height, and bits per pixel. The upper
left corner of the Raster is given by the location argument. If
location is null, (0, 0) will be used. |
public static WritableRaster createPackedRaster(int dataType,
int w,
int h,
int bands,
int bitsPerBand,
Point location) {
DataBuffer d;
if (bands < = 0) {
throw new IllegalArgumentException("Number of bands ("+bands+
") must be greater than 0");
}
if (bitsPerBand < = 0) {
throw new IllegalArgumentException("Bits per band ("+bitsPerBand+
") must be greater than 0");
}
if (bands != 1) {
int[] masks = new int[bands];
int mask = (1 < < bitsPerBand) - 1;
int shift = (bands-1)*bitsPerBand;
/* Make sure the total mask size will fit in the data type */
if (shift+bitsPerBand > DataBuffer.getDataTypeSize(dataType)) {
throw new IllegalArgumentException("bitsPerBand("+
bitsPerBand+") * bands is "+
" greater than data type "+
"size.");
}
switch(dataType) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_INT:
break;
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
for (int i = 0; i < bands; i++) {
masks[i] = mask < < shift;
shift = shift - bitsPerBand;
}
return createPackedRaster(dataType, w, h, masks, location);
}
else {
double fw = w;
switch(dataType) {
case DataBuffer.TYPE_BYTE:
d = new DataBufferByte((int)(Math.ceil(fw/(8/bitsPerBand)))*h);
break;
case DataBuffer.TYPE_USHORT:
d = new DataBufferUShort((int)(Math.ceil(fw/(16/bitsPerBand)))*h);
break;
case DataBuffer.TYPE_INT:
d = new DataBufferInt((int)(Math.ceil(fw/(32/bitsPerBand)))*h);
break;
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
return createPackedRaster(d, w, h, bitsPerBand, location);
}
}
Creates a Raster based on a packed SampleModel with the
specified data type, width, height, number of bands, and bits
per band. If the number of bands is one, the SampleModel will
be a MultiPixelPackedSampleModel.
If the number of bands is more than one, the SampleModel
will be a SinglePixelPackedSampleModel, with each band having
bitsPerBand bits. In either case, the requirements on dataType
and bitsPerBand imposed by the corresponding SampleModel must
be met.
The upper left corner of the Raster is given by the
location argument. If location is null, (0, 0) will be used.
The dataType parameter should be one of the enumerated values
defined in the DataBuffer class.
The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT,
and TYPE_INT. |
public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
int w,
int h,
int scanlineStride,
int[] bandMasks,
Point location) {
if (dataBuffer == null) {
throw new NullPointerException("DataBuffer cannot be null");
}
if (location == null) {
location = new Point(0,0);
}
int dataType = dataBuffer.getDataType();
SinglePixelPackedSampleModel sppsm =
new SinglePixelPackedSampleModel(dataType, w, h, scanlineStride,
bandMasks);
switch(dataType) {
case DataBuffer.TYPE_BYTE:
return new ByteInterleavedRaster(sppsm, dataBuffer, location);
case DataBuffer.TYPE_USHORT:
return new ShortInterleavedRaster(sppsm, dataBuffer, location);
case DataBuffer.TYPE_INT:
return new IntegerInterleavedRaster(sppsm, dataBuffer, location);
default:
throw new IllegalArgumentException("Unsupported data type " +
dataType);
}
}
Creates a Raster based on a SinglePixelPackedSampleModel with
the specified DataBuffer, width, height, scanline stride, and
band masks. The number of bands is inferred from bandMasks.length.
The upper left corner of the Raster is given by
the location argument. If location is null, (0, 0) will be used. |
public static Raster createRaster(SampleModel sm,
DataBuffer db,
Point location) {
if ((sm == null) || (db == null)) {
throw new NullPointerException("SampleModel and DataBuffer cannot be null");
}
if (location == null) {
location = new Point(0,0);
}
int dataType = sm.getDataType();
if (sm instanceof PixelInterleavedSampleModel) {
switch(dataType) {
case DataBuffer.TYPE_BYTE:
return new ByteInterleavedRaster(sm, db, location);
case DataBuffer.TYPE_USHORT:
return new ShortInterleavedRaster(sm, db, location);
}
} else if (sm instanceof SinglePixelPackedSampleModel) {
switch(dataType) {
case DataBuffer.TYPE_BYTE:
return new ByteInterleavedRaster(sm, db, location);
case DataBuffer.TYPE_USHORT:
return new ShortInterleavedRaster(sm, db, location);
case DataBuffer.TYPE_INT:
return new IntegerInterleavedRaster(sm, db, location);
}
} else if (sm instanceof MultiPixelPackedSampleModel &&
dataType == DataBuffer.TYPE_BYTE &&
sm.getSampleSize(0) < 8) {
return new BytePackedRaster(sm, db, location);
}
// we couldn't do anything special - do the generic thing
return new Raster(sm,db,location);
}
Creates a Raster with the specified SampleModel and DataBuffer.
The upper left corner of the Raster is given by the location argument.
If location is null, (0, 0) will be used. |
public Raster createTranslatedChild(int childMinX,
int childMinY) {
return createChild(minX,minY,width,height,
childMinX,childMinY,null);
}
Create a Raster with the same size, SampleModel and DataBuffer
as this one, but with a different location. The new Raster
will possess a reference to the current Raster, accessible
through its getParent() method. |
public static WritableRaster createWritableRaster(SampleModel sm,
Point location) {
if (location == null) {
location = new Point(0,0);
}
return createWritableRaster(sm, sm.createDataBuffer(), location);
}
Creates a WritableRaster with the specified SampleModel.
The upper left corner of the Raster is given by the location argument.
If location is null, (0, 0) will be used. |
public static WritableRaster createWritableRaster(SampleModel sm,
DataBuffer db,
Point location) {
if ((sm == null) || (db == null)) {
throw new NullPointerException("SampleModel and DataBuffer cannot be null");
}
if (location == null) {
location = new Point(0,0);
}
int dataType = sm.getDataType();
if (sm instanceof PixelInterleavedSampleModel) {
switch(dataType) {
case DataBuffer.TYPE_BYTE:
return new ByteInterleavedRaster(sm, db, location);
case DataBuffer.TYPE_USHORT:
return new ShortInterleavedRaster(sm, db, location);
}
} else if (sm instanceof SinglePixelPackedSampleModel) {
switch(dataType) {
case DataBuffer.TYPE_BYTE:
return new ByteInterleavedRaster(sm, db, location);
case DataBuffer.TYPE_USHORT:
return new ShortInterleavedRaster(sm, db, location);
case DataBuffer.TYPE_INT:
return new IntegerInterleavedRaster(sm, db, location);
}
} else if (sm instanceof MultiPixelPackedSampleModel &&
dataType == DataBuffer.TYPE_BYTE &&
sm.getSampleSize(0) < 8) {
return new BytePackedRaster(sm, db, location);
}
// we couldn't do anything special - do the generic thing
return new SunWritableRaster(sm,db,location);
}
Creates a WritableRaster with the specified SampleModel and DataBuffer.
The upper left corner of the Raster is given by the location argument.
If location is null, (0, 0) will be used. |
public Rectangle getBounds() {
return new Rectangle(minX, minY, width, height);
}
Returns the bounding Rectangle of this Raster. This function returns
the same information as getMinX/MinY/Width/Height. |
public DataBuffer getDataBuffer() {
return dataBuffer;
}
Returns the DataBuffer associated with this Raster. |
public Object getDataElements(int x,
int y,
Object outData) {
return sampleModel.getDataElements(x - sampleModelTranslateX,
y - sampleModelTranslateY,
outData, dataBuffer);
}
Returns data for a single pixel in a primitive array of type
TransferType. For image data supported by the Java 2D(tm) API,
this will be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT,
DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT,
or DataBuffer.TYPE_DOUBLE. Data may be returned in a packed format,
thus increasing efficiency for data transfers.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed.
A ClassCastException will be thrown if the input object is non null
and references anything other than an array of TransferType. |
public Object getDataElements(int x,
int y,
int w,
int h,
Object outData) {
return sampleModel.getDataElements(x - sampleModelTranslateX,
y - sampleModelTranslateY,
w, h, outData, dataBuffer);
}
Returns the pixel data for the specified rectangle of pixels in a
primitive array of type TransferType.
For image data supported by the Java 2D API, this
will be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT,
DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT,
or DataBuffer.TYPE_DOUBLE. Data may be returned in a packed format,
thus increasing efficiency for data transfers.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed.
A ClassCastException will be thrown if the input object is non null
and references anything other than an array of TransferType. |
public final int getHeight() {
return height;
}
Returns the height in pixels of the Raster. |
public final int getMinX() {
return minX;
}
Returns the minimum valid X coordinate of the Raster. |
public final int getMinY() {
return minY;
}
Returns the minimum valid Y coordinate of the Raster. |
public final int getNumBands() {
return numBands;
}
Returns the number of bands (samples per pixel) in this Raster. |
public final int getNumDataElements() {
return sampleModel.getNumDataElements();
}
Returns the number of data elements needed to transfer one pixel
via the getDataElements and setDataElements methods. When pixels
are transferred via these methods, they may be transferred in a
packed or unpacked format, depending on the implementation of the
underlying SampleModel. Using these methods, pixels are transferred
as an array of getNumDataElements() elements of a primitive type given
by getTransferType(). The TransferType may or may not be the same
as the storage data type of the DataBuffer. |
public Raster getParent() {
return parent;
}
Returns the parent Raster (if any) of this Raster or null. |
public int[] getPixel(int x,
int y,
int[] iArray) {
return sampleModel.getPixel(x - sampleModelTranslateX,
y - sampleModelTranslateY,
iArray, dataBuffer);
}
Returns the samples in an array of int for the specified pixel.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public float[] getPixel(int x,
int y,
float[] fArray) {
return sampleModel.getPixel(x - sampleModelTranslateX,
y - sampleModelTranslateY,
fArray, dataBuffer);
}
Returns the samples in an array of float for the
specified pixel.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public double[] getPixel(int x,
int y,
double[] dArray) {
return sampleModel.getPixel(x - sampleModelTranslateX,
y - sampleModelTranslateY,
dArray, dataBuffer);
}
Returns the samples in an array of double for the specified pixel.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public int[] getPixels(int x,
int y,
int w,
int h,
int[] iArray) {
return sampleModel.getPixels(x - sampleModelTranslateX,
y - sampleModelTranslateY, w, h,
iArray, dataBuffer);
}
Returns an int array containing all samples for a rectangle of pixels,
one sample per array element.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public float[] getPixels(int x,
int y,
int w,
int h,
float[] fArray) {
return sampleModel.getPixels(x - sampleModelTranslateX,
y - sampleModelTranslateY, w, h,
fArray, dataBuffer);
}
Returns a float array containing all samples for a rectangle of pixels,
one sample per array element.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public double[] getPixels(int x,
int y,
int w,
int h,
double[] dArray) {
return sampleModel.getPixels(x - sampleModelTranslateX,
y - sampleModelTranslateY,
w, h, dArray, dataBuffer);
}
Returns a double array containing all samples for a rectangle of pixels,
one sample per array element.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public int getSample(int x,
int y,
int b) {
return sampleModel.getSample(x - sampleModelTranslateX,
y - sampleModelTranslateY, b,
dataBuffer);
}
Returns the sample in a specified band for the pixel located
at (x,y) as an int.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public double getSampleDouble(int x,
int y,
int b) {
return sampleModel.getSampleDouble(x - sampleModelTranslateX,
y - sampleModelTranslateY,
b, dataBuffer);
}
Returns the sample in a specified band
for a pixel located at (x,y) as a double.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public float getSampleFloat(int x,
int y,
int b) {
return sampleModel.getSampleFloat(x - sampleModelTranslateX,
y - sampleModelTranslateY, b,
dataBuffer);
}
Returns the sample in a specified band
for the pixel located at (x,y) as a float.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public SampleModel getSampleModel() {
return sampleModel;
}
Returns the SampleModel that describes the layout of the image data. |
public final int getSampleModelTranslateX() {
return sampleModelTranslateX;
}
Returns the X translation from the coordinate system of the
SampleModel to that of the Raster. To convert a pixel's X
coordinate from the Raster coordinate system to the SampleModel
coordinate system, this value must be subtracted. |
public final int getSampleModelTranslateY() {
return sampleModelTranslateY;
}
Returns the Y translation from the coordinate system of the
SampleModel to that of the Raster. To convert a pixel's Y
coordinate from the Raster coordinate system to the SampleModel
coordinate system, this value must be subtracted. |
public int[] getSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray) {
return sampleModel.getSamples(x - sampleModelTranslateX,
y - sampleModelTranslateY,
w, h, b, iArray,
dataBuffer);
}
Returns the samples for a specified band for the specified rectangle
of pixels in an int array, one sample per array element.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public float[] getSamples(int x,
int y,
int w,
int h,
int b,
float[] fArray) {
return sampleModel.getSamples(x - sampleModelTranslateX,
y - sampleModelTranslateY,
w, h, b, fArray, dataBuffer);
}
Returns the samples for a specified band for the specified rectangle
of pixels in a float array, one sample per array element.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public double[] getSamples(int x,
int y,
int w,
int h,
int b,
double[] dArray) {
return sampleModel.getSamples(x - sampleModelTranslateX,
y - sampleModelTranslateY,
w, h, b, dArray, dataBuffer);
}
Returns the samples for a specified band for a specified rectangle
of pixels in a double array, one sample per array element.
An ArrayIndexOutOfBoundsException may be thrown
if the coordinates are not in bounds. However, explicit bounds
checking is not guaranteed. |
public final int getTransferType() {
return sampleModel.getTransferType();
}
Returns the TransferType used to transfer pixels via the
getDataElements and setDataElements methods. When pixels
are transferred via these methods, they may be transferred in a
packed or unpacked format, depending on the implementation of the
underlying SampleModel. Using these methods, pixels are transferred
as an array of getNumDataElements() elements of a primitive type given
by getTransferType(). The TransferType may or may not be the same
as the storage data type of the DataBuffer. The TransferType will
be one of the types defined in DataBuffer. |
public final int getWidth() {
return width;
}
Returns the width in pixels of the Raster. |