All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.image.WritableRaster

java.lang.Object
    |
    +----java.awt.image.Raster
            |
            +----java.awt.image.WritableRaster

public class WritableRaster
extends Raster
This class provides methods for storing image data and inherits methods for retrieving image data from it's parent class Raster. It contains a DataBuffer object that holds a buffer of image data in some format, a SampleModel which describes th formate and is capabable of storing and retrieving Samples from the DataBuffer and a Rect that defines the WritableRaster's coordinate space. (Upper left corner, width and height.)


Constructor Index

 o WritableRaster(SampleModel, DataBuffer, Point)
Constructs a WritableRaster with the given SampleModel and DataBuffer.
 o WritableRaster(SampleModel, DataBuffer, Rectangle, Point, WritableRaster)
Constructs a WriteableRaster with the given SampleModel, DataBuffer, and parent.
 o WritableRaster(SampleModel, Point)
Constructs a WritableRaster with the given SampleModel.

Method Index

 o createWritableSubRaster(int, int, int, int)
Returns a WritableRaster which references this WritableRaster's DataBuffer.
 o createWritableSubRaster(int, int, int, int, int, int, int[])
Returns a translated WritableRaster which references this WriteableRaster's DataBuffer.
 o createWritableSubRaster(Rectangle)
Creates a subraster given a region of the raster.
 o getWritableParent()
Returns the parent WritableRaster (if any) of this Raster.
 o setPixel(int, int, double[])
Sets a pixel in the DataBuffer using a double array for input specified pixel.
 o setPixel(int, int, float[])
Sets a pixel in the DataBuffer using a float array for input specified pixel.
 o setPixel(int, int, int, int, double[])
Sets region of pixels using in input pixel array.
 o setPixel(int, int, int, int, float[])
Sets region of pixels using in input pixel array.
 o setPixel(int, int, int, int, int[])
Sets a region of pixels using in input pixel array.
 o setPixel(int, int, int[])
Sets a pixel in the DataBuffer using an int array for input.
 o setPixelData(int, int, int, int, Object)
Stores an array of data elements into the specified rectangular region.
 o setPixelData(int, int, Object)
Stores the data elements for all channels at the specified location.
 o setPixelData(int, int, Raster)
Stores the Raster data at the specified location.
 o setRect(int, int, Raster)
Copies pixels from Raster srcRaster to this WritableRaster.
 o setRect(Raster)
Copies pixels from Raster srcRaster to this WritableRaster.
 o setSample(int, int, int, double)
Sets a sample in the DataBuffer using a double array for input.
 o setSample(int, int, int, float)
Sets a sample in the DataBuffer using a float array for input.
 o setSample(int, int, int, int)
Sets a sample in the DataBuffer using a int for input.
 o setSample(int, int, int, int, int, double[])
Sets a region of samples using an input double buffer as input.
 o setSample(int, int, int, int, int, float[])
Sets a region of samples using an input float buffer as input.
 o setSample(int, int, int, int, int, int[])
Sets a region of samples using an input integer buffer as input.

Constructors

 o WritableRaster
protected WritableRaster(SampleModel sampleModel,
                         Point origin)
Constructs a WritableRaster with the given SampleModel. The WritableRaster's upper left corner is origin and it is the same size as the SampleModel. A DataBuffer large enough to describe the WriteableRaster is automatically created.

Parameters:
sampleModel - The SampleModel that specifies the layout.
origin - The Point that specified the origin.
 o WritableRaster
protected WritableRaster(SampleModel sampleModel,
                         DataBuffer dataBuffer,
                         Point origin)
Constructs a WritableRaster with the given SampleModel and DataBuffer. The WritableRaster's upper left corner is origin and it is the same size as the SampleModel. The DataBuffer is not initialized and must be compatible with SampleModel.

Parameters:
sampleModel - The SampleModel that specifies the layout.
dataBuffer - The DataBufferShort that contains the image data.
origin - The Point that specifies the origin.
 o WritableRaster
protected WritableRaster(SampleModel sampleModel,
                         DataBuffer dataBuffer,
                         Rectangle aRegion,
                         Point origin,
                         WritableRaster parent)
