quicktime.app.image
Class QTTransition

java.lang.Object
  |
  +--quicktime.app.image.QTEffect
        |
        +--quicktime.app.image.QTFilter
              |
              +--quicktime.app.image.QTTransition
All Implemented Interfaces:
Drawable, Listener, QTDrawable, Redrawable, Transformable

public class QTTransition
extends QTFilter

QTTransistions are visual effects that are applied to a two images, transitioning from the source image to the destination image. Upon completion of the transition the source and destination images are swapped, so you can also transition back to the original source image or set a new desintation image.

The QTTransition can run in two modes - in time mode the doTransition method will run the effect in as close as time as possible to the time specified. In frames mode the effect will be run for the number of frames that are specified.

The doTransition method is provided as a means of running the transition according to the time or frames setting. The transition will run as effectively as possible from start to finish - it is a call that blocks the thread of execution that made this call whilst the transition is running.

If a transition should be run with more application control then the application can control the setting of the current frame of the transition and call redraw after setting each frame. The redraw method will redraw the current frame of the transition.


Fields inherited from interface quicktime.app.image.Redrawable
kMultiFrame, kSingleFrame
 
Constructor Summary
QTTransition()
          Creates a QTTransition with default settings of a time-specified duration of 2000 msecs, an effect fps of 20, a redraw setting as kMultiFrame and an initialSize of 0, 0.
QTTransition(java.awt.Dimension d)
          Deprecated. since QTJava 4.0
QTTransition(QDDimension d)
          Creates a QTTransition with default settings of a time-specified duration of 2000 msecs, an effect fps of 20, a redraw setting as kMultiFrame and the specified initialSize.
 
Method Summary
 void doTime(boolean flag)
          If true then the effect will run in the time alloted.
 void doTransition()
          This will run the currently selected effect on the visual rectangle that is defined by the display bounds of this object.
 ImageSpec getDestinationImage()
          Returns the current destination image
 int getFramesPerSecond()
          Returns the current frames per second that the effect draws in if the effect is rendered using the time constraint
 int getTime()
          Returns the time that an effect will run for in milliseconds
 boolean isProfiled()
          Returns the current profiling status.
 boolean isTime()
          Returns true if the effect is running for a specified duration or false if the effect is running for a specified number of frames
 int profileDuration()
          If profiling this returns the total time it took to run the doTransition method.
 int profileFramesRendered()
          If profiling this returns the number of frames that were rendered in the last time that the doTransition() method was called.
 void setCurrentFrame(int frame)
          This sets the current frame of the effect.
 void setDestinationImage(ImageSpec image)
          Sets the destination image of the Transition - the image that the transition will transition to.
 void setEffect(AtomContainer effectParams)
          This method will take the incoming parameters and use this as the control parameters for the effect.
 void setFrames(int frames)
          Sets the maximum number of frames that an effect can run for.
 void setFramesPerSecond(int frames)
          Sets the maximum frames per second that the effect will attempt to render
 void setProfiled(boolean flag)
          Set this to true if you wish to profile the actual running of the effect, or false to not collect.
 void setTime(int time)
          Sets the duration of the effect when it is run if the effect is run in time mode
protected  boolean setUpSequence()
          This method is called by a number of other methods to create the DSequence that is used to render the QTEffect.
 void swapImages()
          This swaps the source and destination images.
 
Methods inherited from class quicktime.app.image.QTFilter
getOriginalSize, getSourceImage, setSourceImage
 
Methods inherited from class quicktime.app.image.QTEffect
addedTo, checkForEffect, getClip, getCurrentFrame, getDescription, getDisplayBounds, getDSequence, getEffect, getFrames, getGraphicsMode, getGWorld, getImage, getInitialSize, getMatrix, isRedrawing, isSingleFrame, redraw, removedFrom, setClip, setDisplayBounds, setGraphicsMode, setGWorld, setLocation, setMatrix, setRedrawing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QTTransition

