Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4239783

Need to do off-screen drawing in CGI program written in java to create GIF outpu

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.1
    • client-libs
    • generic
    • generic



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

            Unassigned Unassigned
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: