KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > action > animate > QualityControlAnimator


1 package prefuse.action.animate;
2
3 import prefuse.action.Action;
4
5 /**
6  * Animator that toggles rendering quality to allow for smooth animations but
7  * high quality rendering of still images. At the beginning of an animation,
8  * high quality rendering (if enabled) is disabled, and at the end the original
9  * setting is restored.
10  *
11  * @author <a HREF="http://jheer.org">jeffrey heer</a>
12  */

13 public class QualityControlAnimator extends Action {
14
15     /**
16      * @see prefuse.action.Action#run(double)
17      */

18     public void run(double frac) {
19         if ( m_vis == null ) return;
20         if ( frac == 0.0 || frac == 1.0 ) {
21             boolean quality = frac >= 1.0;
22             for ( int i=0; i<m_vis.getDisplayCount(); ++i ) {
23                 m_vis.getDisplay(i).setHighQuality(quality);
24             }
25             qualityValue(quality);
26         }
27     }
28     
29     /**
30      * Callback procedure that subclasses can override to execute
31      * custom quality control measures.
32      * @param quality true if high quality is desired, false otherwise
33      */

34     protected void qualityValue(boolean quality) {
35         // do nothing
36
}
37
38 } // end of class QualityControlAnimator
39
Popular Tags