org.opensourcephysics.media.core
Class Filter

java.lang.Object
  extended by org.opensourcephysics.media.core.Filter
Direct Known Subclasses:
BaselineFilter, BrightnessFilter, DarkGhostFilter, DeinterlaceFilter, FilterStack, GhostFilter, GrayScaleFilter, NegativeFilter, PerspectiveFilter, RadialDistortionFilter, ResizeFilter, RotateFilter, SpectralLineFilter, SumFilter

public abstract class Filter
extends java.lang.Object

This is the abstract base class for all image filters. Note: subclasses should always provide a no-argument constructor.

Version:
1.0
Author:
Douglas Brown

Field Summary
protected  javax.swing.JButton ableButton
           
protected  javax.swing.JButton clearButton
           
protected  javax.swing.JButton closeButton
           
protected  javax.swing.JMenuItem deleteItem
           
protected  javax.swing.Action enabledAction
           
protected  javax.swing.JCheckBoxMenuItem enabledItem
           
protected  java.awt.Frame frame
           
protected  boolean hasInspector
           
 boolean inspectorVisible
          true if the filter inspector is visible
 int inspectorX
          the x-component of inspector position
 int inspectorY
          the y-component of inspector position
protected  javax.swing.JMenuItem propertiesItem
           
protected  FilterStack stack
           
protected  java.beans.PropertyChangeSupport support
           
protected  VideoPanel vidPanel
           
 
Constructor Summary
protected Filter()
          Constructs a Filter object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this filter.
 void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this filter.
 void clear()
          Clears the filter.
abstract  java.awt.image.BufferedImage getFilteredImage(java.awt.image.BufferedImage sourceImage)
          Applies the filter to a source image and returns the result.
abstract  javax.swing.JDialog getInspector()
          Returns a JDialog inspector for controlling filter properties.
 javax.swing.JMenu getMenu(Video video)
          Returns a menu with items that control this filter.
 boolean isEnabled()
          Gets whether this filter is enabled.
 void refresh()
          Refreshes this filter's GUI
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from this filter.
 void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener for a specified property.
 void setEnabled(boolean enabled)
          Sets whether this filter is enabled.
 void setVideoPanel(VideoPanel panel)
          Sets the video panel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inspectorVisible

public boolean inspectorVisible
true if the filter inspector is visible


inspectorX

public int inspectorX
the x-component of inspector position


inspectorY

public int inspectorY
the y-component of inspector position


vidPanel

protected VideoPanel vidPanel

support

protected java.beans.PropertyChangeSupport support

enabledAction

protected javax.swing.Action enabledAction

enabledItem

protected javax.swing.JCheckBoxMenuItem enabledItem

deleteItem

protected javax.swing.JMenuItem deleteItem

propertiesItem

protected javax.swing.JMenuItem propertiesItem

hasInspector

protected boolean hasInspector

frame

protected java.awt.Frame frame

closeButton

protected javax.swing.JButton closeButton

ableButton

protected javax.swing.JButton ableButton

clearButton

protected javax.swing.JButton clearButton

stack

protected FilterStack stack
Constructor Detail

Filter

protected Filter()
Constructs a Filter object.

Method Detail

getFilteredImage

public abstract java.awt.image.BufferedImage getFilteredImage(java.awt.image.BufferedImage sourceImage)
Applies the filter to a source image and returns the result. If the filter is not enabled, the source image should be returned.

Parameters:
sourceImage - the source image
Returns:
the filtered image

getInspector

public abstract javax.swing.JDialog getInspector()
Returns a JDialog inspector for controlling filter properties.

Returns:
the inspector

clear

public void clear()
Clears the filter. This default method does nothing.


setVideoPanel

public void setVideoPanel(VideoPanel panel)
Sets the video panel.

Parameters:
panel - the video panel

refresh

public void refresh()
Refreshes this filter's GUI


setEnabled

public void setEnabled(boolean enabled)
Sets whether this filter is enabled.

Parameters:
enabled - true if this is enabled.

isEnabled

public boolean isEnabled()
Gets whether this filter is enabled.

Returns:
true if this is enabled.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this filter.

Parameters:
listener - the object requesting property change notification

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String property,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this filter.

Parameters:
property - the name of the property of interest to the listener
listener - the object requesting property change notification

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this filter.

Parameters:
listener - the listener requesting removal

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String property,
                                         java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for a specified property.

Parameters:
property - the name of the property
listener - the listener to remove

getMenu

public javax.swing.JMenu getMenu(Video video)
Returns a menu with items that control this filter. Subclasses should override this method and add filter-specific menu items.

Parameters:
video - the video using the filter (may be null)
Returns:
a menu