01: package prefuse.action.animate;
02:
03: import prefuse.action.Action;
04:
05: /**
06: * Animator that toggles rendering quality to allow for smooth animations but
07: * high quality rendering of still images. At the beginning of an animation,
08: * high quality rendering (if enabled) is disabled, and at the end the original
09: * 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)
20: return;
21: if (frac == 0.0 || frac == 1.0) {
22: boolean quality = frac >= 1.0;
23: for (int i = 0; i < m_vis.getDisplayCount(); ++i) {
24: m_vis.getDisplay(i).setHighQuality(quality);
25: }
26: qualityValue(quality);
27: }
28: }
29:
30: /**
31: * Callback procedure that subclasses can override to execute
32: * custom quality control measures.
33: * @param quality true if high quality is desired, false otherwise
34: */
35: protected void qualityValue(boolean quality) {
36: // do nothing
37: }
38:
39: } // end of class QualityControlAnimator
|