diff options
Diffstat (limited to 'src/com')
3 files changed, 4 insertions, 64 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java index 4fac1c0..5ae3fbd 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java | |||
@@ -69,7 +69,7 @@ public class ChipSet { | |||
69 | { | 69 | { |
70 | ChipSet temp = new ChipSet(); | 70 | ChipSet temp = new ChipSet(); |
71 | temp.chipSetData = lower; | 71 | temp.chipSetData = lower; |
72 | temp.chipSetImage = ObjectLoader.getImage("ChipSet", name); | 72 | temp.chipSetImage = ObjectLoader.getImage("ChipSet", name, trans); |
73 | 73 | ||
74 | chipSets.put(name, temp); | 74 | chipSets.put(name, temp); |
75 | } | 75 | } |
diff --git a/src/com/fourisland/fourpuzzle/util/ObjectLoader.java b/src/com/fourisland/fourpuzzle/util/ObjectLoader.java index b149ddd..58cf5ee 100644 --- a/src/com/fourisland/fourpuzzle/util/ObjectLoader.java +++ b/src/com/fourisland/fourpuzzle/util/ObjectLoader.java | |||
@@ -5,12 +5,9 @@ | |||
5 | 5 | ||
6 | package com.fourisland.fourpuzzle.util; | 6 | package com.fourisland.fourpuzzle.util; |
7 | 7 | ||
8 | //import com.alienfactory.javamappy.loader.MapLoader; | ||
9 | import com.fourisland.fourpuzzle.PuzzleApplication; | 8 | import com.fourisland.fourpuzzle.PuzzleApplication; |
10 | import java.awt.Image; | 9 | import java.awt.Color; |
11 | import java.awt.Toolkit; | ||
12 | import java.awt.image.BufferedImage; | 10 | import java.awt.image.BufferedImage; |
13 | import java.awt.image.FilteredImageSource; | ||
14 | import java.io.IOException; | 11 | import java.io.IOException; |
15 | import java.io.InputStream; | 12 | import java.io.InputStream; |
16 | import java.util.HashMap; | 13 | import java.util.HashMap; |
@@ -68,7 +65,7 @@ public class ObjectLoader { | |||
68 | { | 65 | { |
69 | throw new ResourceNotFoundException(type, name); | 66 | throw new ResourceNotFoundException(type, name); |
70 | } | 67 | } |
71 | 68 | ||
72 | BufferedImage bImg = null; | 69 | BufferedImage bImg = null; |
73 | try { | 70 | try { |
74 | bImg = ImageIO.read(str); | 71 | bImg = ImageIO.read(str); |
@@ -76,9 +73,7 @@ public class ObjectLoader { | |||
76 | Logger.getLogger(ObjectLoader.class.getName()).log(Level.SEVERE, null, ex); | 73 | Logger.getLogger(ObjectLoader.class.getName()).log(Level.SEVERE, null, ex); |
77 | } | 74 | } |
78 | 75 | ||
79 | bImg = new BufferedImage(bImg.getWidth(), bImg.getHeight(), BufferedImage.TYPE_INT_RGB); | 76 | bImg.createGraphics().drawImage(bImg, 0, 0, new Color(transparencyColor, true), null); |
80 | Image image = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(bImg.getSource(), new TransparentImageFilter(transparencyColor))); | ||
81 | bImg.createGraphics().drawImage(image, 0, 0, null); | ||
82 | 77 | ||
83 | addToObjectCache(type,name,bImg); | 78 | addToObjectCache(type,name,bImg); |
84 | } | 79 | } |
@@ -86,15 +81,6 @@ public class ObjectLoader { | |||
86 | return (BufferedImage) objectCache.get(type + "/" + name); | 81 | return (BufferedImage) objectCache.get(type + "/" + name); |
87 | } | 82 | } |
88 | 83 | ||
89 | /*public static com.alienfactory.javamappy.Map getMap(String name) throws Exception | ||
90 | { | ||
91 | ResourceMap rm = PuzzleApplication.getInstance().getContext().getResourceManager().getResourceMap(); | ||
92 | String filename = rm.getResourcesDir() + "mapdata/" + name + ".fmp"; | ||
93 | |||
94 | //com.alienfactory.javamappy.Map map = MapLoader.loadMap(rm.getClassLoader().getResourceAsStream(filename)); | ||
95 | return map; | ||
96 | }*/ | ||
97 | |||
98 | public static void addToObjectCache(String type, String name, Object object) | 84 | public static void addToObjectCache(String type, String name, Object object) |
99 | { | 85 | { |
100 | if (objectCache.size() >= 100) | 86 | if (objectCache.size() >= 100) |
diff --git a/src/com/fourisland/fourpuzzle/util/TransparentImageFilter.java b/src/com/fourisland/fourpuzzle/util/TransparentImageFilter.java deleted file mode 100644 index bd830cc..0000000 --- a/src/com/fourisland/fourpuzzle/util/TransparentImageFilter.java +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Tiled Map Editor, (c) 2004-2006 | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * Adam Turk <aturk@biggeruniverse.com> | ||
10 | * Bjorn Lindeijer <b.lindeijer@xs4all.nl> | ||
11 | */ | ||
12 | |||
13 | package com.fourisland.fourpuzzle.util; | ||
14 | |||
15 | import java.awt.image.RGBImageFilter; | ||
16 | |||
17 | /** | ||
18 | * This filter is used for filtering out a given "transparent" color from an | ||
19 | * image. Sometimes known as magic pink. | ||
20 | */ | ||
21 | public class TransparentImageFilter extends RGBImageFilter | ||
22 | { | ||
23 | int trans; | ||
24 | |||
25 | /** | ||
26 | * @param col the color to make transparent | ||
27 | */ | ||
28 | public TransparentImageFilter(int col) { | ||
29 | trans = col; | ||
30 | |||
31 | // The filter doesn't depend on pixel location | ||
32 | canFilterIndexColorModel = true; | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * Filters the given pixel. It returns a transparent pixel for pixels that | ||
37 | * match the transparency color, or the existing pixel for anything else. | ||
38 | */ | ||
39 | public int filterRGB(int x, int y, int rgb) { | ||
40 | if (rgb == trans) { | ||
41 | return 0; | ||
42 | } else { | ||
43 | return rgb; | ||
44 | } | ||
45 | } | ||
46 | } \ No newline at end of file | ||