Class FilterStack

All Implemented Interfaces:
PropertyChangeListener, EventListener

public class FilterStack extends Filter implements PropertyChangeListener
This is a Filter that contains and manages a series of Filters.
Version:
1.0
Author:
Douglas Brown
  • Constructor Details

    • FilterStack

      public FilterStack()
      Constructs a FilterStack object.
  • Method Details

    • addFilter

      public void addFilter(Filter filter)
      Adds a filter to the end of the stack. Multiple filters are applied in the order they are added.
      Parameters:
      filter - the filter
    • addFilters

      public void addFilters(Collection<Filter> stack)
    • addFilters

      public void addFilters(FilterStack stack)
    • insertFilter

      public void insertFilter(Filter filter, int index)
      Adds a filter at the specified index. Multiple filters are applied in index order.
      Parameters:
      filter - the filter
      index - the index
    • lastIndexRemoved

      public int lastIndexRemoved()
      Gets the index of the last removed filter, or -1 if none removed.
      Returns:
      the stack index.
    • setPostFilter

      public void setPostFilter(Filter filter)
      Sets the post filter. If non-null, the post filter is applied after all other filters.
      Parameters:
      filter - a filter
    • getPostFilter

      public Filter getPostFilter()
      Gets the post filter.
      Returns:
      the post filter
    • getFilter

      public Filter getFilter(Class<?> filterClass)
      Gets the first instance of the specified filter class. May return null.
      Parameters:
      filterClass - the filter class
      Returns:
      the first filter of the specified class, if any
    • removeFilter

      public void removeFilter(Filter filter)
      Removes the specified filter from the stack.
      Parameters:
      filter - the filter
    • dispose

      public void dispose()
      Description copied from class: Filter
      Disposes of this filter.
      Overrides:
      dispose in class Filter
    • clear

      public void clear()
      Clears the filter stack.
      Overrides:
      clear in class Filter
    • isEmpty

      public boolean isEmpty()
      Returns true if this contains no filters.
      Returns:
      true if this is empty
    • getFilters

      public ArrayList<Filter> getFilters()
      Returns a copy of the filters in this filter stack.
      Returns:
      a collection of filters
    • getFilteredImage

      public BufferedImage getFilteredImage(BufferedImage sourceImage)
      Returns the current filtered image. Called by VideoAdapter or self exclusively.
      Overrides:
      getFilteredImage in class Filter
      Parameters:
      sourceImage - the image to filter
      Returns:
      the filtered image
    • setOutputPixels

      protected void setOutputPixels()
      Specified by:
      setOutputPixels in class Filter
    • newInspector

      public Filter.InspectorDlg newInspector()
      Implements abstract Filter method.
      Specified by:
      newInspector in class Filter
      Returns:
      the inspector
    • initInspector

      protected Filter.InspectorDlg initInspector()
      Specified by:
      initInspector in class Filter
    • setInspectorsVisible

      public void setInspectorsVisible(boolean vis)
      Shows/hides all inspectors.
      Parameters:
      vis - true to show inspectors
    • refresh

      public void refresh()
      Refreshes this filter's GUI
      Overrides:
      refresh in class Filter
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Responds to property change events. FilterStack listens for the following events: all events from its filters.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - the property change event
    • initializeSubclass

      protected void initializeSubclass()
      Specified by:
      initializeSubclass in class Filter