1 package org.wcb.gui.effect;
2
3 import java.awt.*;
4 import java.awt.geom.AffineTransform;
5
6 /**
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 public class SpinDissolver extends Dissolver {
23
24 public void paint(Graphics g) {
25 Graphics2D g2 = (Graphics2D)g;
26 // draw the screen, offset in case the window isn't at 0,0
27 g.drawImage(screen_buffer, -fullscreen.getX(), -fullscreen.getY(), null);
28
29 //save the current transform
30 AffineTransform old_trans = g2.getTransform();
31
32 //move to the upper-lefthand corner of the frame
33 g2.translate(frame.getX(), frame.getY());
34
35 //move the frame off toward the left
36 g2.translate(-((count + 1) * (frame.getX() + frame.getWidth())/20), 0);
37
38 // shrink the frame
39 float scale = 1f / ((float) count + 1);
40 g2.scale(scale, scale);
41
42 //rotate around the center
43 g2.rotate(((float) count) / 3.14 / 1.3, frame.getWidth()/2, frame.getHeight() /2 );
44
45 // finally draw the frame
46 g2.drawImage(frame_buffer, 0, 0, null);
47
48 // restore the current transform
49 g2.setTransform(old_trans);
50 }
51 }