uk.ac.essex.ia.util
Class WritableRaster2

java.lang.Object
  extended by java.awt.image.Raster
      extended by java.awt.image.WritableRaster
          extended by uk.ac.essex.ia.util.WritableRaster2

public class WritableRaster2
extends java.awt.image.WritableRaster

A simple extension of WritableRaster which adds some convenience methods for setting pixel values in a more intuitive way (setGrey(), setRed(), setGreen(), setBlue(), etc.)


Field Summary
static int BLACK
           
static int WHITE
           
 
Fields inherited from class java.awt.image.Raster
dataBuffer, height, minX, minY, numBands, numDataElements, parent, sampleModel, sampleModelTranslateX, sampleModelTranslateY, width
 
Constructor Summary
protected WritableRaster2(java.awt.image.SampleModel sampleModel, java.awt.image.DataBuffer dataBuffer, java.awt.Point origin)
          constructs a WritableRaster2 by calling parent constructor with the given parameters.
protected WritableRaster2(java.awt.image.SampleModel sampleModel, java.awt.image.DataBuffer dataBuffer, java.awt.Rectangle aRegion, java.awt.Point sampleModelTranslate, java.awt.image.WritableRaster parent)
          constructs a WritableRaster2 by calling parent constructor with the given parameters.
protected WritableRaster2(java.awt.image.SampleModel sampleModel, java.awt.Point origin)
          constructs a WritableRaster2 by calling parent constructor with the given parameters.
  WritableRaster2(java.awt.image.WritableRaster src)
          Effectively type-casts a Raster as a Raster2 by calling parent constructor with the given parameters.
 
Method Summary
 void setBlue(int u, int v, int value)
          sets the pixel value in band 0 at the given position.
 void setGreen(int u, int v, int value)
          sets the pixel value in band 0 at the given position.
 void setGrey(int x, int y, int value)
          sets the pixel value in band 0 at the given position.
 void setRed(int u, int v, int value)
          sets the pixel value in band 0 at the given position.
 void setRGB(int u, int v, int r, int g, int b)
          sets the pixel value in band 0 at the given position.
 
Methods inherited from class java.awt.image.WritableRaster
createWritableChild, createWritableTranslatedChild, getWritableParent, setDataElements, setDataElements, setDataElements, setPixel, setPixel, setPixel, setPixels, setPixels, setPixels, setRect, setRect, setSample, setSample, setSample, setSamples, setSamples, setSamples
 
Methods inherited from class java.awt.image.Raster
createBandedRaster, createBandedRaster, createBandedRaster, createChild, createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createCompatibleWritableRaster, createInterleavedRaster, createInterleavedRaster, createInterleavedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createPackedRaster, createRaster, createTranslatedChild, createWritableRaster, createWritableRaster, getBounds, getDataBuffer, getDataElements, getDataElements, getHeight, getMinX, getMinY, getNumBands, getNumDataElements, getParent, getPixel, getPixel, getPixel, getPixels, getPixels, getPixels, getSample, getSampleDouble, getSampleFloat, getSampleModel, getSampleModelTranslateX, getSampleModelTranslateY, getSamples, getSamples, getSamples, getTransferType, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLACK

public static final int BLACK
See Also:
Constant Field Values

WHITE

public static final int WHITE
See Also:
Constant Field Values
Constructor Detail

WritableRaster2

protected WritableRaster2(java.awt.image.SampleModel sampleModel,
                          java.awt.image.DataBuffer dataBuffer,
                          java.awt.Point origin)
constructs a WritableRaster2 by calling parent constructor with the given parameters.


WritableRaster2

protected WritableRaster2(java.awt.image.SampleModel sampleModel,
                          java.awt.image.DataBuffer dataBuffer,
                          java.awt.Rectangle aRegion,
                          java.awt.Point sampleModelTranslate,
                          java.awt.image.WritableRaster parent)
constructs a WritableRaster2 by calling parent constructor with the given parameters.


WritableRaster2

protected WritableRaster2(java.awt.image.SampleModel sampleModel,
                          java.awt.Point origin)
constructs a WritableRaster2 by calling parent constructor with the given parameters.


WritableRaster2

public WritableRaster2(java.awt.image.WritableRaster src)
Effectively type-casts a Raster as a Raster2 by calling parent constructor with the given parameters.

Parameters:
src - the Raster to cast
Method Detail

setGrey

public void setGrey(int x,
                    int y,
                    int value)
sets the pixel value in band 0 at the given position.

Parameters:
x - horizontal raster position.
y - vertical raster position.
value - the pixel value to store at position x,y.

setRed

public void setRed(int u,
                   int v,
                   int value)
sets the pixel value in band 0 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
value - the red pixel value to store at position u,v.

setGreen

public void setGreen(int u,
                     int v,
                     int value)
sets the pixel value in band 0 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
value - the green pixel value to store at position u,v.

setBlue

public void setBlue(int u,
                    int v,
                    int value)
sets the pixel value in band 0 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
value - the blue pixel value to store at position u,v.

setRGB

public void setRGB(int u,
                   int v,
                   int r,
                   int g,
                   int b)
sets the pixel value in band 0 at the given position.

Parameters:
u - horizontal raster position.
v - vertical raster position.
r - the red pixel value to store at position u,v.
g - the green pixel value to store at position u,v.
b - the blue pixel value to store at position u,v.