Name: dbT83986 Date: 05/19/99
I am developing a CGI script that creates a GIF file on the fly as
output.
The following program (with associated classes) works if it is run with
the
worstation open and with DISPLAY (X-11) set. But the
getGraphics(..)
call hangs if DISPLAY is not set. Of course no DISPLAY can be set for
a CGI program !!!
Any comments, ideas will be deeply appreciated.
Paul
import java.io.*;
import java.awt.*;
import java.awt.image.*;
//import Acme.JPM.Encoders.*;
public class TestGif
{ public static void main(String[] args)
throws IOException
{ Image off = new BufferedImage(400,300,
BufferedImage.TYPE_INT_RGB);
System.err.print("one");
// getGraphics() hangs if no DISPLAY
Graphics off_g = off.getGraphics();
off_g.drawRect(20,20,100,70);
FileOutputStream out = new FileOutputStream("rect.gif");
GifEncoder en = new GifEncoder(off, out);
en.encode(); // sends GIF to file out
return;
}
}
(Review ID: 57936)
======================================================================