2003/10/29 04:06:21
[org.ibex.core.git] / src / org / xwt / translators / GIF.java
index b3359f5..4ac420f 100644 (file)
@@ -51,10 +51,12 @@ import java.io.IOException;
 import java.io.PrintWriter;
 
 /** Converts an InputStream carrying a GIF image into an ARGB int[] */
-public class GIF extends ImageDecoder {
+public class GIF {
 
     // Public Methods /////////////////////////////////////////////////////////
 
+    public GIF() { }
+
     public int[] getData() { return data; }
     public int getWidth() { return width; }
     public int getHeight() { return height; }
@@ -62,20 +64,18 @@ public class GIF extends ImageDecoder {
     /** Processes an image from InputStream is; returns null if there is an error
         @param name A string describing the image; used for error reporting.
      */
-    public static GIF decode(InputStream is, String name) {
+    public Picture fromInputStream(InputStream is, String name) {
         try {
-            return new GIF(is, name);
+            if (is instanceof BufferedInputStream) _in = (BufferedInputStream)is;
+            else _in = new BufferedInputStream(is);
+            decodeAsBufferedImage(0);
+            return Platform.createPicture(data, width, height);
         } catch (Exception e) {
             if (Log.on) Log.log(GIF.class, e);
             return null;
         }
     }
 
-    private GIF(InputStream is, String name) throws IOException {
-        if (is instanceof BufferedInputStream) _in = (BufferedInputStream)is;
-        else _in = new BufferedInputStream(is);
-        decodeAsBufferedImage(0);
-    }
 
     // Private Methods /////////////////////////////////////////////////////////