Package org.opensourcephysics.media.core
Class Filter
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.Filter
- Direct Known Subclasses:
BarrelPincushionFilter
,BaselineFilter
,BrightnessFilter
,DeinterlaceFilter
,FilterStack
,GhostFilter
,GrayScaleFilter
,LogFilter
,NegativeFilter
,PerspectiveFilter
,RadialDistortionFilter
,ResizeFilter
,RotateFilter
,StrobeFilter
,SumFilter
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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JButton
protected boolean
protected boolean
protected JButton
protected JButton
protected JMenuItem
protected JMenuItem
protected boolean
protected Action
protected JCheckBoxMenuItem
protected JFrame
protected int
protected boolean
protected boolean
protected double
protected BufferedImage
protected Filter.InspectorDlg
boolean
true if the filter inspector is visibleint
the x-component of inspector positionint
the y-component of inspector positionprotected int
protected BufferedImage
protected int[]
protected int[]
protected String
protected JMenuItem
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected static final int
protected static final int
protected static final int
protected static final int
protected int
protected BufferedImage
protected FilterStack
protected VideoPanel
protected int
protected double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLocation
(XMLControl control) void
clear()
Clears the filter.void
copy()
Copies this filter to the clipboard.void
dispose()
Disposes of this filter.void
finalize()
protected BufferedImage
getFilteredImage
(BufferedImage sourceImage) Applies the filter to a source image and returns the result.getFrame()
Gets the JFrame containing the VideoPanel.Returns a JDialog inspector for controlling filter properties.Returns a menu with items that control this filter.protected void
getPixels
(BufferedImage image, int[] pixels) void
void
protected Raster
getRaster
(BufferedImage image) The issue here is that in SwingJS we may or may not have an actual raster.protected void
initializeSource
(BufferedImage image) protected abstract void
protected abstract Filter.InspectorDlg
boolean
Determines if the filter settings have changed.boolean
Gets whether this filter is enabled.protected abstract Filter.InspectorDlg
void
refresh()
Refreshes this filter's GUIvoid
setEnabled
(boolean enabled) Sets whether this filter is enabled.protected abstract void
void
setVideoPanel
(VideoPanel panel) Sets the video panel.Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
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
- See Also:
-
PROPERTY_FILTER_COLOR
- See Also:
-
PROPERTY_FILTER_TAB
- See Also:
-
PROPERTY_FILTER_IMAGE
- See Also:
-
PROPERTY_FILTER_FILTER
- See Also:
-
PROPERTY_FILTER_BRIGHTNESS
- See Also:
-
PROPERTY_FILTER_MEAN
- See Also:
-
PROPERTY_FILTER_RESET
- See Also:
-
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 inspectorVisibletrue if the filter inspector is visible -
inspectorX
public int inspectorXthe x-component of inspector position -
inspectorY
public int inspectorYthe y-component of inspector position -
source
-
input
-
output
-
w
protected int w -
h
protected int h -
changed
protected boolean changed -
previousState
-
vidPanel
-
enabledAction
-
hasInspector
protected boolean hasInspector -
stack
-
doCreateOutput
protected boolean doCreateOutput -
nPixelsIn
protected int nPixelsIn -
frame
-
enabledItem
-
deleteItem
-
propertiesItem
-
copyItem
-
closeButton
-
ableButton
-
clearButton
-
inspectorDlg
-
-
Constructor Details
-
Filter
protected Filter()Constructs a Filter object.
-
-
Method Details
-
getInspector
Returns a JDialog inspector for controlling filter properties.- Returns:
- the inspector
-
newInspector
-
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
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
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() -
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 classOSPRuntime.Supported
-
getMenu
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
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
-
getPixelsIn
public void getPixelsIn() -
getPixelsOut
public void getPixelsOut() -
initializeSource
-
getFilteredImage
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
-