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; }
/** 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 /////////////////////////////////////////////////////////