Class PixelImage

java.lang.Object
  |
  +--PixelImage

public class PixelImage
extends java.lang.Object

PixelImage.java A pixel-based image.

Author:
Nicolas Noffke, Torsten Fink

Constructor Summary
PixelImage(int width, int height)
          The constructor.
 
Method Summary
 void clearAll()
          sets all pixels to black.
 void drawLine(int x0, int y0, int x1, int y1, int red, int green, int blue)
          draws a line in the image.
 int[] getPixelBuffer()
          gets the pixel buffer of this image.
 java.awt.image.ImageProducer getProducer()
          gets the ImageProducer for this image.
 void setPixel(int x, int y, java.awt.Color color)
          sets a pixel to a specific color.
 void setPixel(int x, int y, int red, int green, int blue)
          sets a pixel to a specific color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PixelImage

public PixelImage(int width,
                  int height)
The constructor. Set up buffer.
Parameters:
height - the images height.
width - the images width.
Method Detail

setPixel

public void setPixel(int x,
                     int y,
                     int red,
                     int green,
                     int blue)
sets a pixel to a specific color.
Parameters:
x - the pixels x value.
y - the pixels y value.
red - the pixels red value.
green - the pixels green value.
blue - the pixels blue value.

setPixel

public void setPixel(int x,
                     int y,
                     java.awt.Color color)
sets a pixel to a specific color.
Parameters:
x - the pixels x value.
y - the pixels y value.
color - the pixels color.

getProducer

public java.awt.image.ImageProducer getProducer()
gets the ImageProducer for this image.
Returns:
the ImageProducer for this image.

getPixelBuffer

public int[] getPixelBuffer()
gets the pixel buffer of this image.
Returns:
the pixel buffer.

drawLine

public void drawLine(int x0,
                     int y0,
                     int x1,
                     int y1,
                     int red,
                     int green,
                     int blue)
draws a line in the image. The incremental line scan-conversion algorithm is used (see "Computer Graphics"; Foley, vanDam,Feiner,Hughes). (x0,y0) is the starting point, (x1,y1) the ending point.

clearAll

public void clearAll()
sets all pixels to black.