Facemorph
Class Mask

java.lang.Object
  extended by Facemorph.Mask
All Implemented Interfaces:
java.lang.Cloneable

public class Mask
extends java.lang.Object
implements java.lang.Cloneable

Defines a mask file (a list of which contours to follow in a Template and in which directions).


Field Summary
static int CONTOUR_FORWARD
          Indicates a line goes in the direction of points
static int CONTOUR_REVERSE
          Indicates a line goes in the opposite direction to the points
static java.awt.Color maskColour
           
static int POINT
          indicates a point, not a line
 
Constructor Summary
Mask()
          Creates a new instance of Mask
 
Method Summary
 void add(int index, int dir)
          Adds a contour or point to this mask
 Mask clone()
           
 void delete(int index)
          Delete a contour from this mask
 java.util.Vector<java.lang.Integer> getContours()
          Get the list of contours for this mask
 java.util.Vector<java.lang.Integer> getDirections()
          Get the list of directions for this mask
 void read(java.io.Reader r)
          Reads a mask from a Reader (e.g.
 void read(java.lang.String file)
          Reads a mask from a file
 void write(java.io.File f)
          Writes the mask to a file
 void write(java.io.PrintWriter pw)
          Writes the mask to a PrintWriter
 void write(java.lang.String fname)
          Writes the mask to a file
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maskColour

public static final java.awt.Color maskColour

CONTOUR_FORWARD

public static final int CONTOUR_FORWARD
Indicates a line goes in the direction of points

See Also:
Constant Field Values

CONTOUR_REVERSE

public static final int CONTOUR_REVERSE
Indicates a line goes in the opposite direction to the points

See Also:
Constant Field Values

POINT

public static final int POINT
indicates a point, not a line

See Also:
Constant Field Values
Constructor Detail

Mask

public Mask()
Creates a new instance of Mask

Method Detail

clone

public Mask clone()
Overrides:
clone in class java.lang.Object

read

public void read(java.lang.String file)
          throws java.io.FileNotFoundException,
                 java.io.IOException
Reads a mask from a file

Parameters:
file - The name of the mask file
Throws:
java.io.FileNotFoundException - thrown if file not found
java.io.IOException - thrown if some other I/O error

read

public void read(java.io.Reader r)
          throws java.io.IOException
Reads a mask from a Reader (e.g. InputStreamReader or FileReader)

Parameters:
r - The Reader to read from
Throws:
java.io.IOException - if an IOException occurs

write

public void write(java.lang.String fname)
           throws java.io.IOException
Writes the mask to a file

Parameters:
fname - the name of the file to write to
Throws:
java.io.IOException

write

public void write(java.io.File f)
           throws java.io.IOException
Writes the mask to a file

Parameters:
f - the file to write to
Throws:
java.io.IOException

write

public void write(java.io.PrintWriter pw)
Writes the mask to a PrintWriter

Parameters:
pw - the PrintWriter to write to

getContours

public java.util.Vector<java.lang.Integer> getContours()
Get the list of contours for this mask

Returns:
The list of contours

getDirections

public java.util.Vector<java.lang.Integer> getDirections()
Get the list of directions for this mask

Returns:
The list of contour directions

add

public void add(int index,
                int dir)
Adds a contour or point to this mask

Parameters:
index - the index of the contour or point to add
dir - the direction the contour should be followed or point CONTOUR_FORWARD, CONTOUR_REVERSE or POINT

delete

public void delete(int index)
Delete a contour from this mask

Parameters:
index - the index of the contour to remove