Facemorph.mask
Interface MaskInterface

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
BitmapMask, Mask, VectorMask

public interface MaskInterface
extends java.lang.Cloneable


Method Summary
 MaskInterface clone()
          Creates and returns a copy of this object.
 FloatImage getAsFloatImage(Template tem, int w, int h, float min, float max)
          Constructs a FloatImage with values of 0 (masked) and max (not masked)
 double getBlur()
          Gets the size of the Gaussian (or implementation specific) blur to apply to the mask
 javax.swing.filechooser.FileNameExtensionFilter getExt()
           
 FloatImage maskImage(FloatImage img, Template tem, java.awt.Color col, boolean reverse)
          Masks an image using the template object specified/
 java.awt.Image maskImage(java.awt.Image img, Template tem, java.awt.Color col, boolean reverse)
          Masks an image using the template object specified/
 void paint(Template tem, java.awt.Graphics g, java.awt.Color col, int xoff, int yoff, int width, int height, float zoom)
          Paint the mask using the supplied Graphics component
 void paint(Template tem, java.awt.Graphics g, java.awt.Color col, int xoff, int yoff, int width, int height, float zoom, boolean invert)
          Paint the mask using the supplied Graphics component, with option to invert the mask
 void read(java.io.File file)
          Reads a mask from a file
 void setBlur(double blurLevel)
          Sets the size of the Gaussian (or implementation specific) blur to apply to the mask The size specified as multiple applications of a Gaussian blur function
 void write(java.io.File file)
          Writes the mask to a file
 

Method Detail

clone

MaskInterface clone()
Creates and returns a copy of this object.


read

void read(java.io.File 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

write

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

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

getAsFloatImage

FloatImage getAsFloatImage(Template tem,
                           int w,
                           int h,
                           float min,
                           float max)
Constructs a FloatImage with values of 0 (masked) and max (not masked)

Parameters:
min - The values to draw outside the masked regions
tem - the template to apply the mask to
w - The width of the output mask image
h - The height of the output mask image
max - The values to draw in the masked regions
Returns:
The mask as a FloatImage, this allows it to be smoothed for softer edges

paint

void paint(Template tem,
           java.awt.Graphics g,
           java.awt.Color col,
           int xoff,
           int yoff,
           int width,
           int height,
           float zoom)
Paint the mask using the supplied Graphics component

Parameters:
tem - Template to form mask around
g - Graphics object to paint onto
col - Colour to paint the mask
xoff - the x-offset
yoff - the y-offset
zoom - the zoom

paint

void paint(Template tem,
           java.awt.Graphics g,
           java.awt.Color col,
           int xoff,
           int yoff,
           int width,
           int height,
           float zoom,
           boolean invert)
Paint the mask using the supplied Graphics component, with option to invert the mask

Parameters:
tem - Template to form mask around
g - Graphics object to paint onto
col - Colour to paint the mask
xoff - the x-offset
yoff - the y-offset
zoom - the zoom
invert - will invert the mask if true.

maskImage

java.awt.Image maskImage(java.awt.Image img,
                         Template tem,
                         java.awt.Color col,
                         boolean reverse)
Masks an image using the template object specified/

Parameters:
img - The image to mask
tem - The template to use
col - The colour to draw in the masked regions
reverse - If true draw outside the polygon defined by the mask, otherwise draw inside
Returns:
return the masked image, the original is unmodified

maskImage

FloatImage maskImage(FloatImage img,
                     Template tem,
                     java.awt.Color col,
                     boolean reverse)
Masks an image using the template object specified/

Parameters:
img - The floating point image to mask
tem - The template to use
col - The colour to draw in the masked regions
reverse - If true draw outside the polygon defined by the mask, otherwise draw inside
Returns:
return the masked image, the original is unmodified

getExt

javax.swing.filechooser.FileNameExtensionFilter getExt()
Returns:
the file extensions appropriate for this type of mask

setBlur

void setBlur(double blurLevel)
Sets the size of the Gaussian (or implementation specific) blur to apply to the mask The size specified as multiple applications of a Gaussian blur function

Parameters:
blurLevel -

getBlur

double getBlur()
Gets the size of the Gaussian (or implementation specific) blur to apply to the mask

Returns: