java.awt.image
Class Raster

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.image.Raster
Direct Known Subclasses:
WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster

public class Raster
extends Object sample code for java.lang.Object definition code for java.lang.Object

A class representing a rectangular array of pixels. A Raster encapsulates a DataBuffer that stores the sample values and a SampleModel that describes how to locate a given sample value in a DataBuffer.

A Raster defines values for pixels occupying a particular rectangular area of the plane, not necessarily including (0, 0). The rectangle, known as the Raster's bounding rectangle and available by means of the getBounds method, is defined by minX, minY, width, and height values. The minX and minY values define the coordinate of the upper left corner of the Raster. References to pixels outside of the bounding rectangle may result in an exception being thrown, or may result in references to unintended elements of the Raster's associated DataBuffer. It is the user's responsibility to avoid accessing such pixels.

A SampleModel describes how samples of a Raster are stored in the primitive array elements of a DataBuffer. Samples may be stored one per data element, as in a PixelInterleavedSampleModel or BandedSampleModel, or packed several to an element, as in a SinglePixelPackedSampleModel or MultiPixelPackedSampleModel. The SampleModel is also controls whether samples are sign extended, allowing unsigned data to be stored in signed Java data types such as byte, short, and int.

Although a Raster may live anywhere in the plane, a SampleModel makes use of a simple coordinate system that starts at (0, 0). A Raster therefore contains a translation factor that allows pixel locations to be mapped between the Raster's coordinate system and that of the SampleModel. The translation from the SampleModel coordinate system to that of the Raster may be obtained by the getSampleModelTranslateX and getSampleModelTranslateY methods.

A Raster may share a DataBuffer with another Raster either by explicit construction or by the use of the createChild and createTranslatedChild methods. Rasters created by these methods can return a reference to the Raster they were created from by means of the getParent method. For a Raster that was not constructed by means of a call to createTranslatedChild or createChild, getParent will return null.

The createTranslatedChild method returns a new Raster that shares all of the data of the current Raster, but occupies a bounding rectangle of the same width and height but with a different starting point. For example, if the parent Raster occupied the region (10, 10) to (100, 100), and the translated Raster was defined to start at (50, 50), then pixel (20, 20) of the parent and pixel (60, 60) of the child occupy the same location in the DataBuffer shared by the two Rasters. In the first case, (-10, -10) should be added to a pixel coordinate to obtain the corresponding SampleModel coordinate, and in the second case (-50, -50) should be added.

The translation between a parent and child Raster may be determined by subtracting the child's sampleModelTranslateX and sampleModelTranslateY values from those of the parent.

The createChild method may be used to create a new Raster occupying only a subset of its parent's bounding rectangle (with the same or a translated coordinate system) or with a subset of the bands of its parent.

All constructors are protected. The correct way to create a Raster is to use one of the static create methods defined in this class. These methods create instances of Raster that use the standard Interleaved, Banded, and Packed SampleModels and that may be processed more efficiently than a Raster created by combining an externally generated SampleModel and DataBuffer.

See Also:
DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer , SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel , PixelInterleavedSampleModel sample code for java.awt.image.PixelInterleavedSampleModel definition code for java.awt.image.PixelInterleavedSampleModel , BandedSampleModel sample code for java.awt.image.BandedSampleModel definition code for java.awt.image.BandedSampleModel , SinglePixelPackedSampleModel sample code for java.awt.image.SinglePixelPackedSampleModel definition code for java.awt.image.SinglePixelPackedSampleModel , MultiPixelPackedSampleModel sample code for java.awt.image.MultiPixelPackedSampleModel definition code for java.awt.image.MultiPixelPackedSampleModel

Field Summary
protected  DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer dataBuffer sample code for java.awt.image.Raster.dataBuffer definition code for java.awt.image.Raster.dataBuffer
          The DataBuffer that stores the image data.
protected  int height sample code for java.awt.image.Raster.height definition code for java.awt.image.Raster.height
          The height of this Raster.
protected  int minX sample code for java.awt.image.Raster.minX definition code for java.awt.image.Raster.minX
          The X coordinate of the upper-left pixel of this Raster.
protected  int minY sample code for java.awt.image.Raster.minY definition code for java.awt.image.Raster.minY
          The Y coordinate of the upper-left pixel of this Raster.
protected  int numBands sample code for java.awt.image.Raster.numBands definition code for java.awt.image.Raster.numBands
          The number of bands in the Raster.
protected  int numDataElements sample code for java.awt.image.Raster.numDataElements definition code for java.awt.image.Raster.numDataElements
          The number of DataBuffer data elements per pixel.
protected  Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster parent sample code for java.awt.image.Raster.parent definition code for java.awt.image.Raster.parent
          The parent of this Raster, or null.
protected  SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel sampleModel sample code for java.awt.image.Raster.sampleModel definition code for java.awt.image.Raster.sampleModel
          The SampleModel that describes how pixels from this Raster are stored in the DataBuffer.
protected  int sampleModelTranslateX sample code for java.awt.image.Raster.sampleModelTranslateX definition code for java.awt.image.Raster.sampleModelTranslateX
          The X translation from the coordinate space of the Raster's SampleModel to that of the Raster.
protected  int sampleModelTranslateY sample code for java.awt.image.Raster.sampleModelTranslateY definition code for java.awt.image.Raster.sampleModelTranslateY
          The Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.
protected  int width sample code for java.awt.image.Raster.width definition code for java.awt.image.Raster.width
          The width of this Raster.
 
Constructor Summary
protected Raster sample code for java.awt.image.Raster.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) definition code for java.awt.image.Raster.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) (SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sampleModel, DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer, Point sample code for java.awt.Point definition code for java.awt.Point  origin)
          Constructs a Raster with the given SampleModel and DataBuffer.
protected Raster sample code for java.awt.image.Raster.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Rectangle, java.awt.Point, java.awt.image.Raster) definition code for java.awt.image.Raster.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Rectangle, java.awt.Point, java.awt.image.Raster) (SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sampleModel, DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer, Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  aRegion, Point sample code for java.awt.Point definition code for java.awt.Point  sampleModelTranslate, Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  parent)
          Constructs a Raster with the given SampleModel, DataBuffer, and parent.
protected Raster sample code for java.awt.image.Raster.Raster(java.awt.image.SampleModel, java.awt.Point) definition code for java.awt.image.Raster.Raster(java.awt.image.SampleModel, java.awt.Point) (SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sampleModel, Point sample code for java.awt.Point definition code for java.awt.Point  origin)
          Constructs a Raster with the given SampleModel.
 
