diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-07 12:43:32 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-07 12:43:32 -0500 |
commit | cffc83b19b5de0566daa7c228ec6c107de5f4779 (patch) | |
tree | 2a234fb02d4d1ccbaea06322f38ff7771476da3a /src/com/fourisland/fourpuzzle/util/ObjectLoader.java | |
parent | 216af4399f9e4ce676c399f2ffe72ca6d021d47d (diff) | |
download | fourpuzzle-cffc83b19b5de0566daa7c228ec6c107de5f4779.tar.gz fourpuzzle-cffc83b19b5de0566daa7c228ec6c107de5f4779.tar.bz2 fourpuzzle-cffc83b19b5de0566daa7c228ec6c107de5f4779.zip |
Fixed transparent image in ObjectLoader
Diffstat (limited to 'src/com/fourisland/fourpuzzle/util/ObjectLoader.java')
-rw-r--r-- | src/com/fourisland/fourpuzzle/util/ObjectLoader.java | 20 |
1 files changed, 3 insertions, 17 deletions
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) |