Class Filter

Direct Known Subclasses:
BarrelPincushionFilter, BaselineFilter, BrightnessFilter, DeinterlaceFilter, FilterStack, GhostFilter, GrayScaleFilter, LogFilter, NegativeFilter, PerspectiveFilter, RadialDistortionFilter, ResizeFilter, RotateFilter, StrobeFilter, SumFilter

public abstract class Filter extends OSPRuntime.Supported
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 Details

    • haveGUI

      protected boolean haveGUI
    • ROTATE_NONE

      protected static final int ROTATE_NONE
      See Also:
    • ROTATE_CCW_90

      protected static final int ROTATE_CCW_90
      See Also:
    • ROTATE_CW_90

      protected static final int ROTATE_CW_90
      See Also:
    • ROTATE_180

      protected static final int ROTATE_180
      See Also:
    • PROPERTY_FILTER_VISIBLE

      public static final String PROPERTY_FILTER_VISIBLE
      See Also:
    • PROPERTY_FILTER_COLOR

      public static final String PROPERTY_FILTER_COLOR
      See Also:
    • PROPERTY_FILTER_TAB

      public static final String PROPERTY_FILTER_TAB
      See Also:
    • PROPERTY_FILTER_IMAGE

      public static final String PROPERTY_FILTER_IMAGE
      See Also:
    • PROPERTY_FILTER_FILTER

      public static final String PROPERTY_FILTER_FILTER
      See Also:
    • PROPERTY_FILTER_BRIGHTNESS

      public static final String PROPERTY_FILTER_BRIGHTNESS
      See Also:
    • PROPERTY_FILTER_MEAN

      public static final String PROPERTY_FILTER_MEAN
      See Also:
    • PROPERTY_FILTER_RESET

      public static final String PROPERTY_FILTER_RESET
      See Also:
    • PROPERTY_FILTER_ENABLED

      public static final String PROPERTY_FILTER_ENABLED
      See Also:
    • rotationType

      protected int rotationType
    • autoScale720x480

      protected boolean autoScale720x480
    • pixelsIn

      protected int[] pixelsIn
    • pixelsOut

      protected int[] pixelsOut
    • widthFactor

      protected double widthFactor
    • heightFactor

      protected double heightFactor
    • 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
    • source

      protected BufferedImage source
    • input

      protected BufferedImage input
    • output

      protected BufferedImage output
    • w

      protected int w
    • h

      protected int h
    • changed

      protected boolean changed
    • previousState

      protected String previousState
    • vidPanel

      protected VideoPanel vidPanel
    • enabledAction

      protected Action enabledAction
    • hasInspector

      protected boolean hasInspector
    • stack

      protected FilterStack stack
    • doCreateOutput

      protected boolean doCreateOutput
    • nPixelsIn

      protected int nPixelsIn
    • frame

      protected JFrame frame
    • enabledItem

      protected JCheckBoxMenuItem enabledItem
    • deleteItem

      protected JMenuItem deleteItem
    • propertiesItem

      protected JMenuItem propertiesItem
    • copyItem

      protected JMenuItem copyItem
    • closeButton

      protected JButton closeButton
    • ableButton

      protected JButton ableButton
    • clearButton

      protected JButton clearButton
    • inspectorDlg

      protected Filter.InspectorDlg inspectorDlg
  • Constructor Details

    • Filter

      protected Filter()
      Constructs a Filter object.
  • Method Details

    • getInspector

      public JDialog getInspector()
      Returns a JDialog inspector for controlling filter properties.
      Returns:
      the inspector
    • newInspector

      protected abstract Filter.InspectorDlg newInspector()
    • initInspector

      protected abstract Filter.InspectorDlg initInspector()
    • clear

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

      public boolean isChanged()
      Determines if the filter settings have changed.
      Returns:
      true if changed
    • setVideoPanel

      public void setVideoPanel(VideoPanel panel)
      Sets the video panel. Note that this call will ultimately initialize a new TMenuBar if it does not exit.
      Parameters:
      panel - the video panel
    • getFrame

      public JFrame getFrame()
      Gets the JFrame containing the VideoPanel. May return null
      Returns:
      the JFrame, if any
    • refresh

      public void refresh()
      Refreshes this filter's GUI
    • finalize

      public void finalize()
      Overrides:
      finalize in class Object
    • 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.
    • copy

      public void copy()
      Copies this filter to the clipboard.
    • dispose

      public void dispose()
      Disposes of this filter.
      Overrides:
      dispose in class OSPRuntime.Supported
    • getMenu

      public 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
    • getRaster

      protected Raster getRaster(BufferedImage image)
      The issue here is that in SwingJS we may or may not have an actual raster. The act of getting the raster does NOT ensure that it is actually filled with data.
      Parameters:
      image -
      Returns:
    • getPixels

      protected void getPixels(BufferedImage image, int[] pixels)
    • getPixelsIn

      public void getPixelsIn()
    • getPixelsOut

      public void getPixelsOut()
    • initializeSource

      protected void initializeSource(BufferedImage image)
    • getFilteredImage

      protected BufferedImage getFilteredImage(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
    • initializeSubclass

      protected abstract void initializeSubclass()
    • setOutputPixels

      protected abstract void setOutputPixels()
    • addLocation

      public void addLocation(XMLControl control)