|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.media.core.VideoAdapter
public class VideoAdapter
This provides basic implementations of all Video methods. Subclasses should provide a raw image for display--see ImageVideo for an example.
| Field Summary | |
|---|---|
protected DoubleArray |
aspects
|
protected java.awt.image.BufferedImage |
bufferedImage
|
protected java.awt.image.Raster |
clearRaster
|
protected ImageCoordSystem |
coords
|
protected int |
endFrameNumber
|
protected java.awt.image.BufferedImage |
filteredImage
|
protected FilterStack |
filterStack
|
protected int |
frameCount
|
protected int |
frameNumber
|
protected boolean |
isMeasured
|
protected boolean |
isValidFilteredImage
|
protected boolean |
isValidImage
|
protected boolean |
isValidMeasure
|
protected boolean |
looping
|
protected double |
maxX
|
protected double |
maxY
|
protected double |
minX
|
protected double |
minY
|
protected boolean |
mouseEnabled
|
protected boolean |
playing
|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
properties
|
protected double |
rate
|
protected java.awt.Image |
rawImage
|
protected java.awt.Dimension |
size
|
protected int |
startFrameNumber
|
protected java.beans.PropertyChangeSupport |
support
|
protected boolean |
visible
|
protected boolean |
widthDominates
|
| Constructor Summary | |
|---|---|
protected |
VideoAdapter()
Protected constructor creates an empty VideoAdapter |
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this video. |
void |
addPropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this video. |
void |
back()
Steps the video back one frame. |
void |
dispose()
Disposes of this video. |
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws the video image on the panel. |
protected void |
finalize()
Called by the garbage collector when this video is no longer in use. |
Interactive |
findInteractive(DrawingPanel panel,
int xpix,
int ypix)
Returns this video if enabled. |
protected void |
findMinMaxValues()
Finds the min and max values of x and y. |
protected void |
firePropertyChange(java.lang.String property,
java.lang.Object oldVal,
java.lang.Object newVal)
Sends a PropertyChangeEvent to registered listeners. |
double |
getAngle()
Gets the angle in radians of the curent video frame measured ccw from the world x-axis. |
ImageCoordSystem |
getCoords()
Gets the image coordinate system. |
double |
getDuration()
Gets the duration of the video. |
int |
getEndFrameNumber()
Gets the end frame number. |
double |
getEndTime()
Gets the end time in milliseconds. |
FilterStack |
getFilterStack()
Gets the filter stack. |
int |
getFrameCount()
Gets the total number of video frames. |
double |
getFrameDuration(int n)
Gets the duration of the specified frame in milliseconds. |
int |
getFrameNumber()
Gets the current video frame number. |
double |
getFrameTime(int n)
Gets the start time of the specified frame in milliseconds. |
double |
getHeight()
Gets the current height of the video frame. |
java.awt.image.BufferedImage |
getImage()
Gets the current video image after applying enabled filters. |
java.lang.Object |
getProperty(java.lang.String name)
Gets a user property of the video. |
java.util.Collection<java.lang.String> |
getPropertyNames()
Gets a collection of user property names for the video. |
double |
getRate()
Gets the relative play rate. |
double |
getRelativeAspect()
Gets the relative aspect of the current video frame. |
int |
getStartFrameNumber()
Gets the start frame number. |
double |
getStartTime()
Gets the start time in milliseconds. |
double |
getTime()
Gets the current video time in milliseconds. |
double |
getWidth()
Gets the current width of the video frame. |
double |
getX()
Gets x position of upper left corner of the current video frame in world units. |
double |
getXMax()
Gets the maximum x needed to draw this object. |
double |
getXMin()
Gets the minimum x needed to draw this object. |
double |
getY()
Gets y position of upper left corner of the current video frame in world units. |
double |
getYMax()
Gets the maximum y needed to draw this object. |
double |
getYMin()
Gets the minimum y needed to draw this object. |
void |
goToEnd()
Sets the frame number to the end frame. |
void |
goToStart()
Sets the frame number to the start frame. |
protected void |
initialize()
Initialize this video. |
boolean |
isEnabled()
Gets whether this responds to mouse hits. |
boolean |
isLooping()
Gets the looping state of the video. |
boolean |
isMeasured()
Reports whether information is available to set min/max values. |
boolean |
isPlaying()
Gets the playing state of this video. |
boolean |
isVisible()
Gets the visibility of the video. |
void |
play()
Plays the video at the current rate. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Responds to property change events. |
protected void |
refreshBufferedImage()
Refreshes the BufferedImage based on current size. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this video. |
void |
removePropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for a specified property. |
void |
reset()
Stops the video and resets it to the start time. |
void |
setAngle(double theta)
Sets the angle in radians of all video frames measured ccw from the world x-axis. |
void |
setCoords(ImageCoordSystem coords)
Sets the image coordinate system used to convert from imagespace to worldspace. |
void |
setEnabled(boolean enabled)
Sets whether this responds to mouse hits. |
void |
setEndFrameNumber(int n)
Sets the end frame number. |
void |
setEndTime(double millis)
Sets the end time in milliseconds. |
void |
setFilterStack(FilterStack stack)
Sets the filter stack. |
void |
setFrameAngle(int n,
double theta)
Sets the angle in radians of the specified video frame measured ccw from the world x-axis. |
void |
setFrameHeight(int n,
double height)
Sets the height of the specified video frame in world units. |
void |
setFrameNumber(int n)
Sets the video frame number. |
void |
setFrameRelativeAspect(int n,
double relativeAspect)
Sets the relative aspect of the specified video frame. |
void |
setFrameWidth(int n,
double width)
Sets the width of the specified video frame in world units. |
void |
setFrameX(int n,
double x)
Sets x position of upper left corner of the specified video frame in world units. |
void |
setFrameXY(int n,
double x,
double y)
Sets the x and y position of the UL corner of the specified video frame in world units. |
void |
setFrameY(int n,
double y)
Sets y position of upper left corner of the specified video frame in world units. |
void |
setHeight(double height)
Sets the height of all video frames in world units. |
void |
setLooping(boolean loops)
Sets the looping state of this video. |
void |
setPlaying(boolean playing)
Starts and stops the video. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets a user property of the video. |
void |
setRate(double rate)
Sets the relative play rate. |
void |
setRelativeAspect(double relativeAspect)
Sets the relative aspect of all video frames. |
void |
setStartFrameNumber(int n)
Sets the start frame number. |
void |
setStartTime(double millis)
Sets the start time in milliseconds. |
void |
setTime(double millis)
Sets the video time in milliseconds. |
void |
setVisible(boolean visible)
Shows or hides the video. |
void |
setWidth(double width)
Sets the width of all video frames in world units. |
void |
setX(double x)
Sets x position of upper left corner of all video frames in world units. |
void |
setXY(double x,
double y)
Sets the x and y position of the UL corner of all video frames in world units. |
void |
setY(double y)
Sets y position of upper left corner of all video frames in world units. |
void |
step()
Steps the video forward one frame. |
void |
stop()
Stops the video. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.awt.Image rawImage
protected java.awt.Dimension size
protected java.awt.image.BufferedImage bufferedImage
protected java.awt.image.BufferedImage filteredImage
protected int frameCount
protected int frameNumber
protected int startFrameNumber
protected int endFrameNumber
protected double rate
protected boolean playing
protected boolean looping
protected double minX
protected double maxX
protected double minY
protected double maxY
protected boolean mouseEnabled
protected boolean visible
protected boolean isMeasured
protected boolean isValidMeasure
protected boolean widthDominates
protected boolean isValidImage
protected boolean isValidFilteredImage
protected ImageCoordSystem coords
protected DoubleArray aspects
protected java.beans.PropertyChangeSupport support
protected java.util.HashMap<java.lang.String,java.lang.Object> properties
protected FilterStack filterStack
protected java.awt.image.Raster clearRaster
| Constructor Detail |
|---|
protected VideoAdapter()
| Method Detail |
|---|
public void draw(DrawingPanel panel,
java.awt.Graphics g)
draw in interface Drawablepanel - the drawing panel requesting the drawingg - the graphics context on which to drawpublic void setVisible(boolean visible)
setVisible in interface DrawableImagevisible - true to show the videopublic boolean isVisible()
isVisible in interface DrawableImagetrue if the video is visiblepublic double getXMin()
getXMin in interface Measurablepublic double getXMax()
getXMax in interface Measurablepublic double getYMin()
getYMin in interface Measurablepublic double getYMax()
getYMax in interface Measurablepublic boolean isMeasured()
isMeasured in interface Measurabletrue if min/max values are validpublic java.awt.image.BufferedImage getImage()
getImage in interface DrawableImage
public Interactive findInteractive(DrawingPanel panel,
int xpix,
int ypix)
findInteractive in interface Interactivepanel - the drawing panelxpix - the x coordinate in pixelsypix - the y coordinate in pixels
public void setEnabled(boolean enabled)
setEnabled in interface Interactiveenabled - true if this responds to mouse hits.public boolean isEnabled()
isEnabled in interface Interactivetrue if this responds to mouse hits.
public void setFrameX(int n,
double x)
setFrameX in interface Videon - the video frame numberx - the world x positionpublic void setX(double x)
setX in interface Interactivex - the world x position
public void setFrameY(int n,
double y)
setFrameY in interface Videon - the video frame numbery - the world y positionpublic void setY(double y)
setY in interface Interactivey - the world y positionpublic double getX()
getX in interface Interactivepublic double getY()
getY in interface Interactive
public void setFrameXY(int n,
double x,
double y)
setFrameXY in interface Videon - the video frame numberx - the world x positiony - the world y position
public void setXY(double x,
double y)
setXY in interface Interactivex - the world x positiony - the world y position
public void setFrameRelativeAspect(int n,
double relativeAspect)
setFrameRelativeAspect in interface Videon - the video frame numberrelativeAspect - the desired relative aspectpublic void setRelativeAspect(double relativeAspect)
setRelativeAspect in interface InteractiveImagerelativeAspect - the desired relative aspectpublic double getRelativeAspect()
getRelativeAspect in interface InteractiveImageInteractiveImage.setRelativeAspect(double)
public void setFrameWidth(int n,
double width)
setFrameWidth in interface Videon - the video frame numberwidth - the width in world unitssetRelativeAspect(double)public void setWidth(double width)
setWidth in interface InteractiveImagewidth - the width in world unitssetRelativeAspect(double)public double getWidth()
getWidth in interface InteractiveImage
public void setFrameHeight(int n,
double height)
setFrameHeight in interface Videon - the video frame numberheight - the height in world unitssetRelativeAspect(double)public void setHeight(double height)
setHeight in interface InteractiveImageheight - the height in world unitssetRelativeAspect(double)public double getHeight()
getHeight in interface InteractiveImage
public void setFrameAngle(int n,
double theta)
setFrameAngle in interface Videon - the video frame numbertheta - the angle in radianspublic void setAngle(double theta)
setAngle in interface InteractiveImagetheta - the angle in radianspublic double getAngle()
getAngle in interface InteractiveImagepublic void step()
step in interface Videopublic void back()
back in interface Videopublic int getFrameCount()
getFrameCount in interface Videopublic int getFrameNumber()
getFrameNumber in interface Videopublic void setFrameNumber(int n)
setFrameNumber in interface Videon - the desired frame numberVideo.getStartFrameNumber(),
Video.getEndFrameNumber()public int getStartFrameNumber()
getStartFrameNumber in interface VideogetEndFrameNumber()public void setStartFrameNumber(int n)
setStartFrameNumber in interface Videon - the desired start frame numbersetEndFrameNumber(int)public int getEndFrameNumber()
getEndFrameNumber in interface VideogetStartFrameNumber()public void setEndFrameNumber(int n)
setEndFrameNumber in interface Videon - the desired end frame number,setStartFrameNumber(int)public double getFrameTime(int n)
getFrameTime in interface Videon - the frame number
public double getFrameDuration(int n)
getFrameDuration in interface Videon - the frame number
public void play()
play in interface Playablepublic void stop()
stop in interface Playablepublic void reset()
reset in interface Playablepublic double getTime()
getTime in interface Playablepublic void setTime(double millis)
setTime in interface Playablemillis - the desired time in millisecondspublic double getStartTime()
getStartTime in interface Playablepublic void setStartTime(double millis)
setStartTime in interface Playablemillis - the desired start time in millisecondspublic double getEndTime()
getEndTime in interface Playablepublic void setEndTime(double millis)
setEndTime in interface Playablemillis - the desired end time in millisecondspublic double getDuration()
getDuration in interface Playablepublic void goToStart()
goToStart in interface Playablepublic void goToEnd()
goToEnd in interface Playablepublic void setPlaying(boolean playing)
setPlaying in interface Playableplaying - true starts the video, and
false stops itpublic boolean isPlaying()
isPlaying in interface Playabletrue if the video is playingpublic void setLooping(boolean loops)
setLooping in interface Playableloops - true if the video loopspublic boolean isLooping()
isLooping in interface Playabletrue if the video loopspublic void setRate(double rate)
setRate in interface Playablerate - the relative play rate.public double getRate()
getRate in interface Playablepublic void setCoords(ImageCoordSystem coords)
setCoords in interface InteractiveImagecoords - the image coordinate systempublic ImageCoordSystem getCoords()
getCoords in interface InteractiveImagepublic void setFilterStack(FilterStack stack)
setFilterStack in interface DrawableImagestack - the new filter stackpublic FilterStack getFilterStack()
getFilterStack in interface DrawableImage
public void setProperty(java.lang.String name,
java.lang.Object value)
setProperty in interface DrawableImagename - the name of the propertyvalue - the value of the propertypublic java.lang.Object getProperty(java.lang.String name)
getProperty in interface DrawableImagename - the name of the property
public java.util.Collection<java.lang.String> getPropertyNames()
getPropertyNames in interface DrawableImagepublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface Playablelistener - the object requesting property change notification
public void addPropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface Playableproperty - the name of the property of interest to the listenerlistener - the object requesting property change notificationpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface Playablelistener - the listener requesting removal
public void removePropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface Playableproperty - the name of the propertylistener - the listener to removepublic void dispose()
dispose in interface Videopublic void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange in interface java.beans.PropertyChangeListenere - the property change event
protected void firePropertyChange(java.lang.String property,
java.lang.Object oldVal,
java.lang.Object newVal)
property - the name of the property that has changedoldVal - the value of the property before the change (may be null)newVal - the value of the property after the change (may be null)protected void finalize()
finalize in class java.lang.Objectprotected void initialize()
protected void refreshBufferedImage()
protected void findMinMaxValues()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||