Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

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.)


Fields inherited from class java.awt.image.Raster
 baseRasterOriginX, baseRasterOriginY, dataBuffer, height, minX, minY, numBands, numDataElements, parent, sampleModel, width
 

Constructor Summary
 WritableRaster(SampleModel sampleModel, Point origin)
Constructs a WritableRaster with the given SampleModel.
 WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin)
Constructs a WritableRaster with the given SampleModel and DataBuffer.
 WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point origin, WritableRaster parent)
Constructs a WriteableRaster with the given SampleModel, DataBuffer, and parent.
 

Method Summary
WritableRaster  createWritableSubRaster(int x, int y, int w, int h)
Returns a WritableRaster which references this WritableRaster's DataBuffer.
WritableRaster  createWritableSubRaster(Rectangle r)
Creates a subraster given a region of the raster.
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.
WritableRaster  createWritableTranslatedRaster(Point location)
Create a WritableRaster with the same size, SampleModel and DataBuffer as this one, but with a different location.
WritableRaster  getWritableParent()
Returns the parent WritableRaster (if any) of this Raster.
void  setPixel(int x, int y, int[] iarray)
Sets a pixel in the DataBuffer using an int array for input.
void  setPixel(int x, int y, float[] farray)
Sets a pixel in the DataBuffer using a float array for input specified pixel.
void  setPixel(int x, int y, double[] darray)
Sets a pixel in the DataBuffer using a double array for input specified pixel.
void  setPixel(int x, int y, int w, int h, int[] iarray)
Sets a region of pixels using in input pixel array.
void  setPixel(int x, int y, int w, int h, float[] farray)
Sets region of pixels using in input pixel array.
void  setPixel(int x, int y, int w, int h, double[] darray)
Sets region of pixels using in input pixel array.
void  setPixelData(int x, int y, Object obj)
Stores the data elements for all channels at the specified location.
void  setPixelData(int x, int y, Raster inRaster)
Stores the Raster data at the specified location.
void  setPixelData(int x, int y, int w, int h, Object obj)
Stores an array of data elements into the specified rectangular region.
void  setRect(Raster srcRaster)
Copies pixels from Raster srcRaster to this WritableRaster.
void  setRect(int x, int y, Raster srcRaster)
Copies pixels from Raster srcRaster to this WritableRaster.
void  setSample(int x, int y, int b, int s)
Sets a sample in the DataBuffer using a int for input.
void  setSample(int x, int y, int b, float s)
Sets a sample in the DataBuffer using a float array for input.
void  setSample(int x, int y, int b, double s)
Sets a sample in the DataBuffer using a double array for input.
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.
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.
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.
 
Methods inherited from class java.awt.image.Raster
 createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createComponentRaster, createComponentRaster, createComponentRaster, createPackedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createRaster, createSubRaster, createSubRaster, createSubRaster, createTranslatedRaster, createWritableRaster, createWritableRaster, getBaseRasterOriginX, getBaseRasterOriginY, getBaseSubRasterOffsetX, getBaseSubRasterOffsetY, getBounds, getDataBuffer, getHeight, getMinX, getMinY, getNumBands, getNumDataElements, getParent, getPixel, getPixel, getPixel, getPixel, getPixel, getPixel, getPixelData, getPixelData, getSample, getSample, getSample, getSample, getSampleDouble, getSampleFloat, getSampleModel, getTransferType, getWidth
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.

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.

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.
Method Detail

getWritableParent

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

createWritableTranslatedRaster

public WritableRaster createWritableTranslatedRaster(Point location)
Create a WritableRaster with the same size, SampleModel and DataBuffer as this one, but with a different location.
Parameters:
location - The upper left corner of the new returned Raster.

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).

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.