diff options
-rwxr-xr-x | src/com/fourisland/fourpuzzle/Display.java | 49 | ||||
-rwxr-xr-x | src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java | 4 | ||||
-rwxr-xr-x | src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java | 3 | ||||
-rw-r--r-- | src/com/fourisland/fourpuzzle/resources/RMG2000.ttf | bin | 0 -> 70260 bytes | |||
-rwxr-xr-x | src/com/fourisland/fourpuzzle/window/ChoiceWindow.java | 28 | ||||
-rw-r--r-- | src/com/fourisland/fourpuzzle/window/MessageWindow.java | 33 | ||||
-rwxr-xr-x | src/com/fourisland/fourpuzzle/window/SystemGraphic.java | 4 | ||||
-rw-r--r-- | src/com/fourisland/fourpuzzle/window/Window.java | 3 |
8 files changed, 71 insertions, 53 deletions
diff --git a/src/com/fourisland/fourpuzzle/Display.java b/src/com/fourisland/fourpuzzle/Display.java index 5f5a891..85acaf4 100755 --- a/src/com/fourisland/fourpuzzle/Display.java +++ b/src/com/fourisland/fourpuzzle/Display.java | |||
@@ -11,13 +11,20 @@ import com.fourisland.fourpuzzle.transition.OutTransition; | |||
11 | import com.fourisland.fourpuzzle.transition.Transition; | 11 | import com.fourisland.fourpuzzle.transition.Transition; |
12 | import com.fourisland.fourpuzzle.transition.TransitionDirection; | 12 | import com.fourisland.fourpuzzle.transition.TransitionDirection; |
13 | import com.fourisland.fourpuzzle.transition.TransitionUnsupportedException; | 13 | import com.fourisland.fourpuzzle.transition.TransitionUnsupportedException; |
14 | import java.awt.Font; | ||
15 | import java.awt.FontFormatException; | ||
14 | import java.awt.Graphics2D; | 16 | import java.awt.Graphics2D; |
15 | import java.awt.Image; | 17 | import java.awt.Image; |
16 | import java.awt.Toolkit; | 18 | import java.awt.Toolkit; |
17 | import java.awt.image.BufferedImage; | 19 | import java.awt.image.BufferedImage; |
18 | import java.awt.image.VolatileImage; | 20 | import java.awt.image.VolatileImage; |
21 | import java.io.IOException; | ||
22 | import java.io.InputStream; | ||
19 | import java.util.concurrent.CountDownLatch; | 23 | import java.util.concurrent.CountDownLatch; |
24 | import java.util.logging.Level; | ||
25 | import java.util.logging.Logger; | ||
20 | import javax.swing.JDialog; | 26 | import javax.swing.JDialog; |
27 | import org.jdesktop.application.ResourceMap; | ||
21 | 28 | ||
22 | /** | 29 | /** |
23 | * | 30 | * |
@@ -118,11 +125,11 @@ public class Display { | |||
118 | { | 125 | { |
119 | temp.setPreTransition(midTransition); | 126 | temp.setPreTransition(midTransition); |
120 | 127 | ||
121 | postTransition = new BufferedImage(Game.WIDTH, Game.HEIGHT, BufferedImage.TYPE_INT_ARGB); | 128 | postTransition = Display.createCanvas(Game.WIDTH, Game.HEIGHT); |
122 | Game.getGameState().render(postTransition.createGraphics()); | 129 | Game.getGameState().render(postTransition.createGraphics()); |
123 | temp.setPostTransition(postTransition); | 130 | temp.setPostTransition(postTransition); |
124 | } else { | 131 | } else { |
125 | BufferedImage preTransition = new BufferedImage(Game.WIDTH, Game.HEIGHT, BufferedImage.TYPE_INT_ARGB); | 132 | BufferedImage preTransition = Display.createCanvas(Game.WIDTH, Game.HEIGHT); |
126 | Game.getGameState().render(preTransition.createGraphics()); | 133 | Game.getGameState().render(preTransition.createGraphics()); |
127 | temp.setPreTransition(preTransition); | 134 | temp.setPreTransition(preTransition); |
128 | } | 135 | } |
@@ -139,11 +146,11 @@ public class Display { | |||
139 | { | 146 | { |
140 | transition.setPreTransition(midTransition); | 147 | transition.setPreTransition(midTransition); |
141 | 148 | ||
142 | postTransition = new BufferedImage(Game.WIDTH, Game.HEIGHT, BufferedImage.TYPE_INT_ARGB); | 149 | postTransition = Display.createCanvas(Game.WIDTH, Game.HEIGHT); |
143 | Game.getGameState().render(postTransition.createGraphics()); | 150 | Game.getGameState().render(postTransition.createGraphics()); |
144 | ((InTransition) transition).setPostTransition(postTransition); | 151 | ((InTransition) transition).setPostTransition(postTransition); |
145 | } else { | 152 | } else { |
146 | BufferedImage preTransition = new BufferedImage(Game.WIDTH, Game.HEIGHT, BufferedImage.TYPE_INT_ARGB); | 153 | BufferedImage preTransition = Display.createCanvas(Game.WIDTH, Game.HEIGHT); |
147 | Game.getGameState().render(preTransition.createGraphics()); | 154 | Game.getGameState().render(preTransition.createGraphics()); |
148 | transition.setPreTransition(preTransition); | 155 | transition.setPreTransition(preTransition); |
149 | } | 156 | } |
@@ -169,4 +176,38 @@ public class Display { | |||
169 | return transitionRunning; | 176 | return transitionRunning; |
170 | } | 177 | } |
171 | 178 | ||
179 | private static Font theFont = null; | ||
180 | private static void initalizeFont() | ||
181 | { | ||
182 | ResourceMap rm = PuzzleApplication.getInstance().getContext().getResourceMap(); | ||
183 | InputStream file = rm.getClassLoader().getResourceAsStream("com/fourisland/fourpuzzle/resources/RMG2000.ttf"); | ||
184 | |||
185 | try { | ||
186 | theFont = Font.createFont(Font.TRUETYPE_FONT, file); | ||
187 | } catch (FontFormatException ex) { | ||
188 | Logger.getLogger(Display.class.getName()).log(Level.SEVERE, null, ex); | ||
189 | } catch (IOException ex) { | ||
190 | Logger.getLogger(Display.class.getName()).log(Level.SEVERE, null, ex); | ||
191 | } | ||
192 | |||
193 | theFont = theFont.deriveFont(Font.PLAIN, 10); | ||
194 | } | ||
195 | |||
196 | public static void setFont(Graphics2D g) | ||
197 | { | ||
198 | if (theFont == null) | ||
199 | { | ||
200 | initalizeFont(); | ||
201 | } | ||
202 | |||
203 | g.setFont(theFont); | ||
204 | } | ||
205 | |||
206 | public static BufferedImage createCanvas(int width, int height) | ||
207 | { | ||
208 | BufferedImage temp = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); | ||
209 | |||
210 | return temp; | ||
211 | } | ||
212 | |||
172 | } | 213 | } |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java index bb40b39..124ea95 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java | |||
@@ -214,7 +214,7 @@ public abstract class Map { | |||
214 | { | 214 | { |
215 | if (lowerLayer == null) | 215 | if (lowerLayer == null) |
216 | { | 216 | { |
217 | lowerLayer = new BufferedImage(size.width*16, size.height*16, BufferedImage.TYPE_INT_ARGB); | 217 | lowerLayer = Display.createCanvas(size.width*16, size.height*16); |
218 | Graphics2D g = lowerLayer.createGraphics(); | 218 | Graphics2D g = lowerLayer.createGraphics(); |
219 | ChipSet chipSetObj = ChipSet.getChipSet(chipSet); | 219 | ChipSet chipSetObj = ChipSet.getChipSet(chipSet); |
220 | int i,x,y; | 220 | int i,x,y; |
@@ -243,7 +243,7 @@ public abstract class Map { | |||
243 | { | 243 | { |
244 | if (upperLayer == null) | 244 | if (upperLayer == null) |
245 | { | 245 | { |
246 | upperLayer = new BufferedImage(size.width*16, size.height*16, BufferedImage.TYPE_INT_ARGB); | 246 | upperLayer = Display.createCanvas(size.width*16, size.height*16); |
247 | Graphics2D g = upperLayer.createGraphics(); | 247 | Graphics2D g = upperLayer.createGraphics(); |
248 | ChipSet chipSetObj = ChipSet.getChipSet(chipSet); | 248 | ChipSet chipSetObj = ChipSet.getChipSet(chipSet); |
249 | int i,x,y; | 249 | int i,x,y; |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index 52a56c4..8f411af 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java | |||
@@ -8,6 +8,7 @@ package com.fourisland.fourpuzzle.gamestate.mapview; | |||
8 | import com.fourisland.fourpuzzle.Audio; | 8 | import com.fourisland.fourpuzzle.Audio; |
9 | import com.fourisland.fourpuzzle.gamestate.*; | 9 | import com.fourisland.fourpuzzle.gamestate.*; |
10 | import com.fourisland.fourpuzzle.Direction; | 10 | import com.fourisland.fourpuzzle.Direction; |
11 | import com.fourisland.fourpuzzle.Display; | ||
11 | import com.fourisland.fourpuzzle.gamestate.mapview.event.HeroEvent; | 12 | import com.fourisland.fourpuzzle.gamestate.mapview.event.HeroEvent; |
12 | import com.fourisland.fourpuzzle.Game; | 13 | import com.fourisland.fourpuzzle.Game; |
13 | import com.fourisland.fourpuzzle.Layer; | 14 | import com.fourisland.fourpuzzle.Layer; |
@@ -206,7 +207,7 @@ public class MapViewGameState implements GameState { | |||
206 | 207 | ||
207 | g.drawImage(currentMap.renderLower(), 0, 0, Game.WIDTH, Game.HEIGHT, x, y, x+Game.WIDTH, y+Game.HEIGHT, null); | 208 | g.drawImage(currentMap.renderLower(), 0, 0, Game.WIDTH, Game.HEIGHT, x, y, x+Game.WIDTH, y+Game.HEIGHT, null); |
208 | 209 | ||
209 | BufferedImage eventLayer = new BufferedImage(currentMap.getSize().width*16, currentMap.getSize().height*16, BufferedImage.TYPE_INT_ARGB); | 210 | BufferedImage eventLayer = Display.createCanvas(currentMap.getSize().width*16, currentMap.getSize().height*16); |
210 | Graphics2D g2 = eventLayer.createGraphics(); | 211 | Graphics2D g2 = eventLayer.createGraphics(); |
211 | EventList events = currentMap.getEvents(); | 212 | EventList events = currentMap.getEvents(); |
212 | 213 | ||
diff --git a/src/com/fourisland/fourpuzzle/resources/RMG2000.ttf b/src/com/fourisland/fourpuzzle/resources/RMG2000.ttf new file mode 100644 index 0000000..5012ff1 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/resources/RMG2000.ttf | |||
Binary files differ | |||
diff --git a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java index bf193c1..ca84383 100755 --- a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java +++ b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java | |||
@@ -6,9 +6,9 @@ | |||
6 | package com.fourisland.fourpuzzle.window; | 6 | package com.fourisland.fourpuzzle.window; |
7 | 7 | ||
8 | import com.fourisland.fourpuzzle.Audio; | 8 | import com.fourisland.fourpuzzle.Audio; |
9 | import com.fourisland.fourpuzzle.Display; | ||
9 | import com.fourisland.fourpuzzle.database.Database; | 10 | import com.fourisland.fourpuzzle.database.Database; |
10 | import com.fourisland.fourpuzzle.database.Sound; | 11 | import com.fourisland.fourpuzzle.database.Sound; |
11 | import java.awt.Font; | ||
12 | import java.awt.Graphics2D; | 12 | import java.awt.Graphics2D; |
13 | import java.awt.Rectangle; | 13 | import java.awt.Rectangle; |
14 | import java.awt.TexturePaint; | 14 | import java.awt.TexturePaint; |
@@ -26,20 +26,18 @@ public class ChoiceWindow { | |||
26 | private List<String> choices; | 26 | private List<String> choices; |
27 | int numChoices; | 27 | int numChoices; |
28 | boolean center; | 28 | boolean center; |
29 | private int width; | ||
30 | private int height; | ||
31 | BufferedImage cacheBase; | ||
29 | public ChoiceWindow(List<String> choices, boolean center) | 32 | public ChoiceWindow(List<String> choices, boolean center) |
30 | { | 33 | { |
31 | this.choices = choices; | 34 | this.choices = choices; |
32 | numChoices = choices.size(); | 35 | numChoices = choices.size(); |
33 | this.center = center; | 36 | this.center = center; |
34 | 37 | ||
35 | createGraphic(new BufferedImage(Window.Default.getFullWidth(width), Window.Default.getFullHeight(height), BufferedImage.TYPE_INT_ARGB).createGraphics()); | 38 | Graphics2D g3 = Display.createCanvas(1, 1).createGraphics(); |
36 | } | 39 | Display.setFont(g3); |
37 | 40 | ||
38 | private int width; | ||
39 | private int height; | ||
40 | BufferedImage cacheBase; | ||
41 | private void createGraphic(Graphics2D g3) | ||
42 | { | ||
43 | for (String choice : choices) | 41 | for (String choice : choices) |
44 | { | 42 | { |
45 | int l = g3.getFontMetrics().stringWidth(choice); | 43 | int l = g3.getFontMetrics().stringWidth(choice); |
@@ -58,12 +56,12 @@ public class ChoiceWindow { | |||
58 | 56 | ||
59 | public void render(Graphics2D g2, int x, int y) | 57 | public void render(Graphics2D g2, int x, int y) |
60 | { | 58 | { |
61 | g2.drawImage(cacheBase, x, y, null); | 59 | Display.setFont(g2); |
62 | 60 | ||
63 | g2.setFont(g2.getFont().deriveFont(Font.BOLD)); | 61 | g2.drawImage(cacheBase, x, y, null); |
64 | 62 | ||
65 | int fh = g2.getFontMetrics().getHeight(); | 63 | int fh = g2.getFontMetrics().getHeight(); |
66 | int ty = Window.Default.getTopY()+fh-(SPACER/2)+y; | 64 | int ty = Window.Default.getTopY()+fh+y; |
67 | for (String choice : choices) | 65 | for (String choice : choices) |
68 | { | 66 | { |
69 | int fw = g2.getFontMetrics().stringWidth(choice); | 67 | int fw = g2.getFontMetrics().stringWidth(choice); |
@@ -76,7 +74,7 @@ public class ChoiceWindow { | |||
76 | 74 | ||
77 | if (getSelected().equals(choice)) | 75 | if (getSelected().equals(choice)) |
78 | { | 76 | { |
79 | g2.drawImage(Window.Selector.getImage(fw-Window.Selector.getLeftX(), fh-Window.Selector.getTopY()), tx-SPACER, ty-fh, null); | 77 | g2.drawImage(Window.Selector.getImage(fw-Window.Selector.getLeftX(), fh-Window.Selector.getTopY()), tx-SPACER, ty-fh-SPACER, null); |
80 | } | 78 | } |
81 | 79 | ||
82 | g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, fw, fh))); | 80 | g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, fw, fh))); |
@@ -84,8 +82,6 @@ public class ChoiceWindow { | |||
84 | 82 | ||
85 | ty+=(SPACER+g2.getFontMetrics().getHeight()); | 83 | ty+=(SPACER+g2.getFontMetrics().getHeight()); |
86 | } | 84 | } |
87 | |||
88 | g2.setFont(g2.getFont().deriveFont(Font.PLAIN)); | ||
89 | } | 85 | } |
90 | 86 | ||
91 | public int getWidth() | 87 | public int getWidth() |
@@ -124,4 +120,4 @@ public class ChoiceWindow { | |||
124 | return choices.get(selected); | 120 | return choices.get(selected); |
125 | } | 121 | } |
126 | 122 | ||
127 | } | 123 | } \ No newline at end of file |
diff --git a/src/com/fourisland/fourpuzzle/window/MessageWindow.java b/src/com/fourisland/fourpuzzle/window/MessageWindow.java index ea34ab9..deab252 100644 --- a/src/com/fourisland/fourpuzzle/window/MessageWindow.java +++ b/src/com/fourisland/fourpuzzle/window/MessageWindow.java | |||
@@ -5,19 +5,14 @@ | |||
5 | 5 | ||
6 | package com.fourisland.fourpuzzle.window; | 6 | package com.fourisland.fourpuzzle.window; |
7 | 7 | ||
8 | import com.fourisland.fourpuzzle.Display; | ||
8 | import com.fourisland.fourpuzzle.Game; | 9 | import com.fourisland.fourpuzzle.Game; |
9 | import java.awt.Font; | ||
10 | import java.awt.FontFormatException; | ||
11 | import java.awt.Graphics2D; | 10 | import java.awt.Graphics2D; |
12 | import java.awt.Rectangle; | 11 | import java.awt.Rectangle; |
13 | import java.awt.TexturePaint; | 12 | import java.awt.TexturePaint; |
14 | import java.awt.image.BufferedImage; | 13 | import java.awt.image.BufferedImage; |
15 | import java.io.File; | ||
16 | import java.io.IOException; | ||
17 | import java.util.ArrayList; | 14 | import java.util.ArrayList; |
18 | import java.util.List; | 15 | import java.util.List; |
19 | import java.util.logging.Level; | ||
20 | import java.util.logging.Logger; | ||
21 | 16 | ||
22 | /** | 17 | /** |
23 | * | 18 | * |
@@ -26,7 +21,7 @@ import java.util.logging.Logger; | |||
26 | public class MessageWindow { | 21 | public class MessageWindow { |
27 | 22 | ||
28 | private static final int SPACER = 4; | 23 | private static final int SPACER = 4; |
29 | private static final int HEIGHT = 4*(new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics().getFontMetrics().getHeight()+SPACER); | 24 | private static final int HEIGHT = 4*(Display.createCanvas(1, 1).createGraphics().getFontMetrics().getHeight()+SPACER); |
30 | 25 | ||
31 | private List<String> messages; | 26 | private List<String> messages; |
32 | int width; | 27 | int width; |
@@ -36,14 +31,14 @@ public class MessageWindow { | |||
36 | width = Game.WIDTH - Window.Default.getFullWidth(0); | 31 | width = Game.WIDTH - Window.Default.getFullWidth(0); |
37 | messages = new ArrayList<String>(); | 32 | messages = new ArrayList<String>(); |
38 | 33 | ||
39 | initalizeMessages(message, new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics()); | 34 | initalizeMessages(message, Display.createCanvas(1, 1).createGraphics()); |
40 | 35 | ||
41 | cacheBase = Window.Default.getImage(width, HEIGHT); | 36 | cacheBase = Window.Default.getImage(width, HEIGHT); |
42 | } | 37 | } |
43 | 38 | ||
44 | private void initalizeMessages(String message, Graphics2D g) | 39 | private void initalizeMessages(String message, Graphics2D g) |
45 | { | 40 | { |
46 | setFont(g); | 41 | Display.setFont(g); |
47 | 42 | ||
48 | String temp = message; | 43 | String temp = message; |
49 | int len = 0; | 44 | int len = 0; |
@@ -79,9 +74,9 @@ public class MessageWindow { | |||
79 | { | 74 | { |
80 | int y = MessageWindowLocation.Bottom.getY(); | 75 | int y = MessageWindowLocation.Bottom.getY(); |
81 | 76 | ||
77 | Display.setFont(g2); | ||
78 | |||
82 | g2.drawImage(cacheBase, 0, y, null); | 79 | g2.drawImage(cacheBase, 0, y, null); |
83 | |||
84 | setFont(g2); | ||
85 | 80 | ||
86 | int fh = g2.getFontMetrics().getHeight(); | 81 | int fh = g2.getFontMetrics().getHeight(); |
87 | int ty = Window.Default.getTopY()+fh-(SPACER/2)+y; | 82 | int ty = Window.Default.getTopY()+fh-(SPACER/2)+y; |
@@ -97,8 +92,6 @@ public class MessageWindow { | |||
97 | 92 | ||
98 | ty+=(SPACER+g2.getFontMetrics().getHeight()); | 93 | ty+=(SPACER+g2.getFontMetrics().getHeight()); |
99 | } | 94 | } |
100 | |||
101 | g2.setFont(g2.getFont().deriveFont(Font.PLAIN)); | ||
102 | } | 95 | } |
103 | 96 | ||
104 | public static enum MessageWindowLocation | 97 | public static enum MessageWindowLocation |
@@ -118,18 +111,4 @@ public class MessageWindow { | |||
118 | return y; | 111 | return y; |
119 | } | 112 | } |
120 | } | 113 | } |
121 | |||
122 | public static void setFont(Graphics2D g) | ||
123 | { | ||
124 | try { | ||
125 | g.setFont(Font.createFont(Font.TRUETYPE_FONT, new File("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf"))); | ||
126 | } catch (FontFormatException ex) { | ||
127 | Logger.getLogger(MessageWindow.class.getName()).log(Level.SEVERE, null, ex); | ||
128 | } catch (IOException ex) { | ||
129 | Logger.getLogger(MessageWindow.class.getName()).log(Level.SEVERE, null, ex); | ||
130 | } | ||
131 | |||
132 | g.setFont(g.getFont().deriveFont(Font.PLAIN, 10)); | ||
133 | } | ||
134 | |||
135 | } | 114 | } |
diff --git a/src/com/fourisland/fourpuzzle/window/SystemGraphic.java b/src/com/fourisland/fourpuzzle/window/SystemGraphic.java index a17a83f..75e2b45 100755 --- a/src/com/fourisland/fourpuzzle/window/SystemGraphic.java +++ b/src/com/fourisland/fourpuzzle/window/SystemGraphic.java | |||
@@ -5,9 +5,9 @@ | |||
5 | 5 | ||
6 | package com.fourisland.fourpuzzle.window; | 6 | package com.fourisland.fourpuzzle.window; |
7 | 7 | ||
8 | import com.fourisland.fourpuzzle.Display; | ||
8 | import com.fourisland.fourpuzzle.util.ObjectLoader; | 9 | import com.fourisland.fourpuzzle.util.ObjectLoader; |
9 | import com.fourisland.fourpuzzle.util.TransparentPixelFilter; | 10 | import com.fourisland.fourpuzzle.util.TransparentPixelFilter; |
10 | import com.fourisland.fourpuzzle.window.Window.SystemArea; | ||
11 | import java.awt.Rectangle; | 11 | import java.awt.Rectangle; |
12 | import java.awt.Toolkit; | 12 | import java.awt.Toolkit; |
13 | import java.awt.image.BufferedImage; | 13 | import java.awt.image.BufferedImage; |
@@ -29,7 +29,7 @@ public class SystemGraphic { | |||
29 | public static void initalize() | 29 | public static void initalize() |
30 | { | 30 | { |
31 | BufferedImage temp = ObjectLoader.getImage("Picture", filename); | 31 | BufferedImage temp = ObjectLoader.getImage("Picture", filename); |
32 | systemGraphic = new BufferedImage(160, 80, BufferedImage.TYPE_INT_ARGB); | 32 | systemGraphic = Display.createCanvas(160, 80); |
33 | 33 | ||
34 | systemGraphic.createGraphics().drawImage(Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(temp.getSource(), new TransparentPixelFilter(temp.getRGB(159, 0)))),0,0,null); | 34 | systemGraphic.createGraphics().drawImage(Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(temp.getSource(), new TransparentPixelFilter(temp.getRGB(159, 0)))),0,0,null); |
35 | } | 35 | } |
diff --git a/src/com/fourisland/fourpuzzle/window/Window.java b/src/com/fourisland/fourpuzzle/window/Window.java index f970b68..db1bfab 100644 --- a/src/com/fourisland/fourpuzzle/window/Window.java +++ b/src/com/fourisland/fourpuzzle/window/Window.java | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | package com.fourisland.fourpuzzle.window; | 6 | package com.fourisland.fourpuzzle.window; |
7 | 7 | ||
8 | import com.fourisland.fourpuzzle.Display; | ||
8 | import com.fourisland.fourpuzzle.util.Interval; | 9 | import com.fourisland.fourpuzzle.util.Interval; |
9 | import java.awt.Graphics2D; | 10 | import java.awt.Graphics2D; |
10 | import java.awt.Rectangle; | 11 | import java.awt.Rectangle; |
@@ -134,7 +135,7 @@ public enum Window | |||
134 | 135 | ||
135 | public BufferedImage getImage(int width, int height) | 136 | public BufferedImage getImage(int width, int height) |
136 | { | 137 | { |
137 | BufferedImage temp = new BufferedImage(getFullWidth(width), getFullHeight(height), BufferedImage.TYPE_INT_ARGB); | 138 | BufferedImage temp = Display.createCanvas(getFullWidth(width), getFullHeight(height)); |
138 | Graphics2D g = temp.createGraphics(); | 139 | Graphics2D g = temp.createGraphics(); |
139 | 140 | ||
140 | g.drawImage(getBackground(), 3, 3, getFullWidth(width)-6, getFullHeight(height)-6, null); | 141 | g.drawImage(getBackground(), 3, 3, getFullWidth(width)-6, getFullHeight(height)-6, null); |