Package org.opensourcephysics.media.core
Class FilterStack
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.Filter
org.opensourcephysics.media.core.FilterStack
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
This is a Filter that contains and manages a series of Filters.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.media.core.Filter
Filter.InspectorDlg
-
Field Summary
Fields inherited from class org.opensourcephysics.media.core.Filter
ableButton, autoScale720x480, changed, clearButton, closeButton, copyItem, deleteItem, doCreateOutput, enabledAction, enabledItem, frame, h, hasInspector, haveGUI, heightFactor, input, inspectorDlg, inspectorVisible, inspectorX, inspectorY, nPixelsIn, output, pixelsIn, pixelsOut, previousState, propertiesItem, PROPERTY_FILTER_BRIGHTNESS, PROPERTY_FILTER_COLOR, PROPERTY_FILTER_ENABLED, PROPERTY_FILTER_FILTER, PROPERTY_FILTER_IMAGE, PROPERTY_FILTER_MEAN, PROPERTY_FILTER_RESET, PROPERTY_FILTER_TAB, PROPERTY_FILTER_VISIBLE, ROTATE_180, ROTATE_CCW_90, ROTATE_CW_90, ROTATE_NONE, rotationType, source, stack, vidPanel, w, widthFactor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a filter to the end of the stack.void
addFilters
(Collection<Filter> stack) void
addFilters
(FilterStack stack) void
clear()
Clears the filter stack.void
dispose()
Disposes of this filter.Gets the first instance of the specified filter class.getFilteredImage
(BufferedImage sourceImage) Returns the current filtered image.Returns a copy of the filters in this filter stack.Gets the post filter.protected void
protected Filter.InspectorDlg
void
insertFilter
(Filter filter, int index) Adds a filter at the specified index.boolean
isEmpty()
Returns true if this contains no filters.int
Gets the index of the last removed filter, or -1 if none removed.Implements abstract Filter method.void
Responds to property change events.void
refresh()
Refreshes this filter's GUIvoid
removeFilter
(Filter filter) Removes the specified filter from the stack.void
setInspectorsVisible
(boolean vis) Shows/hides all inspectors.protected void
void
setPostFilter
(Filter filter) Sets the post filter.Methods inherited from class org.opensourcephysics.media.core.Filter
addLocation, copy, finalize, getFrame, getInspector, getMenu, getPixels, getPixelsIn, getPixelsOut, getRaster, initializeSource, isChanged, isEnabled, setEnabled, setVideoPanel
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
FilterStack
public FilterStack()Constructs a FilterStack object.
-
-
Method Details
-
addFilter
Adds a filter to the end of the stack. Multiple filters are applied in the order they are added.- Parameters:
filter
- the filter
-
addFilters
-
addFilters
-
insertFilter
Adds a filter at the specified index. Multiple filters are applied in index order.- Parameters:
filter
- the filterindex
- the index
-
lastIndexRemoved
public int lastIndexRemoved()Gets the index of the last removed filter, or -1 if none removed.- Returns:
- the stack index.
-
setPostFilter
Sets the post filter. If non-null, the post filter is applied after all other filters.- Parameters:
filter
- a filter
-
getPostFilter
Gets the post filter.- Returns:
- the post filter
-
getFilter
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
Removes the specified filter from the stack.- Parameters:
filter
- the filter
-
dispose
public void dispose()Description copied from class:Filter
Disposes of this filter. -
clear
public void clear()Clears the filter stack. -
isEmpty
public boolean isEmpty()Returns true if this contains no filters.- Returns:
true
if this is empty
-
getFilters
Returns a copy of the filters in this filter stack.- Returns:
- a collection of filters
-
getFilteredImage
Returns the current filtered image. Called by VideoAdapter or self exclusively.- Overrides:
getFilteredImage
in classFilter
- Parameters:
sourceImage
- the image to filter- Returns:
- the filtered image
-
setOutputPixels
protected void setOutputPixels()- Specified by:
setOutputPixels
in classFilter
-
newInspector
Implements abstract Filter method.- Specified by:
newInspector
in classFilter
- Returns:
- the inspector
-
initInspector
- Specified by:
initInspector
in classFilter
-
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 -
propertyChange
Responds to property change events. FilterStack listens for the following events: all events from its filters.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
e
- the property change event
-
initializeSubclass
protected void initializeSubclass()- Specified by:
initializeSubclass
in classFilter
-