JDK-4239783 : Need to do off-screen drawing in CGI program written in java to create GIF outpu
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.2.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1999-05-20
  • Updated: 1999-12-20
  • Resolved: 1999-12-20
Related Reports
Duplicate :  
Description

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) 
======================================================================

Comments
EVALUATION This is headless AWT.
11-06-2004

WORK AROUND Name: dbT83986 Date: 05/19/99 Not known. ======================================================================
11-06-2004