%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
tsukuba_bunko.peko.canvas.stage.Effect |
|
|
1 | /* |
|
2 | * "Peko" Visual Novel System |
|
3 | * |
|
4 | * All Rights Reserved. |
|
5 | * Copyright (c) 1999-2003 Tsukuba Bunko. |
|
6 | * |
|
7 | * $Id: Effect.java,v 1.1 2005/07/11 12:49:18 ppoi Exp $ |
|
8 | */ |
|
9 | package tsukuba_bunko.peko.canvas.stage; |
|
10 | ||
11 | import java.awt.Dimension; |
|
12 | import java.awt.Image; |
|
13 | ||
14 | import java.awt.image.BufferedImage; |
|
15 | ||
16 | ||
17 | /** |
|
18 | * エフェクトを実行するクラスの基本クラスです。 |
|
19 | * @author $Author: ppoi $ |
|
20 | * @version $Revision: 1.1 $ |
|
21 | */ |
|
22 | public abstract class Effect { |
|
23 | ||
24 | /** |
|
25 | * キャンバス |
|
26 | */ |
|
27 | 0 | private StageCanvas _canvas = null; |
28 | ||
29 | /** |
|
30 | * サイズキャッシュ |
|
31 | */ |
|
32 | 0 | private Dimension _size = new Dimension(); |
33 | ||
34 | ||
35 | /** |
|
36 | * <code>Effect</code> のインスタンスを作成するためにサブクラスのコンストラクタから呼ばれます。 |
|
37 | */ |
|
38 | protected Effect() |
|
39 | { |
|
40 | 0 | super(); |
41 | 0 | } |
42 | ||
43 | ||
44 | /** |
|
45 | * 初期化します。 |
|
46 | */ |
|
47 | public void initialize() |
|
48 | { |
|
49 | 0 | _canvas = null; |
50 | 0 | } |
51 | ||
52 | /** |
|
53 | * オフスクリーンバッファを描画するステージキャンバスを取得します。 |
|
54 | * @return ステージキャンバス |
|
55 | */ |
|
56 | protected StageCanvas getStageCanvas() |
|
57 | { |
|
58 | 0 | return _canvas; |
59 | } |
|
60 | ||
61 | /** |
|
62 | * ステージキャンバスのサイズを取得します。 |
|
63 | * @return サイズを格納した Dimension インスタンス |
|
64 | */ |
|
65 | protected Dimension getCanvasSize() |
|
66 | { |
|
67 | 0 | return _canvas.getSize( _size ); |
68 | } |
|
69 | ||
70 | /** |
|
71 | * <code>screen</code> をキャンバスに描画します。 |
|
72 | */ |
|
73 | protected void drawImage( Image screen ) |
|
74 | { |
|
75 | // _g.drawImage( screen, 0, 0, _canvas ); |
|
76 | 0 | _canvas.repaint(); |
77 | 0 | } |
78 | ||
79 | /** |
|
80 | * 実行手順のテンプレートメソッドです。 |
|
81 | * @param canvas オフスクリーンバッファを描画するキャンバス |
|
82 | * @param screen オフスクリーンバッファ |
|
83 | * @param next コピー元画像 |
|
84 | */ |
|
85 | public final void process( StageCanvas canvas, BufferedImage screen, BufferedImage next ) |
|
86 | { |
|
87 | 0 | _canvas = canvas; |
88 | 0 | perform( screen, next ); |
89 | 0 | initialize(); |
90 | 0 | } |
91 | ||
92 | /** |
|
93 | * この <code>Effect</code> の名前を取得します。 |
|
94 | * @return エフェクト名 |
|
95 | */ |
|
96 | public abstract String getName(); |
|
97 | ||
98 | /** |
|
99 | * <code>next</code> の内容をエフェクトをかけながら <code>screen</code> にコピーします。 |
|
100 | * @param screen オフスクリーンバッファ |
|
101 | * @param next コピー元画像 |
|
102 | */ |
|
103 | protected abstract void perform( BufferedImage screen, BufferedImage next ); |
|
104 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |