org.zilonis.tool.ext.aerith.effects
Class ComponentEffect

java.lang.Object
  extended by org.zilonis.tool.ext.aerith.effects.ComponentEffect
Direct Known Subclasses:
ComponentImageEffect, CompositeEffect, Fade, Move, Rotate, Scale, Unchanging

public abstract class ComponentEffect
extends java.lang.Object

This is the base class for all effects that are used during screen transitions. It is also the repository for caching and retrieving custom effects. Subclasses of this base class will implement the setup() and paint() methods as appropriate to set up the Graphics state and perform the rendering necessary to achieve the desired effect.


Field Summary
protected  java.awt.Image componentImage
          The image that will be used during the transition, for effects that opt to not re-render the components directly.
protected  ComponentState end
          Information about the end state used by this effect.
protected  int height
          Current height.
protected  boolean renderComponent
          Flag to indicate whether effect needs to re-render Component
protected  ComponentState start
          Information about the start state used by this effect.
protected  int width
          Current width.
protected  int x
          Current x location.
protected  int y
          Current y location.
 
Constructor Summary
ComponentEffect()
           
 
Method Summary
protected  javax.swing.JComponent getComponent()
           
 java.awt.Image getComponentImage()
           
 ComponentState getEnd()
           
 ComponentState getStart()
           
 void paint(java.awt.Graphics2D g2d)
          This method is called during each frame of the transition animation, after the call to setup().
protected  void setComponentImage(java.awt.Image componentImage)
           
 void setComponentStates(ComponentState start, ComponentState end)
          Sets both the start and end states of this Effect.
 void setEnd(ComponentState end)
          Sets the end state of this Effect.
 void setStart(ComponentState start)
          Sets the start state of this Effect.
 void setup(java.awt.Graphics2D g2d, float fraction)
          This method is called during each frame of the transition animation, prior to the call to paint().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

protected ComponentState start
Information about the start state used by this effect.


end

protected ComponentState end
Information about the end state used by this effect.


renderComponent

protected boolean renderComponent
Flag to indicate whether effect needs to re-render Component


componentImage

protected java.awt.Image componentImage
The image that will be used during the transition, for effects that opt to not re-render the components directly. The image will be set when the start and end states are set.


x

protected int x
Current x location.


y

protected int y
Current y location.


width

protected int width
Current width.


height

protected int height
Current height.

Constructor Detail

ComponentEffect

public ComponentEffect()
Method Detail

getComponent

protected javax.swing.JComponent getComponent()

setComponentStates

public void setComponentStates(ComponentState start,
                               ComponentState end)
Sets both the start and end states of this Effect.


setStart

public void setStart(ComponentState start)
Sets the start state of this Effect.


getStart

public ComponentState getStart()

setEnd

public void setEnd(ComponentState end)
Sets the end state of this Effect.


getEnd

public ComponentState getEnd()

getComponentImage

public java.awt.Image getComponentImage()

setComponentImage

protected void setComponentImage(java.awt.Image componentImage)

setup

public void setup(java.awt.Graphics2D g2d,
                  float fraction)
This method is called during each frame of the transition animation, prior to the call to paint(). Subclasses will implement this method to set up the Graphic state, or other related state, that will be used in the following call to the paint() method. Note that changes to the Graphics2D object here will still be present in the Graphics2D object that is passed into the paint() method, so this is a good time to set up things such as transform state.

Parameters:
g2d - the Graphics2D destination for this rendering
fraction - The fraction of elapsed time in this animation

paint

public void paint(java.awt.Graphics2D g2d)
This method is called during each frame of the transition animation, after the call to setup(). Subclasses will implement this method to perform whatever rendering is necessary to paint the transitioning component into the Graphics2D object with the desired effect.

Parameters:
g2d - The Graphics2D destination for this rendering. Note that the state of this Graphics2D object is affected by the previous call to setup so there may be no more need to perturb the graphics state any more; you may simply want to render the component as appropriate.