org.jacorb.demo.notification.whiteboard
Class PixelImage

java.lang.Object
  extended by org.jacorb.demo.notification.whiteboard.PixelImage
Direct Known Subclasses:
BrushSizePixelImage

public class PixelImage
extends Object

PixelImage.java A pixel-based image.

Author:
Nicolas Noffke, Torsten Fink

Field Summary
protected  int[] m_pixels
           
 
Constructor Summary
PixelImage(int width, int height)
          The constructor.
 
Method Summary
 void clearAll()
           
 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.
 ImageProducer getProducer()
          gets the ImageProducer for this image.
 void setPixel(int x, int y, 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.
 void setPixelBuffer(int[] data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_pixels

protected int[] m_pixels
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,
                     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 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.

setPixelBuffer

public void setPixelBuffer(int[] data)

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


Copyright © 2015 JacORB. All rights reserved.