Class WritableRaster
The constructors of this class are protected. To instantiate a WritableRaster, use one of the createWritableRaster factory methods in the Raster class.
-
Field Summary
Fields declared in class Raster
dataBuffer, height, minX, minY, numBands, numDataElements, parent, sampleModel, sampleModelTranslateX, sampleModelTranslateY, widthModifier and TypeFieldDescriptionprotected DataBufferThe DataBuffer that stores the image data.protected intThe height of this Raster.protected intThe X coordinate of the upper-left pixel of this Raster.protected intThe Y coordinate of the upper-left pixel of this Raster.protected intThe number of bands in the Raster.protected intThe number of DataBuffer data elements per pixel.protected RasterThe parent of this Raster, or null.protected SampleModelThe SampleModel that describes how pixels from this Raster are stored in the DataBuffer.protected intThe X translation from the coordinate space of the Raster's SampleModel to that of the Raster.protected intThe Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.protected intThe width of this Raster. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) Constructs a WritableRaster with the given SampleModel and DataBuffer.protectedWritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, WritableRaster parent) Constructs a WritableRaster with the given SampleModel, DataBuffer, and parent.protectedWritableRaster(SampleModel sampleModel, Point origin) Constructs a WritableRaster with the given SampleModel. -
Method Summary
Modifier and TypeMethodDescriptioncreateWritableChild(int parentX, int parentY, int w, int h, int childMinX, int childMinY, int[] bandList) Returns a new WritableRaster which shares all or part of this WritableRaster's DataBuffer.createWritableTranslatedChild(int childMinX, int childMinY) Create a WritableRaster with the same size, SampleModel and DataBuffer as this one, but with a different location.Returns the parent WritableRaster (if any) of this WritableRaster, or else null.voidsetDataElements(int x, int y, int w, int h, Object inData) Sets the data for a rectangle of pixels from a primitive array of type TransferType.voidsetDataElements(int x, int y, Raster inRaster) Sets the data for a rectangle of pixels from an input Raster.voidsetDataElements(int x, int y, Object inData) Sets the data for a single pixel from a primitive array of type TransferType.voidsetPixel(int x, int y, double[] dArray) Sets a pixel in the DataBuffer using a double array of samples for input.voidsetPixel(int x, int y, float[] fArray) Sets a pixel in the DataBuffer using a float array of samples for input.voidsetPixel(int x, int y, int[] iArray) Sets a pixel in the DataBuffer using an int array of samples for input.voidsetPixels(int x, int y, int w, int h, double[] dArray) Sets all samples for a rectangle of pixels from a double array containing one sample per array element.voidsetPixels(int x, int y, int w, int h, float[] fArray) Sets all samples for a rectangle of pixels from a float array containing one sample per array element.voidsetPixels(int x, int y, int w, int h, int[] iArray) Sets all samples for a rectangle of pixels from an int array containing one sample per array element.voidCopies pixels from Raster srcRaster to this WritableRaster.voidCopies pixels from Raster srcRaster to this WritableRaster.voidsetSample(int x, int y, int b, double s) Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input.voidsetSample(int x, int y, int b, float s) Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input.voidsetSample(int x, int y, int b, int s) Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input.voidsetSamples(int x, int y, int w, int h, int b, double[] dArray) Sets the samples in the specified band for the specified rectangle of pixels from a double array containing one sample per array element.voidsetSamples(int x, int y, int w, int h, int b, float[] fArray) Sets the samples in the specified band for the specified rectangle of pixels from a float array containing one sample per array element.voidsetSamples(int x, int y, int w, int h, int b, int[] iArray) Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element.Methods declared in class Raster
createBandedRaster, createBandedRaster, createBandedRaster, createChild, createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createInterleavedRaster, createInterleavedRaster, createInterleavedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createRaster, createTranslatedChild, createWritableRaster, createWritableRaster, getBounds, getDataBuffer, getDataElements, getDataElements, getHeight, getMinX, getMinY, getNumBands, getNumDataElements, getParent, getPixel, getPixel, getPixel, getPixels, getPixels, getPixels, getSample, getSampleDouble, getSampleFloat, getSampleModel, getSampleModelTranslateX, getSampleModelTranslateY, getSamples, getSamples, getSamples, getTransferType, getWidthModifier and TypeMethodDescriptionstatic WritableRastercreateBandedRaster(int dataType, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets, Point location) Creates a Raster based on a BandedSampleModel with the specified data type, width, height, scanline stride, bank indices and band offsets.static WritableRastercreateBandedRaster(int dataType, int w, int h, int bands, Point location) Creates a Raster based on a BandedSampleModel with the specified data type, width, height, and number of bands.static WritableRastercreateBandedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets, Point location) Creates a Raster based on a BandedSampleModel with the specified DataBuffer, width, height, scanline stride, bank indices, and band offsets.createChild(int parentX, int parentY, int width, int height, int childMinX, int childMinY, int[] bandList) Returns a new Raster which shares all or part of this Raster's DataBuffer.Create a compatible WritableRaster the same size as this Raster with the same SampleModel and a new initialized DataBuffer.createCompatibleWritableRaster(int w, int h) Create a compatible WritableRaster with the specified size, a new SampleModel, and a new initialized DataBuffer.createCompatibleWritableRaster(int x, int y, int w, int h) Create a compatible WritableRaster with the specified location (minX, minY) and size (width, height), a new SampleModel, and a new initialized DataBuffer.Create a compatible WritableRaster with location (minX, minY) and size (width, height) specified by rect, a new SampleModel, and a new initialized DataBuffer.static WritableRastercreateInterleavedRaster(int dataType, int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets, Point location) Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, scanline stride, pixel stride, and band offsets.static WritableRastercreateInterleavedRaster(int dataType, int w, int h, int bands, Point location) Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, and number of bands.static WritableRastercreateInterleavedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets, Point location) Creates a Raster based on a PixelInterleavedSampleModel with the specified DataBuffer, width, height, scanline stride, pixel stride, and band offsets.static WritableRastercreatePackedRaster(int dataType, int w, int h, int[] bandMasks, Point location) Creates a Raster based on a SinglePixelPackedSampleModel with the specified data type, width, height, and band masks.static WritableRastercreatePackedRaster(int dataType, int w, int h, int bands, int bitsPerBand, Point location) Creates a Raster based on a packed SampleModel with the specified data type, width, height, number of bands, and bits per band.static WritableRastercreatePackedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int[] bandMasks, Point location) Creates a Raster based on a SinglePixelPackedSampleModel with the specified DataBuffer, width, height, scanline stride, and band masks.static WritableRastercreatePackedRaster(DataBuffer dataBuffer, int w, int h, int bitsPerPixel, Point location) Creates a Raster based on a MultiPixelPackedSampleModel with the specified DataBuffer, width, height, and bits per pixel.static RastercreateRaster(SampleModel sm, DataBuffer db, Point location) Creates a Raster with the specified SampleModel and DataBuffer.createTranslatedChild(int childMinX, int childMinY) Create a Raster with the same size, SampleModel and DataBuffer as this one, but with a different location.static WritableRastercreateWritableRaster(SampleModel sm, DataBuffer db, Point location) Creates a WritableRaster with the specified SampleModel and DataBuffer.static WritableRastercreateWritableRaster(SampleModel sm, Point location) Creates a WritableRaster with the specified SampleModel.Returns the bounding Rectangle of this Raster.Returns the DataBuffer associated with this Raster.getDataElements(int x, int y, int w, int h, Object outData) Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType.getDataElements(int x, int y, Object outData) Returns data for a single pixel in a primitive array of type TransferType.final intReturns the height in pixels of the Raster.final intgetMinX()Returns the minimum valid X coordinate of the Raster.final intgetMinY()Returns the minimum valid Y coordinate of the Raster.final intReturns the number of bands (samples per pixel) in this Raster.final intReturns the number of data elements needed to transfer one pixel via the getDataElements and setDataElements methods.Returns the parent Raster (if any) of this Raster or null.double[]getPixel(int x, int y, double[] dArray) Returns the samples in an array of double for the specified pixel.float[]getPixel(int x, int y, float[] fArray) Returns the samples in an array of float for the specified pixel.int[]getPixel(int x, int y, int[] iArray) Returns the samples in an array of int for the specified pixel.double[]getPixels(int x, int y, int w, int h, double[] dArray) Returns a double array containing all samples for a rectangle of pixels, one sample per array element.float[]getPixels(int x, int y, int w, int h, float[] fArray) Returns a float array containing all samples for a rectangle of pixels, one sample per array element.int[]getPixels(int x, int y, int w, int h, int[] iArray) Returns an int array containing all samples for a rectangle of pixels, one sample per array element.intgetSample(int x, int y, int b) Returns the sample in a specified band for the pixel located at (x,y) as an int.doublegetSampleDouble(int x, int y, int b) Returns the sample in a specified band for a pixel located at (x,y) as a double.floatgetSampleFloat(int x, int y, int b) Returns the sample in a specified band for the pixel located at (x,y) as a float.Returns the SampleModel that describes the layout of the image data.final intReturns the X translation from the coordinate system of the SampleModel to that of the Raster.final intReturns the Y translation from the coordinate system of the SampleModel to that of the Raster.double[]getSamples(int x, int y, int w, int h, int b, double[] dArray) Returns the samples for a specified band for a specified rectangle of pixels in a double array, one sample per array element.float[]getSamples(int x, int y, int w, int h, int b, float[] fArray) Returns the samples for a specified band for the specified rectangle of pixels in a float array, one sample per array element.int[]getSamples(int x, int y, int w, int h, int b, int[] iArray) Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element.final intReturns the TransferType used to transfer pixels via the getDataElements and setDataElements methods.final intgetWidth()Returns the width in pixels of the Raster.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
WritableRaster
Constructs a WritableRaster with the given SampleModel. The WritableRaster's upper left corner is origin and it is the same size as the SampleModel. A DataBuffer large enough to describe the WritableRaster is automatically created.- Parameters:
sampleModel- The SampleModel that specifies the layout.origin- The Point that specifies the origin.- Throws:
RasterFormatException- if computing eitherorigin.x + sampleModel.getWidth()ororigin.y + sampleModel.getHeight()results in integer overflow
-
WritableRaster
Constructs a WritableRaster with the given SampleModel and DataBuffer. The WritableRaster's upper left corner is origin and it is the same size as the SampleModel. The DataBuffer is not initialized and must be compatible with SampleModel.- Parameters:
sampleModel- The SampleModel that specifies the layout.dataBuffer- The DataBuffer that contains the image data.origin- The Point that specifies the origin.- Throws:
RasterFormatException- if computing eitherorigin.x + sampleModel.getWidth()ororigin.y + sampleModel.getHeight()results in integer overflow
-
WritableRaster
protected WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, WritableRaster parent) Constructs a WritableRaster with the given SampleModel, DataBuffer, and parent. aRegion specifies the bounding rectangle of the new Raster. When translated into the base Raster's coordinate system, aRegion must be contained by the base Raster. (The base Raster is the Raster's ancestor which has no parent.) sampleModelTranslate specifies the sampleModelTranslateX and sampleModelTranslateY values of the new Raster. Note that this constructor should generally be called by other constructors or create methods, it should not be used directly.- Parameters:
sampleModel- The SampleModel that specifies the layout.dataBuffer- The DataBuffer that contains the image data.aRegion- The Rectangle that specifies the image area.sampleModelTranslate- The Point that specifies the translation from SampleModel to Raster coordinates.parent- The parent (if any) of this raster.- Throws:
RasterFormatException- ifaRegionhas width or height less than or equal to zero, or computing eitheraRegion.x + aRegion.widthoraRegion.y + aRegion.heightresults in integer overflow
-
-
Method Details
-
getWritableParent
Returns the parent WritableRaster (if any) of this WritableRaster, or else null.- Returns:
- the parent of this
WritableRaster, ornull.
-
createWritableTranslatedChild
Create a WritableRaster with the same size, SampleModel and DataBuffer as this one, but with a different location. The new WritableRaster will possess a reference to the current WritableRaster, accessible through its getParent() and getWritableParent() methods.- Parameters:
childMinX- X coord of the upper left corner of the new Raster.childMinY- Y coord of the upper left corner of the new Raster.- Returns:
- a
WritableRasterthe same as this one except for the specified location. - Throws:
RasterFormatException- if computing eitherchildMinX + this.getWidth()orchildMinY + this.getHeight()results in integer overflow
-
createWritableChild
public WritableRaster createWritableChild(int parentX, int parentY, int w, int h, int childMinX, int childMinY, int[] bandList) Returns a new WritableRaster which shares all or part of this WritableRaster's DataBuffer. The new WritableRaster will possess a reference to the current WritableRaster, accessible through its getParent() and getWritableParent() methods.The parentX, parentY, width and height parameters form a Rectangle in this WritableRaster'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 WritableRaster.
The new WritableRaster may additionally be translated to a different coordinate system for the plane than that used by the current WritableRaster. The childMinX and childMinY parameters give the new (x, y) coordinate of the upper-left pixel of the returned WritableRaster; the coordinate (childMinX, childMinY) in the new WritableRaster will map to the same pixel as the coordinate (parentX, parentY) in the current WritableRaster.
The new WritableRaster may be defined to contain only a subset of the bands of the current WritableRaster, possibly reordered, by means of the bandList parameter. If bandList is null, it is taken to include all of the bands of the current WritableRaster in their current order.
To create a new WritableRaster that contains a subregion of the current WritableRaster, 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.
- Parameters:
parentX- X coordinate of the upper left corner in this WritableRaster's coordinates.parentY- Y coordinate of the upper left corner in this WritableRaster's coordinates.w- Width of the region starting at (parentX, parentY).h- Height of the region starting at (parentX, parentY).childMinX- X coordinate of the upper left corner of the returned WritableRaster.childMinY- Y coordinate of the upper left corner of the returned WritableRaster.bandList- Array of band indices, or null to use all bands.- Returns:
- a
WritableRastersharing all or part of theDataBufferof thisWritableRaster. - Throws:
RasterFormatException- if the subregion is outside of the raster bounds.RasterFormatException- ifworhis less than or equal to zero, or computing any ofparentX + w,parentY + h,childMinX + w, orchildMinY + hresults in integer overflow
-
setDataElements
Sets the data for a single pixel from 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 in the array may be in a packed format, thus increasing efficiency for data transfers. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds, or if inData is not large enough to hold the pixel data. However, explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is not null and references anything other than an array of TransferType.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.inData- An object reference to an array of type defined by getTransferType() and length getNumDataElements() containing the pixel data to place at x,y.- Throws:
ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if inData is too small to hold the input.- See Also:
-
setDataElements
Sets the data for a rectangle of pixels from an input Raster. The input Raster must be compatible with this WritableRaster in that they must have the same number of bands, corresponding bands must have the same number of bits per sample, the TransferTypes and NumDataElements must be the same, and the packing used by the getDataElements/setDataElements must be identical. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.inRaster- Raster containing data to place at x,y.- Throws:
NullPointerException- if inRaster is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds.
-
setDataElements
Sets the data for a rectangle of pixels from 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 in the array may be in a packed format, thus increasing efficiency for data transfers. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds, or if inData is not large enough to hold the pixel data. However, explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is not null and references anything other than an array of TransferType.- Parameters:
x- The X coordinate of the upper left pixel location.y- The Y coordinate of the upper left pixel location.w- Width of the pixel rectangle.h- Height of the pixel rectangle.inData- An object reference to an array of type defined by getTransferType() and length w*h*getNumDataElements() containing the pixel data to place between x,y and x+w-1, y+h-1.- Throws:
NullPointerException- if inData is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if inData is too small to hold the input.- See Also:
-
setRect
Copies pixels from Raster srcRaster to this WritableRaster. Each pixel in srcRaster is copied to the same x,y address in this raster, unless the address falls outside the bounds of this raster. srcRaster must have the same number of bands as this WritableRaster. The copy is a simple copy of source samples to the corresponding destination samples.If all samples of both source and destination Rasters are of integral type and less than or equal to 32 bits in size, then calling this method is equivalent to executing the following code for all
x,yaddresses valid in both Rasters.
Thus, when copying an integral type source to an integral type destination, if the source sample size is greater than the destination sample size for a particular band, the high order bits of the source sample are truncated. If the source sample size is less than the destination size for a particular band, the high order bits of the destination are zero-extended or sign-extended depending on whether srcRaster's SampleModel treats the sample as a signed or unsigned quantity.Raster srcRaster; WritableRaster dstRaster; for (int b = 0; b < srcRaster.getNumBands(); b++) { dstRaster.setSample(x, y, b, srcRaster.getSample(x, y, b)); }When copying a float or double source to an integral type destination, each source sample is cast to the destination type. When copying an integral type source to a float or double destination, the source is first converted to a 32-bit int (if necessary), using the above rules for integral types, and then the int is cast to float or double.
- Parameters:
srcRaster- The Raster from which to copy pixels.- Throws:
NullPointerException- if srcRaster is null.
-
setRect
Copies pixels from Raster srcRaster to this WritableRaster. For each (x, y) address in srcRaster, the corresponding pixel is copied to address (x+dx, y+dy) in this WritableRaster, unless (x+dx, y+dy) falls outside the bounds of this raster. srcRaster must have the same number of bands as this WritableRaster. The copy is a simple copy of source samples to the corresponding destination samples. For details, seesetRect(Raster).- Parameters:
dx- The X translation factor from src space to dst space of the copy.dy- The Y translation factor from src space to dst space of the copy.srcRaster- The Raster from which to copy pixels.- Throws:
NullPointerException- if srcRaster is null.
-
setPixel
public void setPixel(int x, int y, int[] iArray) Sets a pixel in the DataBuffer using an int array of samples for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.iArray- The input samples in a int array.- Throws:
NullPointerException- if iArray is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if iArray is too small to hold the input.
-
setPixel
public void setPixel(int x, int y, float[] fArray) Sets a pixel in the DataBuffer using a float array of samples for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.fArray- The input samples in a float array.- Throws:
NullPointerException- if fArray is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if fArray is too small to hold the input.
-
setPixel
public void setPixel(int x, int y, double[] dArray) Sets a pixel in the DataBuffer using a double array of samples for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.dArray- The input samples in a double array.- Throws:
NullPointerException- if dArray is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if dArray is too small to hold the input.
-
setPixels
public void setPixels(int x, int y, int w, int h, int[] iArray) Sets all samples for a rectangle of pixels from an int array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the upper left pixel location.y- The Y coordinate of the upper left pixel location.w- Width of the pixel rectangle.h- Height of the pixel rectangle.iArray- The input int pixel array.- Throws:
NullPointerException- if iArray is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if iArray is too small to hold the input.
-
setPixels
public void setPixels(int x, int y, int w, int h, float[] fArray) Sets all samples for a rectangle of pixels from a float array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the upper left pixel location.y- The Y coordinate of the upper left pixel location.w- Width of the pixel rectangle.h- Height of the pixel rectangle.fArray- The input float pixel array.- Throws:
NullPointerException- if fArray is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if fArray is too small to hold the input.
-
setPixels
public void setPixels(int x, int y, int w, int h, double[] dArray) Sets all samples for a rectangle of pixels from a double array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the upper left pixel location.y- The Y coordinate of the upper left pixel location.w- Width of the pixel rectangle.h- Height of the pixel rectangle.dArray- The input double pixel array.- Throws:
NullPointerException- if dArray is null.ArrayIndexOutOfBoundsException- if the coordinates are not in bounds, or if dArray is too small to hold the input.
-
setSample
public void setSample(int x, int y, int b, int s) Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.b- The band to set.s- The input sample.- Throws:
ArrayIndexOutOfBoundsException- if the coordinates or the band index are not in bounds.
-
setSample
public void setSample(int x, int y, int b, float s) Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.b- The band to set.s- The input sample as a float.- Throws:
ArrayIndexOutOfBoundsException- if the coordinates or the band index are not in bounds.
-
setSample
public void setSample(int x, int y, int b, double s) Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the pixel location.y- The Y coordinate of the pixel location.b- The band to set.s- The input sample as a double.- Throws:
ArrayIndexOutOfBoundsException- if the coordinates or the band index are not in bounds.
-
setSamples
public void setSamples(int x, int y, int w, int h, int b, int[] iArray) Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the upper left pixel location.y- The Y coordinate of the upper left pixel location.w- Width of the pixel rectangle.h- Height of the pixel rectangle.b- The band to set.iArray- The input int sample array.- Throws:
NullPointerException- if iArray is null.ArrayIndexOutOfBoundsException- if the coordinates or the band index are not in bounds, or if iArray is too small to hold the input.
-
setSamples
public void setSamples(int x, int y, int w, int h, int b, float[] fArray) Sets the samples in the specified band for the specified rectangle of pixels from a float array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the upper left pixel location.y- The Y coordinate of the upper left pixel location.w- Width of the pixel rectangle.h- Height of the pixel rectangle.b- The band to set.fArray- The input float sample array.- Throws:
NullPointerException- if fArray is null.ArrayIndexOutOfBoundsException- if the coordinates or the band index are not in bounds, or if fArray is too small to hold the input.
-
setSamples
public void setSamples(int x, int y, int w, int h, int b, double[] dArray) Sets the samples in the specified band for the specified rectangle of pixels from a double array containing one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.- Parameters:
x- The X coordinate of the upper left pixel location.y- The Y coordinate of the upper left pixel location.w- Width of the pixel rectangle.h- Height of the pixel rectangle.b- The band to set.dArray- The input double sample array.- Throws:
NullPointerException- if dArray is null.ArrayIndexOutOfBoundsException- if the coordinates or the band index are not in bounds, or if dArray is too small to hold the input.
-