gui
Class TCFilter

java.lang.Object
  extended by gui.TCFilter

public abstract class TCFilter
extends java.lang.Object

Author:
Mikhail Temkine The basis of all filters. Any filter must extend this class, implement all the abstract methods and be located in the filters package.

Field Summary
protected  java.awt.image.BufferedImage dest
           
protected  gui.ImageDisplay id
           
protected  java.awt.image.BufferedImage src
           
 
Constructor Summary
TCFilter()
           
 
Method Summary
protected  int av(int r, int g, int b)
          Returns the average of the 3 Red, Green, Blue components (i.e.
protected  int b(int rgb)
          Returns the blue component of the given GRB color
abstract  void filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest)
          Performs the filtering on a given source (src) image, writing the result into the destination (dest) image.
protected  int g(int rgb)
          Returns the green component of the given GRB color
abstract  java.awt.Component getGUI()
          Returns the gui component for this filter.
 java.awt.Component getSettingGUI(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest, gui.ImageDisplay id)
          This function is called by the filter dialog window whenever settings are asked to be brought up.
protected  int r(int rgb)
          Returns the red component of the given GRB color
abstract  void reset()
          Rollback any changes made to whatever-gui-has-control-over eversince getSettingGUI() was last time called.
 void update()
          Updates the image display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected gui.ImageDisplay id

src

protected java.awt.image.BufferedImage src

dest

protected java.awt.image.BufferedImage dest
Constructor Detail

TCFilter

public TCFilter()
Method Detail

filter

public abstract void filter(java.awt.image.BufferedImage src,
                            java.awt.image.BufferedImage dest)
Performs the filtering on a given source (src) image, writing the result into the destination (dest) image. src and dest are of equal size.

Parameters:
src - the source image
dest - the destination image

getGUI

public abstract java.awt.Component getGUI()
Returns the gui component for this filter. Normally, such gui is initialized in the filter constructor.

Returns:
the gui component for this filter

reset

public abstract void reset()
Rollback any changes made to whatever-gui-has-control-over eversince getSettingGUI() was last time called. This function is called if the user presses Cancel instead of OK in the filter settings dialog.


getSettingGUI

public java.awt.Component getSettingGUI(java.awt.image.BufferedImage src,
                                        java.awt.image.BufferedImage dest,
                                        gui.ImageDisplay id)
This function is called by the filter dialog window whenever settings are asked to be brought up. Children extending this class should not call this method.

Parameters:
src - source image
dest - destination-to-be image
id - reference image displace (Don't concern yourself with this)
Returns:
the gui component having set references to src and dest internally.

update

public void update()
Updates the image display. Children extending this class should not call this method.


r

protected int r(int rgb)
Returns the red component of the given GRB color

Parameters:
rgb - RGB color represented all as one integer.
Returns:
the red component of the given GRB color

g

protected int g(int rgb)
Returns the green component of the given GRB color

Parameters:
rgb - RGB color represented all as one integer.
Returns:
the green component of the given GRB color

b

protected int b(int rgb)
Returns the blue component of the given GRB color

Parameters:
rgb - RGB color represented all as one integer.
Returns:
the blue component of the given GRB color

av

protected int av(int r,
                 int g,
                 int b)
Returns the average of the 3 Red, Green, Blue components (i.e. the grayscale)

Parameters:
r - red component (out of 255)
g - green component (out of 255)
b - blue component (out of 255)
Returns:
the average of the 3 R, G, B components (i.e. the grayscale)