ij.process
Class PolygonFiller

java.lang.Object
  extended by ij.process.PolygonFiller

public class PolygonFiller
extends java.lang.Object

This class fills polygons using the scan-line filling algorithm described at "http://www.cs.rit.edu/~icss571/filling/".


Field Summary
(package private)  int activeEdges
           
(package private)  int[] aedge
           
(package private)  int BLACK
           
(package private)  int edges
           
(package private)  double[] eslope
           
(package private)  double[] ex
           
(package private)  int[] ey1
           
(package private)  int[] ey2
           
(package private)  int n
           
(package private)  int[] sedge
           
(package private)  int WHITE
           
(package private)  int[] x
           
(package private)  int[] y
           
 
Constructor Summary
PolygonFiller()
          Constructs a PolygonFiller.
PolygonFiller(int[] x, int[] y, int n)
          Constructs a PolygonFiller using the specified polygon.
 
Method Summary
(package private)  void activateEdges(int y)
          Adds edges to the active edge table.
(package private)  void addToSortedTable(int edge)
          Currently not used since searching the entire edge table does not seem to take a significant amount of time.
(package private)  void allocateArrays(int n)
           
(package private)  void buildEdgeTable(int[] x, int[] y, int n)
          Generates the edge table.
 void fill(ImageProcessor ip, java.awt.Rectangle r)
          Fills the polygon using the ImageProcessor's current drawing color.
 ImageProcessor getMask(int width, int height)
          Returns a byte mask containing a filled version of the polygon.
(package private)  void printActiveEdges()
          Display the contents of the active edge table
(package private)  void printEdges()
          Display the contents of the edge table
(package private)  void removeInactiveEdges(int y)
          Removes edges from the active edge table that are no longer needed.
 void setPolygon(int[] x, int[] y, int n)
          Specifies the polygon to be filled.
(package private)  void sortActiveEdges()
          Sorts the active edges list by x coordinate using a selection sort.
(package private)  void updateXCoordinates()
          Updates the x coordinates in the active edges list and sorts the list if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLACK

int BLACK

WHITE

int WHITE

edges

int edges

activeEdges

int activeEdges

x

int[] x

y

int[] y

n

int n

ex

double[] ex

ey1

int[] ey1

ey2

int[] ey2

eslope

double[] eslope

sedge

int[] sedge

aedge

int[] aedge
Constructor Detail

PolygonFiller

public PolygonFiller()
Constructs a PolygonFiller.


PolygonFiller

public PolygonFiller(int[] x,
                     int[] y,
                     int n)
Constructs a PolygonFiller using the specified polygon.

Method Detail

setPolygon

public void setPolygon(int[] x,
                       int[] y,
                       int n)
Specifies the polygon to be filled.


allocateArrays

void allocateArrays(int n)

buildEdgeTable

void buildEdgeTable(int[] x,
                    int[] y,
                    int n)
Generates the edge table.


addToSortedTable

void addToSortedTable(int edge)
Currently not used since searching the entire edge table does not seem to take a significant amount of time.


fill

public void fill(ImageProcessor ip,
                 java.awt.Rectangle r)
Fills the polygon using the ImageProcessor's current drawing color.


getMask

public ImageProcessor getMask(int width,
                              int height)
Returns a byte mask containing a filled version of the polygon.


updateXCoordinates

void updateXCoordinates()
Updates the x coordinates in the active edges list and sorts the list if necessary.


sortActiveEdges

void sortActiveEdges()
Sorts the active edges list by x coordinate using a selection sort.


removeInactiveEdges

void removeInactiveEdges(int y)
Removes edges from the active edge table that are no longer needed.


activateEdges

void activateEdges(int y)
Adds edges to the active edge table.


printEdges

void printEdges()
Display the contents of the edge table


printActiveEdges

void printActiveEdges()
Display the contents of the active edge table