Constructs a WriteableRaster with the given SampleModel, DataBuffer, and parent. When translated into the base Raster's coordinate system, aRegion must be contained by the base Raster. Origin is the coodinate in the new Raster's coordinate system of the origin of the base Raster. (The base Raster is the Raster's ancestor which has no parent.) The parameter parent must be a WritableRaster or an exception will be thrown. 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 DataBufferShort that contains the image data.
aRegion - The Rectangle that specifies the image area.
origin - The Point that specifies the origin.
parent - The parent (if any) of this raster.

Methods

 o getWritableParent
public WritableRaster getWritableParent()
Returns the parent WritableRaster (if any) of this Raster.

 o createWritableSubRaster
public WritableRaster createWritableSubRaster(int x,
                                              int y,
                                              int w,
                                              int h)
Returns a WritableRaster which references this WritableRaster's DataBuffer. x,y, width and height form a rectangle in this WritableRaster's coordinate space. An error is thrown if this rectangle is not fully contained by this Raster

Parameters:
x - The X coordinate of the upper left hand corner.
y - The Y coordinate of the upper left hand corner.
width - Width of the region starting at (x,y).
height - Height of the region starting at (x,y).
 o createWritableSubRaster
public WritableRaster createWritableSubRaster(Rectangle r)
Creates a subraster given a region of the raster. Returns a WritableRaster which references this WritableRaster's DataBuffer.

Parameters:
rect - is a rectangle in this WritableRaster's coordinate space. An error is thrown if rect is not fully contained by this WriteableRaster.
rect - The rectangle specifying the dimensions of the subraster.
 o createWritableSubRaster
public WritableRaster createWritableSubRaster(int x,
                                              int y,
                                              int w,
                                              int h,
                                              int x0,
                                              int y0,
                                              int[] bandList)
Returns a translated WritableRaster which references this WriteableRaster's DataBuffer. The parameters x,y, width and height form a rectangle. The new WritableRaster's coordinate system has an upper left corner of x0, y0. An error is thrown if rectangle is not fully contained by this WritableRaster.

Parameters:
x - X of the upper left corner in this Raster's coordinates.
y - Y of the upper left corner in this Raster's coordinates.
width - Width of the region starting at (x,y).
height - Height of the region starting at (x,y).
x0 - X of the upper left corner of returned Raster.
y0 - Y of the upper left corner of returned Raster.
bandList - Array of band indices.
 o setPixelData
public void setPixelData(int x,
                         int y,
                         Object obj)
Stores the data elements for all channels at the specified location. There will be no explicit bounds checking on the parameters. An ArrayOutOfBounds exception will be thrown at runtime if data outside of the array is accessed. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
inData - An object reference to an array of type defined by getTransferType() and length getNumDataElements() containing the pixel data to place at x,y.
 o setPixelData
public void setPixelData(int x,
                         int y,
                         Raster inRaster)
Stores the Raster data at the specified location. There will be no explicit bounds checking on the parameters. An ArrayOutOfBounds exception will be thrown at runtime if data outside of the array is accessed.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
inRaster - Raster of data to place at x,y location.
 o setPixelData
public void setPixelData(int x,
                         int y,
                         int w,
                         int h,
                         Object obj)
Stores an array of data elements into the specified rectangular region. There will be no explicit bounds checking on the parameters. An ArrayOutOfBounds exception will be thrown at runtime if data outside of the array is accessed. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.

Parameters:
x - The X coordinate of the upper left pixel location.
y - The Y coordinate of the upper left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
inData - An object reference to an array of type defined by getTransferType() and length w*h*getNumDataElements() containing the pixel data to place between x,y and x+h, y+h.
 o setRect
public void setRect(Raster srcRaster)
Copies pixels from Raster srcRaster to this WritableRaster. Each pixel in srcRaster is copied to the same x,y address in this raster, unless the address falls outside the bounds of this raster.

Parameters:
srcRaster - The Raster from which to copy pixels.
 o setRect
public void setRect(int x,
                    int y,
                    Raster srcRaster)
Copies pixels from Raster srcRaster to this WritableRaster. For each a,b address in srcRaster, the corresponding pixel is copied to address a+x, b+y in this raster, unless a+x,b+y falls outside the bounds of this raster.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
srcRaster - The Raster from which to copy pixels.
 o setPixel
public void setPixel(int x,
                     int y,
                     int[] iarray)
Sets a pixel in the DataBuffer using an int array for input.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
iarray - The input pixels in a int array.
 o setPixel
public void setPixel(int x,
                     int y,
                     float[] farray)
Sets a pixel in the DataBuffer using a float array for input specified pixel.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
farray - The input pixels in a float array.
 o setPixel
public void setPixel(int x,
                     int y,
                     double[] darray)
Sets a pixel in the DataBuffer using a double array for input specified pixel.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
darray - The input pixels in a double array.
 o setPixel
public void setPixel(int x,
                     int y,
                     int w,
                     int h,
                     int[] iarray)
Sets a region of pixels using in input pixel array.

Parameters:
x - The X coordinate of the upper left pixel location.
y - The Y coordinate of the upper left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
iarray - The input int pixel array.
 o setPixel
public void setPixel(int x,
                     int y,
                     int w,
                     int h,
                     float[] farray)
Sets region of pixels using in input pixel array.

Parameters:
x - The X coordinate of the upper left pixel location.
y - The Y coordinate of the upper left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
farray - The input float pixel array.
 o setPixel
public void setPixel(int x,
                     int y,
                     int w,
                     int h,
                     double[] darray)
Sets region of pixels using in input pixel array.

Parameters:
x - The X coordinate of the upper left pixel location.
y - The Y coordinate of the upper left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
darray - The input double pixel array.
 o setSample
public void setSample(int x,
                      int y,
                      int b,
                      int s)
Sets a sample in the DataBuffer using a int for input.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
b - The band to set.
s - The input sample.
 o setSample
public void setSample(int x,
                      int y,
                      int b,
                      float s)
Sets a sample in the DataBuffer using a float array for input.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
b - The band to set.
s - The input sample as a float.
 o setSample
public void setSample(int x,
                      int y,
                      int b,
                      double s)
Sets a sample in the DataBuffer using a double array for input.

Parameters:
x - The X coordinate of the pixel location.
y - The Y coordinate of the pixel location.
b - The band to set.
s - The input sample as a double.
 o setSample
public void setSample(int x,
                      int y,
                      int w,
                      int h,
                      int b,
                      int[] iarray)
Sets a region of samples using an input integer buffer as input.

Parameters:
x - The X coordinate of the upper left pixel location.
y - The Y coordinate of the upper left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
b - The band to set.
iarray - The input int sample array.
 o setSample
public void setSample(int x,
                      int y,
                      int w,
                      int h,
                      int b,
                      float[] farray)
Sets a region of samples using an input float buffer as input.

Parameters:
x - The X coordinate of the upper left pixel location.
y - The Y coordinate of the upper left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
b - The band to set.
farray - The input float sample array.
 o setSample
public void setSample(int x,
                      int y,
                      int w,
                      int h,
                      int b,
                      double[] darray)
Sets a region of samples using an input double buffer as input.

Parameters:
x - The X coordinate of the upper left pixel location.
y - The Y coordinate of the upper left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
b - The band to set.
darray - The input double sample array.

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature