com.miginfocom.ashape.animation.animations
Class AbsRectAnimation

java.lang.Object
  extended by com.miginfocom.ashape.animation.animations.AbstractAnimation
      extended by com.miginfocom.ashape.animation.animations.AbsRectAnimation
All Implemented Interfaces:
Animation, java.io.Serializable

public class AbsRectAnimation
extends AbstractAnimation

An animation that animates between two AbsRect objects. They need to be per argument compatible. I.e if the width is an Integer in the first AbsRect it needs to be that in the second as well. The reason for this is that we don't have the relative size values that has to be used to convert relative values to absolute.

See Also:
Serialized Form

Constructor Summary
AbsRectAnimation(AbsRect sRect, AbsRect eRect)
          Constructor without cached objects.
AbsRectAnimation(AbsRect sRect, AbsRect eRect, int cacheFrameCount)
          Constructor.
 
Method Summary
protected  boolean checkRects(AbsRect r1, AbsRect r2)
          Check so that x, y, w, h of the argument rectangles are of same type.
 java.lang.Object createObject(float d)
          Returns a newly created object that complies to the same rules as AbstractAnimation.getObject(float).
 boolean equals(java.lang.Object o)
           
 PlaceRect getEndRect()
          Returns the end AbsRect.
protected  java.awt.Insets getInsets(java.awt.Insets i1, java.awt.Insets i2, float d)
          Returns an Insets object that lays distance d (0..1) between both arguments.
 PlaceRect getStartRect()
          Returns the start AbsRect.
 
Methods inherited from class com.miginfocom.ashape.animation.animations.AbstractAnimation
createCache, createCacheImpl, getFrameCount, getObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbsRectAnimation

public AbsRectAnimation(AbsRect sRect,
                        AbsRect eRect)
Constructor without cached objects. Creates new on-the-fly for every call. This can be expensive and may create a lot of garbage.

Parameters:
sRect - The source, or start, rectangle.
eRect - The destination, or end, rectangle.

AbsRectAnimation

public AbsRectAnimation(AbsRect sRect,
                        AbsRect eRect,
                        int cacheFrameCount)
Constructor.

Parameters:
sRect - The source, or start, rectangle.
eRect - The destination, or end, rectangle.
cacheFrameCount - How many frames that should be cached, and used. 0 means "no caching".
Method Detail

createObject

public java.lang.Object createObject(float d)
Description copied from class: AbstractAnimation
Returns a newly created object that complies to the same rules as AbstractAnimation.getObject(float). For subclasses to implement.

Specified by:
createObject in class AbstractAnimation
Parameters:
d - 0.0 to 1.0 0.0 is the first Object/frame and 1.0 is the last.
Returns:
A newly created object that complies to the same rules as AbstractAnimation.getObject(float).

getInsets

protected java.awt.Insets getInsets(java.awt.Insets i1,
                                    java.awt.Insets i2,
                                    float d)
Returns an Insets object that lays distance d (0..1) between both arguments.

Parameters:
i1 - First Insets, may be null.
i2 - Second Insets, may be null.
d - 0..1 Where 0.0 will return i1 and 1.0 will return i2. Values in between are interpolated.
Returns:
An newly created Insets object that lies distance d (0..1) between both arguments. May be null.

checkRects

protected boolean checkRects(AbsRect r1,
                             AbsRect r2)
Check so that x, y, w, h of the argument rectangles are of same type.

Parameters:
r1 - The first rect
r2 - The second rect
Returns:
true if they are compatible for animation.

getStartRect

public PlaceRect getStartRect()
Returns the start AbsRect.

Returns:
The start AbsRect.

getEndRect

public PlaceRect getEndRect()
Returns the end AbsRect.

Returns:
The end AbsRect.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class AbstractAnimation


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.