1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
package tsukuba_bunko.peko.canvas.stage.effect; |
10 |
|
|
11 |
|
import java.awt.Color; |
12 |
|
import java.awt.Dimension; |
13 |
|
import java.awt.Graphics2D; |
14 |
|
|
15 |
|
import java.awt.image.BufferedImage; |
16 |
|
import java.awt.image.ImageObserver; |
17 |
|
|
18 |
|
import tsukuba_bunko.peko.canvas.stage.Effect; |
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
public class PataPataEffect extends Effect { |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
public PataPataEffect() |
31 |
|
{ |
32 |
0 |
super(); |
33 |
0 |
} |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
public String getName() |
40 |
|
{ |
41 |
0 |
return "pata-pata"; |
42 |
|
} |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
public void perform( BufferedImage screen, BufferedImage next ) |
48 |
|
{ |
49 |
0 |
ImageObserver observer = getStageCanvas(); |
50 |
0 |
Graphics2D g2 = screen.createGraphics(); |
51 |
0 |
g2.setColor( Color.black ); |
52 |
|
|
53 |
0 |
Dimension size = getCanvasSize(); |
54 |
|
|
55 |
0 |
int width = size.width; |
56 |
0 |
int height = size.height; |
57 |
0 |
int part = (width / 16) + ( (width % 16) != 0 ? 1 : 0 ); |
58 |
0 |
int x = 0; |
59 |
0 |
int pos = 0; |
60 |
|
|
61 |
0 |
int d = 0; |
62 |
0 |
for( int i = 0; i < 4; ++i ) { |
63 |
0 |
x += 4; |
64 |
0 |
for( int j = part - 1; j >= 0; --j ) { |
65 |
0 |
pos = (j * 16); |
66 |
0 |
d = x; |
67 |
0 |
if( pos + x <= width ) { |
68 |
0 |
g2.setClip( pos, 0, d, height ); |
69 |
0 |
g2.fillRect( 0, 0, width, height ); |
70 |
|
} |
71 |
|
} |
72 |
0 |
drawImage( screen ); |
73 |
|
try { |
74 |
0 |
synchronized( this ) { |
75 |
0 |
wait( 25L ); |
76 |
0 |
} |
77 |
|
} |
78 |
0 |
catch( Exception e ) { |
79 |
0 |
e.printStackTrace(); |
80 |
0 |
} |
81 |
|
} |
82 |
|
|
83 |
|
try { |
84 |
0 |
synchronized( this ) { |
85 |
0 |
wait( 100L ); |
86 |
0 |
} |
87 |
|
} |
88 |
0 |
catch( Exception e ) { |
89 |
0 |
e.printStackTrace(); |
90 |
0 |
} |
91 |
|
|
92 |
0 |
x = 0; |
93 |
0 |
pos = 0; |
94 |
0 |
d = 0; |
95 |
0 |
for( int i = 0; i < 4; ++i ) { |
96 |
0 |
x += 4; |
97 |
0 |
for( int j = part - 1; j >= 0; --j ) { |
98 |
0 |
pos = (j * 16); |
99 |
0 |
d = x; |
100 |
0 |
if( pos + x <= 640 ) { |
101 |
0 |
g2.setClip( pos, 0, d, height ); |
102 |
0 |
g2.drawImage( next, 0, 0, observer ); |
103 |
|
} |
104 |
|
} |
105 |
0 |
drawImage( screen ); |
106 |
|
try { |
107 |
0 |
synchronized( this ) { |
108 |
0 |
wait( 25L ); |
109 |
0 |
} |
110 |
|
} |
111 |
0 |
catch( Exception e ) { |
112 |
0 |
e.printStackTrace(); |
113 |
0 |
} |
114 |
|
} |
115 |
0 |
} |
116 |
|
} |