Class Fill

java.lang.Object
  extended by Fill

public class Fill
extends java.lang.Object

Fill class is used to fill a color to the whole area of the main canvas. It also consists of a helper class which is coords class. This class will try and fill the whole area of the pixel with the colors wanted. There are no OS/Hardware dependencies and no variances. There are no security constraints. There are no references to external specifications.


Field Summary
(package private)  java.awt.image.BufferedImage bim
          BufferImage that is going to be colored.
(package private)  coords cur
          The coordinates that is used to move around in the coord array of pixels and keep track which of the coords is not colored.
(package private) static int eastBound
          The column number of pixels.
(package private) static int fill
          The new color to fill the pixel with the colors wanted.
(package private) static int index
          The current position in the array.
(package private) static int old
          The original color that you want to change.
(package private)  coords[] pixels
          A coordinate array of the pixels used to keep track which part of the BufferedImage bim is not colored.
(package private) static int southBound
          The row number of pixels.
 
Constructor Summary
Fill(java.awt.image.BufferedImage in, int x1, int y1, int filler)
          Constructor for the fill class.
 
Method Summary
 void fillIt()
          fillIt does the coloring.
 java.awt.image.BufferedImage getBufferedImage()
          Returns the BufferedImage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bim

java.awt.image.BufferedImage bim
BufferImage that is going to be colored.


old

static int old
The original color that you want to change.


fill

static int fill
The new color to fill the pixel with the colors wanted.


index

static int index
The current position in the array.


eastBound

static int eastBound
The column number of pixels. Negative value is not allowed.


southBound

static int southBound
The row number of pixels. Negative value is not allowed.


pixels

coords[] pixels
A coordinate array of the pixels used to keep track which part of the BufferedImage bim is not colored.


cur

coords cur
The coordinates that is used to move around in the coord array of pixels and keep track which of the coords is not colored.

Constructor Detail

Fill

public Fill(java.awt.image.BufferedImage in,
            int x1,
            int y1,
            int filler)
Constructor for the fill class. It gets the color wanted and the BufferedImage. It creates the coordinate array of pixels to start coloring. It also calls the function fillIt to color the BufferedImage. It will throw an exception if there is any.

Parameters:
in - BufferedImage we want to color.
x1 - The starting index for x.
y1 - The starting index for y.
filler - The color that it is supposed to be used.
Method Detail

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
Returns the BufferedImage.

Returns:
bim BufferedImage.

fillIt

public void fillIt()
fillIt does the coloring. It checks South, North, East and West of the main canvas image. Then, if it is not colored, it will be colored. The function also runs until index (the total area of the bufferedImage) is -1, which means that the BufferedImage is colored.