quicktime.app.actions
Class Invalidator

java.lang.Object
  |
  +--quicktime.app.actions.Invalidator
All Implemented Interfaces:
Ticklish

public class Invalidator
extends java.lang.Object
implements Ticklish

The Invalidator class is used as a helper class when Compositing objects that have a changing image source.

The SWCompositor uses QuickTime's SpriteWorld to draw a member's image. If the member's image data is changing but there are no changes in the presentation of the member's Sprite (a QuickTime Sprite is used to represent the member in the SpriteWorld of the SWCompositor) then the compositing cycle of the SpriteWorld will not redraw the Sprite. Thus in order to force the SpriteWorld to redraw a Sprite of this nature, the Sprite that is presenting the member must be invalidated.

Some classes explicitly use the Invalidator class in this release, the CompositableEffect and QTImageDrawer. Implicit invalidation is done in other classes (MoviePresenter, the SWCompositor itself if it a member of a parent SWCompositor) as they possess their own sense of drawing.

If an Invalidator is required it is returned by the addedToCompositor method and the SWCompositor keeps a list of the Invalidators and invokes the invalidator each time the SWCompositor itself is tickled. Subclasses of the Invalidator class can override the tickle method and be more efficient based on the explicit conditions under which the TwoDSprite is invalidated. For example if a QTImageDrawer is not redrawing every time the TwoDSprite needs only to be invalidated when the QTImageDrawer signifies that it is redrawing. Thus the Invalidator for the QTImageDrawer checks isRedrawing() and only redraws and invalidates the presenting Sprite if the QTImageDrawer returns true from the isRedrawing() call. It will still ask the QTImageDrawer if it requires redrawing upon each composit loop when the Invalidator itself is activated.

See Also:
quicktime.app.display.SWCompositor, QTImageDrawer, MoviePresenter

Field Summary
protected  TwoDSprite s
          This is the sprite that requires invalidation in the tickle call
 
Fields inherited from interface quicktime.app.time.Ticklish
kScale
 
Constructor Summary
Invalidator(TwoDSprite s)
          Constructs an Invalidator with the TwoDSprite that is presenting the Image and would require invalidation.
 
Method Summary
 TwoDSprite getTarget()
          This returns the target TwoDSprite of the Invalidator.
 boolean tickle(float er, int t)
          The Invalidators typically ignore time and rate values and invalidate their sprite.
 void timeChanged(int newTime)
          This call is ignored by the default Invalidator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s

protected TwoDSprite s
This is the sprite that requires invalidation in the tickle call
Constructor Detail

Invalidator

public Invalidator(TwoDSprite s)
Constructs an Invalidator with the TwoDSprite that is presenting the Image and would require invalidation.
Parameters:
s - the TwoDSprite presenter
Method Detail

getTarget

public TwoDSprite getTarget()
This returns the target TwoDSprite of the Invalidator.
Returns:
a TwoDSprite object

timeChanged

public void timeChanged(int newTime)
                 throws QTException
This call is ignored by the default Invalidator.
Specified by:
timeChanged in interface Ticklish
Parameters:
newTime - the new time when the Ticklish's time line has changed

tickle

public boolean tickle(float er,
                      int t)
               throws QTException
The Invalidators typically ignore time and rate values and invalidate their sprite. The default implementation will always invalidate the sprite - subclasses can refine the actual conditions under which invalidation is appropriate. However an Invalidator subclass could of course use the time and rate values.
Specified by:
tickle in interface Ticklish
Parameters:
er - the effective rate of the Ticklish's Timer
t - the time at which the Ticklish has been tickled.