Class pmr.simplegraph.GIFEncoder
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pmr.simplegraph.GIFEncoder

java.lang.Object
   |
   +----pmr.simplegraph.GIFEncoder

public class GIFEncoder
extends Object
Borrowed with thanks by PMR
  GIFEncoder is a class which takes an image and saves it to a stream
  using the GIF file format (Graphics Interchange
  Format). A GIFEncoder
  is constructed with either an AWT Image (which must be fully
  loaded) or a set of RGB arrays. The image can be written out with a
  call to Write.

Three caveats:

GIFEncoder is based upon gifsave.c, which was written and released by:

Sverre H. Huseby
Bjoelsengt. 17
N-0468 Oslo
Norway

Phone: +47 2 230539
sverrehu@ifi.uio.no

@version 0.90 21 Apr 1996 @author Adam Doppelt

Constructor Index

 o GIFEncoder(byte[][], byte[][], byte[][])
Construct a GIFEncoder.
 o GIFEncoder(Image)
Construct a GIFEncoder.

Method Index

 o Write(OutputStream)
Writes the image out to a stream in the GIF file format.

Constructors

 o GIFEncoder
  public GIFEncoder(Image image) throws AWTException
Construct a GIFEncoder. The constructor will convert the image to an indexed color array. This may take some time.

@param image The image to encode. The image must be completely loaded. @exception AWTException Will be thrown if the pixel grab fails. This can happen if Java runs out of memory. It may also indicate that the image contains more than 256 colors.

 o GIFEncoder
  public GIFEncoder(byte r[][],
                    byte g[][],
                    byte b[][]) throws AWTException
Construct a GIFEncoder. The constructor will convert the image to an indexed color array. This may take some time.


Each array stores intensity values for the image. In other words, r[x][y] refers to the red intensity of the pixel at column x, row y.

Parameters:
r - An array containing the red intensity values.
g - An array containing the green intensity values.
b - An array containing the blue intensity values.
Throws: AWTException
Will be thrown if the image contains more than 256 colors.

Methods

 o Write
  public void Write(OutputStream output) throws IOException
Writes the image out to a stream in the GIF file format. This will be a single GIF87a image, non-interlaced, with no background color. This may take some time.

@param output The stream to output to. This should probably be a buffered stream. @exception IOException Will be thrown if a write operation fails.


All Packages  Class Hierarchy  This Package  Previous  Next  Index