public QTTransition()
             throws QTException
Creates a QTTransition with default settings of a time-specified duration of 2000 msecs, an effect fps of 20, a redraw setting as kMultiFrame and an initialSize of 0, 0.

QTTransition

public QTTransition(java.awt.Dimension d)
             throws QTException
Deprecated. since QTJava 4.0

Creates a QTTransition with default settings of a time-specified duration of 2000 msecs, an effect fps of 20, a redraw setting as kMultiFrame and the specified initialSize.

QTTransition

public QTTransition(QDDimension d)
             throws QTException
Creates a QTTransition with default settings of a time-specified duration of 2000 msecs, an effect fps of 20, a redraw setting as kMultiFrame and the specified initialSize.
Method Detail

setEffect

public void setEffect(AtomContainer effectParams)
               throws QTException
This method will take the incoming parameters and use this as the control parameters for the effect. The container will be locked for the duration of the effect object's life or until another effect is set.
Overrides:
setEffect in class QTFilter
Parameters:
effectParams - the parameters that determine the effect that is run

setDestinationImage

public void setDestinationImage(ImageSpec image)
                         throws QTException
Sets the destination image of the Transition - the image that the transition will transition to.

getDestinationImage

public ImageSpec getDestinationImage()
Returns the current destination image

setUpSequence

protected boolean setUpSequence()
                         throws QTException
This method is called by a number of other methods to create the DSequence that is used to render the QTEffect. When called the method will create a new DSequence if the required state has been established to enable the creation of the DSequence.
Overrides:
setUpSequence in class QTFilter
Returns:
true if a new DSequence was created, otherwise false.

doTransition

public void doTransition()
                  throws QTException
This will run the currently selected effect on the visual rectangle that is defined by the display bounds of this object. After the effect is run the destination image of the transition is now the visible image in the effect's display space

swapImages

public void swapImages()
                throws QTException
This swaps the source and destination images.

setFrames

public void setFrames(int frames)
               throws QTException
Sets the maximum number of frames that an effect can run for.

setFramesPerSecond

public void setFramesPerSecond(int frames)
                        throws QTException
Sets the maximum frames per second that the effect will attempt to render

getFramesPerSecond

public int getFramesPerSecond()
Returns the current frames per second that the effect draws in if the effect is rendered using the time constraint
Returns:
the fps of the effect

setCurrentFrame

public void setCurrentFrame(int frame)
This sets the current frame of the effect. A value of zero means to draw the source image of the transition.
Parameters:
frame - the frame to be rendered

setTime

public void setTime(int time)
             throws QTException
Sets the duration of the effect when it is run if the effect is run in time mode
Parameters:
time - the time in milliseconds for the effect to run for in time mode

getTime

public int getTime()
Returns the time that an effect will run for in milliseconds
Returns:
milliseconds

doTime

public void doTime(boolean flag)
If true then the effect will run in the time alloted. If false then the effect will run for the specified frames.
Parameters:
flag - a boolean

isTime

public boolean isTime()
Returns true if the effect is running for a specified duration or false if the effect is running for a specified number of frames
Returns:
true if the doEffect method runs the effect in time mode, false if in frame mode.

setProfiled

public void setProfiled(boolean flag)
Set this to true if you wish to profile the actual running of the effect, or false to not collect. Once profiling your application can determine the amount of time it took to render a transition and how many frames were actually rendered. These values are generated and reset from each call of the doTransition() method.
Parameters:
flag - if true will profile

isProfiled

public boolean isProfiled()
Returns the current profiling status.
Returns:
a boolean indicating the profiling status of the transition

profileFramesRendered

public int profileFramesRendered()
If profiling this returns the number of frames that were rendered in the last time that the doTransition() method was called. If profiling is disabled this method returns 0.
Returns:
an int

profileDuration

public int profileDuration()
If profiling this returns the total time it took to run the doTransition method. If profiling is disabled this method returns 0.
Returns:
an int