Method Summary
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createBandedRaster sample code for java.awt.image.Raster.createBandedRaster(java.awt.image.DataBuffer, int, int, int, int[], int[], java.awt.Point) definition code for java.awt.image.Raster.createBandedRaster(java.awt.image.DataBuffer, int, int, int, int[], int[], java.awt.Point) (DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a BandedSampleModel with the specified DataBuffer, width, height, scanline stride, bank indices, and band offsets.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createBandedRaster sample code for java.awt.image.Raster.createBandedRaster(int, int, int, int, int[], int[], java.awt.Point) definition code for java.awt.image.Raster.createBandedRaster(int, int, int, int, int[], int[], java.awt.Point) (int dataType, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a BandedSampleModel with the specified data type, width, height, scanline stride, bank indices and band offsets.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createBandedRaster sample code for java.awt.image.Raster.createBandedRaster(int, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createBandedRaster(int, int, int, int, java.awt.Point) (int dataType, int w, int h, int bands, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a BandedSampleModel with the specified data type, width, height, and number of bands.
 Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster createChild sample code for java.awt.image.Raster.createChild(int, int, int, int, int, int, int[]) definition code for java.awt.image.Raster.createChild(int, int, int, int, int, int, int[]) (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.
 WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster() definition code for java.awt.image.Raster.createCompatibleWritableRaster() ()
          Create a compatible WritableRaster the same size as this Raster with the same SampleModel and a new initialized DataBuffer.
 WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster(int, int) definition code for java.awt.image.Raster.createCompatibleWritableRaster(int, int) (int w, int h)
          Create a compatible WritableRaster with the specified size, a new SampleModel, and a new initialized DataBuffer.
 WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster(int, int, int, int) definition code for java.awt.image.Raster.createCompatibleWritableRaster(int, int, int, int) (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.
 WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster(java.awt.Rectangle) definition code for java.awt.image.Raster.createCompatibleWritableRaster(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  rect)
          Create a compatible WritableRaster with location (minX, minY) and size (width, height) specified by rect, a new SampleModel, and a new initialized DataBuffer.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createInterleavedRaster sample code for java.awt.image.Raster.createInterleavedRaster(java.awt.image.DataBuffer, int, int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createInterleavedRaster(java.awt.image.DataBuffer, int, int, int, int, int[], java.awt.Point) (DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer, int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a PixelInterleavedSampleModel with the specified DataBuffer, width, height, scanline stride, pixel stride, and band offsets.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createInterleavedRaster sample code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, int, int[], java.awt.Point) (int dataType, int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, scanline stride, pixel stride, and band offsets.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createInterleavedRaster sample code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, java.awt.Point) (int dataType, int w, int h, int bands, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, and number of bands.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, int[], java.awt.Point) (DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer, int w, int h, int scanlineStride, int[] bandMasks, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a SinglePixelPackedSampleModel with the specified DataBuffer, width, height, scanline stride, and band masks.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, java.awt.Point) (DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer, int w, int h, int bitsPerPixel, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a MultiPixelPackedSampleModel with the specified DataBuffer, width, height, and bits per pixel.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(int, int, int, int[], java.awt.Point) (int dataType, int w, int h, int[] bandMasks, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster based on a SinglePixelPackedSampleModel with the specified data type, width, height, and band masks.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(int, int, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(int, int, int, int, int, java.awt.Point) (int dataType, int w, int h, int bands, int bitsPerBand, Point sample code for java.awt.Point definition code for java.awt.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 Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster createRaster sample code for java.awt.image.Raster.createRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) definition code for java.awt.image.Raster.createRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) (SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sm, DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  db, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a Raster with the specified SampleModel and DataBuffer.
 Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster createTranslatedChild sample code for java.awt.image.Raster.createTranslatedChild(int, int) definition code for java.awt.image.Raster.createTranslatedChild(int, int) (int childMinX, int childMinY)
          Create a Raster with the same size, SampleModel and DataBuffer as this one, but with a different location.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createWritableRaster sample code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) definition code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) (SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sm, DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  db, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a WritableRaster with the specified SampleModel and DataBuffer.
static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createWritableRaster sample code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.Point) definition code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.Point) (SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sm, Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Creates a WritableRaster with the specified SampleModel.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getBounds sample code for java.awt.image.Raster.getBounds() definition code for java.awt.image.Raster.getBounds() ()
          Returns the bounding Rectangle of this Raster.
 DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer getDataBuffer sample code for java.awt.image.Raster.getDataBuffer() definition code for java.awt.image.Raster.getDataBuffer() ()
          Returns the DataBuffer associated with this Raster.
 Object sample code for java.lang.Object definition code for java.lang.Object getDataElements sample code for java.awt.image.Raster.getDataElements(int, int, int, int, java.lang.Object) definition code for java.awt.image.Raster.getDataElements(int, int, int, int, java.lang.Object) (int x, int y, int w, int h, Object sample code for java.lang.Object definition code for java.lang.Object  outData)
          Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType.
 Object sample code for java.lang.Object definition code for java.lang.Object getDataElements sample code for java.awt.image.Raster.getDataElements(int, int, java.lang.Object) definition code for java.awt.image.Raster.getDataElements(int, int, java.lang.Object) (int x, int y, Object sample code for java.lang.Object definition code for java.lang.Object  outData)
          Returns data for a single pixel in a primitive array of type TransferType.
 int getHeight sample code for java.awt.image.Raster.getHeight() definition code for java.awt.image.Raster.getHeight() ()
          Returns the height in pixels of the Raster.
 int getMinX sample code for java.awt.image.Raster.getMinX() definition code for java.awt.image.Raster.getMinX() ()
          Returns the minimum valid X coordinate of the Raster.
 int getMinY sample code for java.awt.image.Raster.getMinY() definition code for java.awt.image.Raster.getMinY() ()
          Returns the minimum valid Y coordinate of the Raster.
 int getNumBands sample code for java.awt.image.Raster.getNumBands() definition code for java.awt.image.Raster.getNumBands() ()
          Returns the number of bands (samples per pixel) in this Raster.
 int getNumDataElements sample code for java.awt.image.Raster.getNumDataElements() definition code for java.awt.image.Raster.getNumDataElements() ()
          Returns the number of data elements needed to transfer one pixel via the getDataElements and setDataElements methods.
 Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster getParent sample code for java.awt.image.Raster.getParent() definition code for java.awt.image.Raster.getParent() ()
          Returns the parent Raster (if any) of this Raster or null.
 double[] getPixel sample code for java.awt.image.Raster.getPixel(int, int, double[]) definition code for java.awt.image.Raster.getPixel(int, int, double[]) (int x, int y, double[] dArray)
          Returns the samples in an array of double for the specified pixel.
 float[] getPixel sample code for java.awt.image.Raster.getPixel(int, int, float[]) definition code for java.awt.image.Raster.getPixel(int, int, float[]) (int x, int y, float[] fArray)
          Returns the samples in an array of float for the specified pixel.
 int[] getPixel sample code for java.awt.image.Raster.getPixel(int, int, int[]) definition code for java.awt.image.Raster.getPixel(int, int, int[]) (int x, int y, int[] iArray)
          Returns the samples in an array of int for the specified pixel.
 double[] getPixels sample code for java.awt.image.Raster.getPixels(int, int, int, int, double[]) definition code for java.awt.image.Raster.getPixels(int, int, int, int, double[]) (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 sample code for java.awt.image.Raster.getPixels(int, int, int, int, float[]) definition code for java.awt.image.Raster.getPixels(int, int, int, int, float[]) (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 sample code for java.awt.image.Raster.getPixels(int, int, int, int, int[]) definition code for java.awt.image.Raster.getPixels(int, int, int, int, int[]) (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.
 int getSample sample code for java.awt.image.Raster.getSample(int, int, int) definition code for java.awt.image.Raster.getSample(int, int, int) (int x, int y, int b)
          Returns the sample in a specified band for the pixel located at (x,y) as an int.
 double getSampleDouble sample code for java.awt.image.Raster.getSampleDouble(int, int, int) definition code for java.awt.image.Raster.getSampleDouble(int, int, int) (int x, int y, int b)
          Returns the sample in a specified band for a pixel located at (x,y) as a double.
 float getSampleFloat sample code for java.awt.image.Raster.getSampleFloat(int, int, int) definition code for java.awt.image.Raster.getSampleFloat(int, int, int) (int x, int y, int b)
          Returns the sample in a specified band for the pixel located at (x,y) as a float.
 SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel getSampleModel sample code for java.awt.image.Raster.getSampleModel() definition code for java.awt.image.Raster.getSampleModel() ()
          Returns the SampleModel that describes the layout of the image data.
 int getSampleModelTranslateX sample code for java.awt.image.Raster.getSampleModelTranslateX() definition code for java.awt.image.Raster.getSampleModelTranslateX() ()
          Returns the X translation from the coordinate system of the SampleModel to that of the Raster.
 int getSampleModelTranslateY sample code for java.awt.image.Raster.getSampleModelTranslateY() definition code for java.awt.image.Raster.getSampleModelTranslateY() ()
          Returns the Y translation from the coordinate system of the SampleModel to that of the Raster.
 double[] getSamples sample code for java.awt.image.Raster.getSamples(int, int, int, int, int, double[]) definition code for java.awt.image.Raster.getSamples(int, int, int, int, int, double[]) (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 sample code for java.awt.image.Raster.getSamples(int, int, int, int, int, float[]) definition code for java.awt.image.Raster.getSamples(int, int, int, int, int, float[]) (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 sample code for java.awt.image.Raster.getSamples(int, int, int, int, int, int[]) definition code for java.awt.image.Raster.getSamples(int, int, int, int, int, int[]) (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.
 int getTransferType sample code for java.awt.image.Raster.getTransferType() definition code for java.awt.image.Raster.getTransferType() ()
          Returns the TransferType used to transfer pixels via the getDataElements and setDataElements methods.
 int getWidth sample code for java.awt.image.Raster.getWidth() definition code for java.awt.image.Raster.getWidth() ()
          Returns the width in pixels of the Raster.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

sampleModel sample code for java.awt.image.Raster.sampleModel

protected SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sampleModel
The SampleModel that describes how pixels from this Raster are stored in the DataBuffer.


dataBuffer sample code for java.awt.image.Raster.dataBuffer

protected DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer
The DataBuffer that stores the image data.


minX sample code for java.awt.image.Raster.minX

protected int minX
The X coordinate of the upper-left pixel of this Raster.


minY sample code for java.awt.image.Raster.minY

protected int minY
The Y coordinate of the upper-left pixel of this Raster.


width sample code for java.awt.image.Raster.width

protected int width
The width of this Raster.


height sample code for java.awt.image.Raster.height

protected int height
The height of this Raster.


sampleModelTranslateX sample code for java.awt.image.Raster.sampleModelTranslateX

protected int sampleModelTranslateX
The X translation from the coordinate space of the Raster's SampleModel to that of the Raster.


sampleModelTranslateY sample code for java.awt.image.Raster.sampleModelTranslateY

protected int sampleModelTranslateY
The Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.


numBands sample code for java.awt.image.Raster.numBands

protected int numBands
The number of bands in the Raster.


numDataElements sample code for java.awt.image.Raster.numDataElements

protected int numDataElements
The number of DataBuffer data elements per pixel.


parent sample code for java.awt.image.Raster.parent

protected Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  parent
The parent of this Raster, or null.

Constructor Detail

Raster sample code for java.awt.image.Raster(java.awt.image.SampleModel, java.awt.Point) definition code for java.awt.image.Raster(java.awt.image.SampleModel, java.awt.Point)

protected Raster(SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sampleModel,
                 Point sample code for java.awt.Point definition code for java.awt.Point  origin)
Constructs a Raster with the given SampleModel. The Raster's upper left corner is origin and it is the same size as the SampleModel. A DataBuffer large enough to describe the Raster is automatically created.

Parameters:
sampleModel - The SampleModel that specifies the layout
origin - The Point that specified the origin
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if computing either origin.x + sampleModel.getWidth() or origin.y + sampleModel.getHeight() results in integer overflow
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - either sampleModel or origin is null

Raster sample code for java.awt.image.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) definition code for java.awt.image.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point)

protected Raster(SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sampleModel,
                 DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer,
                 Point sample code for java.awt.Point definition code for java.awt.Point  origin)
Constructs a Raster with the given SampleModel and DataBuffer. The Raster'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 sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if computing either origin.x + sampleModel.getWidth() or origin.y + sampleModel.getHeight() results in integer overflow
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - either sampleModel or origin is null

Raster sample code for java.awt.image.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Rectangle, java.awt.Point, java.awt.image.Raster) definition code for java.awt.image.Raster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Rectangle, java.awt.Point, java.awt.image.Raster)

protected Raster(SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sampleModel,
                 DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer,
                 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  aRegion,
                 Point sample code for java.awt.Point definition code for java.awt.Point  sampleModelTranslate,
                 Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  parent)
Constructs a Raster 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:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if any of sampleModel, dataBuffer, aRegion or sampleModelTranslate is null
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if aRegion has width or height less than or equal to zero, or computing either aRegion.x + aRegion.width or aRegion.y + aRegion.height results in integer overflow
Method Detail

createInterleavedRaster sample code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createInterleavedRaster(int dataType,
                                                     int w,
                                                     int h,
                                                     int bands,
                                                     Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
bands - the number of bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height and number of bands.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow

createInterleavedRaster sample code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createInterleavedRaster(int, int, int, int, int, int[], java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createInterleavedRaster(int dataType,
                                                     int w,
                                                     int h,
                                                     int scanlineStride,
                                                     int pixelStride,
                                                     int[] bandOffsets,
                                                     Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
pixelStride - the pixel stride of the image data
bandOffsets - the offsets of all bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, scanline stride, pixel stride and band offsets.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, or DataBuffer.TYPE_USHORT.

createBandedRaster sample code for java.awt.image.Raster.createBandedRaster(int, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createBandedRaster(int, int, int, int, java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createBandedRaster(int dataType,
                                                int w,
                                                int h,
                                                int bands,
                                                Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
bands - the number of bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height and number of bands.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if bands is less than 1

createBandedRaster sample code for java.awt.image.Raster.createBandedRaster(int, int, int, int, int[], int[], java.awt.Point) definition code for java.awt.image.Raster.createBandedRaster(int, int, int, int, int[], int[], java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createBandedRaster(int dataType,
                                                int w,
                                                int h,
                                                int scanlineStride,
                                                int[] bankIndices,
                                                int[] bandOffsets,
                                                Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
bankIndices - the bank indices for each band
bandOffsets - the offsets of all bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, scanline stride, bank indices and band offsets.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if bankIndices or bandOffsets is null

createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(int, int, int, int[], java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createPackedRaster(int dataType,
                                                int w,
                                                int h,
                                                int[] bandMasks,
                                                Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
bandMasks - an array containing an entry for each band
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, and band masks.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT

createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(int, int, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(int, int, int, int, int, java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createPackedRaster(int dataType,
                                                int w,
                                                int h,
                                                int bands,
                                                int bitsPerBand,
                                                Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
bands - the number of bands
bitsPerBand - the number of bits per band
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, number of bands, and bits per band.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the product of bitsPerBand and bands is greater than the number of bits held by dataType
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if bitsPerBand or bands is not greater than zero
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT

createInterleavedRaster sample code for java.awt.image.Raster.createInterleavedRaster(java.awt.image.DataBuffer, int, int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createInterleavedRaster(java.awt.image.DataBuffer, int, int, int, int, int[], java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createInterleavedRaster(DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer,
                                                     int w,
                                                     int h,
                                                     int scanlineStride,
                                                     int pixelStride,
                                                     int[] bandOffsets,
                                                     Point sample code for java.awt.Point definition code for java.awt.Point  location)
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().

Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
pixelStride - the pixel stride of the image data
bandOffsets - the offsets of all bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, scanline stride, pixel stride and band offsets.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if dataBuffer has more than one bank.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if dataBuffer is null

createBandedRaster sample code for java.awt.image.Raster.createBandedRaster(java.awt.image.DataBuffer, int, int, int, int[], int[], java.awt.Point) definition code for java.awt.image.Raster.createBandedRaster(java.awt.image.DataBuffer, int, int, int, int[], int[], java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createBandedRaster(DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer,
                                                int w,
                                                int h,
                                                int scanlineStride,
                                                int[] bankIndices,
                                                int[] bandOffsets,
                                                Point sample code for java.awt.Point definition code for java.awt.Point  location)
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.

Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
bankIndices - the bank indices for each band
bandOffsets - the offsets of all bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, scanline stride, bank indices and band offsets.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if dataBuffer is null

createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, int[], java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, int[], java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createPackedRaster(DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer,
                                                int w,
                                                int h,
                                                int scanlineStride,
                                                int[] bandMasks,
                                                Point sample code for java.awt.Point definition code for java.awt.Point  location)
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.

Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
bandMasks - an array containing an entry for each band
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, scanline stride, and band masks.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if dataBuffer has more than one bank.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if dataBuffer is null

createPackedRaster sample code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, java.awt.Point) definition code for java.awt.image.Raster.createPackedRaster(java.awt.image.DataBuffer, int, int, int, java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createPackedRaster(DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  dataBuffer,
                                                int w,
                                                int h,
                                                int bitsPerPixel,
                                                Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
bitsPerPixel - the number of bits for each pixel
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, and bits per pixel.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if dataBuffer has more than one bank.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if dataBuffer is null

createRaster sample code for java.awt.image.Raster.createRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) definition code for java.awt.image.Raster.createRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point)

public static Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  createRaster(SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sm,
                                  DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  db,
                                  Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
sm - the specified SampleModel
db - the specified DataBuffer
location - the upper-left corner of the Raster
Returns:
a Raster with the specified SampleModel, DataBuffer, and location.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if computing either location.x + sm.getWidth() or location.y + sm.getHeight() results in integer overflow
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if dataBuffer has more than one bank and the sampleModel is PixelInterleavedSampleModel, SinglePixelPackedSampleModel, or MultiPixelPackedSampleModel.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if either SampleModel or DataBuffer is null

createWritableRaster sample code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.Point) definition code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createWritableRaster(SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sm,
                                                  Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
sm - the specified SampleModel
location - the upper-left corner of the WritableRaster
Returns:
a WritableRaster with the specified SampleModel and location.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if computing either location.x + sm.getWidth() or location.y + sm.getHeight() results in integer overflow

createWritableRaster sample code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point) definition code for java.awt.image.Raster.createWritableRaster(java.awt.image.SampleModel, java.awt.image.DataBuffer, java.awt.Point)

public static WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createWritableRaster(SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  sm,
                                                  DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  db,
                                                  Point sample code for java.awt.Point definition code for java.awt.Point  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.

Parameters:
sm - the specified SampleModel
db - the specified DataBuffer
location - the upper-left corner of the WritableRaster
Returns:
a WritableRaster with the specified SampleModel, DataBuffer, and location.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if computing either location.x + sm.getWidth() or location.y + sm.getHeight() results in integer overflow
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if dataBuffer has more than one bank and the sampleModel is PixelInterleavedSampleModel, SinglePixelPackedSampleModel, or MultiPixelPackedSampleModel.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if either SampleModel or DataBuffer is null

getParent sample code for java.awt.image.Raster.getParent() definition code for java.awt.image.Raster.getParent()

public Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  getParent()
Returns the parent Raster (if any) of this Raster or null.

Returns:
the parent Raster or null.

getSampleModelTranslateX sample code for java.awt.image.Raster.getSampleModelTranslateX() definition code for java.awt.image.Raster.getSampleModelTranslateX()

public final int getSampleModelTranslateX()
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.

Returns:
the X translation from the coordinate space of the Raster's SampleModel to that of the Raster.

getSampleModelTranslateY sample code for java.awt.image.Raster.getSampleModelTranslateY() definition code for java.awt.image.Raster.getSampleModelTranslateY()

public final int getSampleModelTranslateY()
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.

Returns:
the Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.

createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster() definition code for java.awt.image.Raster.createCompatibleWritableRaster()

public WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createCompatibleWritableRaster()
Create a compatible WritableRaster the same size as this Raster with the same SampleModel and a new initialized DataBuffer.

Returns:
a compatible WritableRaster with the same sample model and a new data buffer.

createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster(int, int) definition code for java.awt.image.Raster.createCompatibleWritableRaster(int, int)

public WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createCompatibleWritableRaster(int w,
                                                     int h)
Create a compatible WritableRaster with the specified size, a new SampleModel, and a new initialized DataBuffer.

Parameters:
w - the specified width of the new WritableRaster
h - the specified height of the new WritableRaster
Returns:
a compatible WritableRaster with the specified size and a new sample model and data buffer.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if the width or height is less than or equal to zero.

createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster(java.awt.Rectangle) definition code for java.awt.image.Raster.createCompatibleWritableRaster(java.awt.Rectangle)

public WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  createCompatibleWritableRaster(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  rect)
Create a compatible WritableRaster with location (minX, minY) and size (width, height) specified by rect, a new SampleModel, and a new initialized DataBuffer.

Parameters:
rect - a Rectangle that specifies the size and location of the WritableRaster
Returns:
a compatible WritableRaster with the specified size and location and a new sample model and data buffer.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if rect has width or height less than or equal to zero, or computing either rect.x + rect.width or rect.y + rect.height results in integer overflow
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if rect is null

createCompatibleWritableRaster sample code for java.awt.image.Raster.createCompatibleWritableRaster(int, int, int, int) definition code for java.awt.image.Raster.createCompatibleWritableRaster(int, int, int, int)

public WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster  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.

Parameters:
x, y - the coordinates of the upper-left corner of the WritableRaster
w - the specified width of the WritableRaster
h - the specified height of the WritableRaster
Returns:
a compatible WritableRaster with the specified size and location and a new sample model and data buffer.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if w or h is less than or equal to zero, or computing either x + w or y + h results in integer overflow

createTranslatedChild sample code for java.awt.image.Raster.createTranslatedChild(int, int) definition code for java.awt.image.Raster.createTranslatedChild(int, int)

public Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  createTranslatedChild(int childMinX,
                                    int childMinY)
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.

Parameters:
childMinX, childMinY - coordinates of the upper-left corner of the new Raster
Returns:
a new Raster with the same size, SampleModel, and DataBuffer as this Raster, but with the specified location.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if computing either childMinX + this.getWidth() or childMinY + this.getHeight() results in integer overflow

createChild sample code for java.awt.image.Raster.createChild(int, int, int, int, int, int, int[]) definition code for java.awt.image.Raster.createChild(int, int, int, int, int, int, int[])

public Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  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. 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.

Parameters:
parentX, parentY - coordinates of the upper-left corner in this Raster's coordinates
width - Width of the region starting at (parentX, parentY)
height - Height of the region starting at (parentX, parentY).
childMinX, childMinY - coordinates of the upper-left corner of the returned Raster
bandList - Array of band indices, or null to use all bands
Returns:
a new Raster.
Throws:
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if the specified subregion is outside of the raster bounds.
RasterFormatException sample code for java.awt.image.RasterFormatException definition code for java.awt.image.RasterFormatException - if width or height is less than or equal to zero, or computing any of parentX + width, parentY + height, childMinX + width, or childMinY + height results in integer overflow

getBounds sample code for java.awt.image.Raster.getBounds() definition code for java.awt.image.Raster.getBounds()

public Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  getBounds()
Returns the bounding Rectangle of this Raster. This function returns the same information as getMinX/MinY/Width/Height.

Returns:
the bounding box of this Raster.

getMinX sample code for java.awt.image.Raster.getMinX() definition code for java.awt.image.Raster.getMinX()

public final int getMinX()
Returns the minimum valid X coordinate of the Raster.

Returns:
the minimum x coordinate of this Raster.

getMinY sample code for java.awt.image.Raster.getMinY() definition code for java.awt.image.Raster.getMinY()

public final int getMinY()
Returns the minimum valid Y coordinate of the Raster.

Returns:
the minimum y coordinate of this Raster.

getWidth sample code for java.awt.image.Raster.getWidth() definition code for java.awt.image.Raster.getWidth()

public final int getWidth()
Returns the width in pixels of the Raster.

Returns:
the width of this Raster.

getHeight sample code for java.awt.image.Raster.getHeight() definition code for java.awt.image.Raster.getHeight()

public final int getHeight()
Returns the height in pixels of the Raster.

Returns:
the height of this Raster.

getNumBands sample code for java.awt.image.Raster.getNumBands() definition code for java.awt.image.Raster.getNumBands()

public final int getNumBands()
Returns the number of bands (samples per pixel) in this Raster.

Returns:
the number of bands of this Raster.

getNumDataElements sample code for java.awt.image.Raster.getNumDataElements() definition code for java.awt.image.Raster.getNumDataElements()

public final int 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.

Returns:
the number of data elements.

getTransferType sample code for java.awt.image.Raster.getTransferType() definition code for java.awt.image.Raster.getTransferType()

public final int 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.

Returns:
this transfer type.

getDataBuffer sample code for java.awt.image.Raster.getDataBuffer() definition code for java.awt.image.Raster.getDataBuffer()

public DataBuffer sample code for java.awt.image.DataBuffer definition code for java.awt.image.DataBuffer  getDataBuffer()
Returns the DataBuffer associated with this Raster.

Returns:
the DataBuffer of this Raster.

getSampleModel sample code for java.awt.image.Raster.getSampleModel() definition code for java.awt.image.Raster.getSampleModel()

public SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel  getSampleModel()
Returns the SampleModel that describes the layout of the image data.

Returns:
the SampleModel of this Raster.

getDataElements sample code for java.awt.image.Raster.getDataElements(int, int, java.lang.Object) definition code for java.awt.image.Raster.getDataElements(int, int, java.lang.Object)

public Object sample code for java.lang.Object definition code for java.lang.Object  getDataElements(int x,
                              int y,
                              Object sample code for java.lang.Object definition code for java.lang.Object  outData)
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.

Parameters:
x, y - the coordinates of the pixel location
outData - An object reference to an array of type defined by getTransferType() and length getNumDataElements(). If null, an array of appropriate type and size will be allocated
Returns:
An object reference to an array of type defined by getTransferType() with the requested pixel data.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if outData is too small to hold the output.
See Also:
SampleModel.getDataElements(int, int, Object, DataBuffer) sample code for java.awt.image.SampleModel.getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer) definition code for java.awt.image.SampleModel.getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)

getDataElements sample code for java.awt.image.Raster.getDataElements(int, int, int, int, java.lang.Object) definition code for java.awt.image.Raster.getDataElements(int, int, int, int, java.lang.Object)

public Object sample code for java.lang.Object definition code for java.lang.Object  getDataElements(int x,
                              int y,
                              int w,
                              int h,
                              Object sample code for java.lang.Object definition code for java.lang.Object  outData)
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.

Parameters:
x, y - the coordinates of the upper-left pixel location
w - Width of the pixel rectangle
h - Height of the pixel rectangle
outData - An object reference to an array of type defined by getTransferType() and length w*h*getNumDataElements(). If null, an array of appropriate type and size will be allocated.
Returns:
An object reference to an array of type defined by getTransferType() with the requested pixel data.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if outData is too small to hold the output.
See Also:
SampleModel.getDataElements(int, int, int, int, Object, DataBuffer) sample code for java.awt.image.SampleModel.getDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer) definition code for java.awt.image.SampleModel.getDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)

getPixel sample code for java.awt.image.Raster.getPixel(int, int, int[]) definition code for java.awt.image.Raster.getPixel(int, int, int[])

public int[] getPixel(int x,
                      int y,
                      int[] iArray)
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.

Parameters:
x, y - the coordinates of the pixel location
iArray - An optionally preallocated int array
Returns:
the samples for the specified pixel.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if iArray is too small to hold the output.

getPixel sample code for java.awt.image.Raster.getPixel(int, int, float[]) definition code for java.awt.image.Raster.getPixel(int, int, float[])

public float[] getPixel(int x,
                        int y,
                        float[] fArray)
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.

Parameters:
x, y - the coordinates of the pixel location
fArray - An optionally preallocated float array
Returns:
the samples for the specified pixel.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if fArray is too small to hold the output.

getPixel sample code for java.awt.image.Raster.getPixel(int, int, double[]) definition code for java.awt.image.Raster.getPixel(int, int, double[])

public double[] getPixel(int x,
                         int y,
                         double[] dArray)
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.

Parameters:
x, y - the coordinates of the pixel location
dArray - An optionally preallocated double array
Returns:
the samples for the specified pixel.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if dArray is too small to hold the output.

getPixels sample code for java.awt.image.Raster.getPixels(int, int, int, int, int[]) definition code for java.awt.image.Raster.getPixels(int, int, int, int, int[])

public 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. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.

Parameters:
x, y - the coordinates of the upper-left pixel location
w - Width of the pixel rectangle
h - Height of the pixel rectangle
iArray - An optionally pre-allocated int array
Returns:
the samples for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if iArray is too small to hold the output.

getPixels sample code for java.awt.image.Raster.getPixels(int, int, int, int, float[]) definition code for java.awt.image.Raster.getPixels(int, int, int, int, float[])

public 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. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.

Parameters:
x, y - the coordinates of the pixel location
w - Width of the pixel rectangle
h - Height of the pixel rectangle
fArray - An optionally pre-allocated float array
Returns:
the samples for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if fArray is too small to hold the output.

getPixels sample code for java.awt.image.Raster.getPixels(int, int, int, int, double[]) definition code for java.awt.image.Raster.getPixels(int, int, int, int, double[])

public 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. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.

Parameters:
x, y - the coordinates of the upper-left pixel location
w - Width of the pixel rectangle
h - Height of the pixel rectangle
dArray - An optionally pre-allocated double array
Returns:
the samples for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if dArray is too small to hold the output.

getSample sample code for java.awt.image.Raster.getSample(int, int, int) definition code for java.awt.image.Raster.getSample(int, int, int)

public int getSample(int x,
                     int y,
                     int b)
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.

Parameters:
x, y - the coordinates of the pixel location
b - The band to return
Returns:
the sample in the specified band for the pixel at the specified coordinate.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds.

getSampleFloat sample code for java.awt.image.Raster.getSampleFloat(int, int, int) definition code for java.awt.image.Raster.getSampleFloat(int, int, int)

public float getSampleFloat(int x,
                            int y,
                            int b)
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.

Parameters:
x, y - the coordinates of the pixel location
b - The band to return
Returns:
the sample in the specified band for the pixel at the specified coordinate.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds.

getSampleDouble sample code for java.awt.image.Raster.getSampleDouble(int, int, int) definition code for java.awt.image.Raster.getSampleDouble(int, int, int)

public double getSampleDouble(int x,
                              int y,
                              int b)
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.

Parameters:
x, y - the coordinates of the pixel location
b - The band to return
Returns:
the sample in the specified band for the pixel at the specified coordinate.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds.

getSamples sample code for java.awt.image.Raster.getSamples(int, int, int, int, int, int[]) definition code for java.awt.image.Raster.getSamples(int, int, int, int, int, int[])

public 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. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.

Parameters:
x, y - the coordinates of the upper-left pixel location
w - Width of the pixel rectangle
h - Height of the pixel rectangle
b - The band to return
iArray - An optionally pre-allocated int array
Returns:
the samples for the specified band for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds, or if iArray is too small to hold the output.

getSamples sample code for java.awt.image.Raster.getSamples(int, int, int, int, int, float[]) definition code for java.awt.image.Raster.getSamples(int, int, int, int, int, float[])

public 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. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.

Parameters:
x, y - the coordinates of the upper-left pixel location
w - Width of the pixel rectangle
h - Height of the pixel rectangle
b - The band to return
fArray - An optionally pre-allocated float array
Returns:
the samples for the specified band for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds, or if fArray is too small to hold the output.

getSamples sample code for java.awt.image.Raster.getSamples(int, int, int, int, int, double[]) definition code for java.awt.image.Raster.getSamples(int, int, int, int, int, double[])

public 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. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.

Parameters:
x, y - the coordinates of the upper-left pixel location
w - Width of the pixel rectangle
h - Height of the pixel rectangle
b - The band to return
dArray - An optionally pre-allocated double array
Returns:
the samples for the specified band for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds, or if dArray is too small to hold the output.