COSC-4P82-Final-Project/lib/lilgp/lilgpMonitor/javadocs/GIFEncoder.html

153 lines
5.6 KiB
HTML

<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Sat May 10 12:23:02 1997 -->
<a name="_top_"></a>
<title>
Class GIFEncoder
</title>
</head>
<body>
<h1>
Class GIFEncoder
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
|
+----GIFEncoder
</pre>
<hr>
<dl>
<dt> public class <b>GIFEncoder</b>
<dt> extends <a href="java.lang.Object.html#_top_">Object</a>
</dl>
GIFEncoder is a class which takes an image and saves it to a stream
using the GIF file format (<A
HREF="http://www.dcs.ed.ac.uk/%7Emxr/gfx/">Graphics Interchange
Format</A>). 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 <CODE>Write</CODE>.<P>
Three caveats:
<UL>
<LI>GIFEncoder will convert the image to indexed color upon
construction. This will take some time, depending on the size of
the image. Also, actually writing the image out (Write) will take
time.<P>
<LI>The image cannot have more than 256 colors, since GIF is an 8
bit format. For a 24 bit to 8 bit quantization algorithm, see
Graphics Gems II III.2 by Xialoin Wu. Or check out his <A
HREF="http://www.csd.uwo.ca/faculty/wu/cq.c">C source</A>.<P>
<LI>Since the image must be completely loaded into memory,
GIFEncoder may have problems with large images. Attempting to
encode an image which will not fit into memory will probably
result in the following exception:<P>
<CODE>java.awt.AWTException: Grabber returned false: 192</CODE><P>
</UL><P>
GIFEncoder is based upon gifsave.c, which was written and released
by:<P>
<CENTER>
Sverre H. Huseby<BR>
Bjoelsengt. 17<BR>
N-0468 Oslo<BR>
Norway<P>
Phone: +47 2 230539<BR>
sverrehu@ifi.uio.no<P>
</CENTER>
<dl>
<dt> <b>Version:</b>
<dd> 0.90 21 Apr 1996
<dt> <b>Author:</b>
<dd> <A HREF="http://www.cs.brown.edu/people/amd/">Adam Doppelt</A>
</dl>
<hr>
<a name="index"></a>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#GIFEncoder(byte[][], byte[][], byte[][])"><b>GIFEncoder</b></a>(byte[][], byte[][], byte[][])
<dd> Construct a GIFEncoder.
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#GIFEncoder(java.awt.Image)"><b>GIFEncoder</b></a>(Image)
<dd> Construct a GIFEncoder.
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#Write(java.io.OutputStream)"><b>Write</b></a>(OutputStream)
<dd> Writes the image out to a stream in the GIF file format.
</dl>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="GIFEncoder"></a>
<a name="GIFEncoder(java.awt.Image)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>GIFEncoder</b>
<pre>
public GIFEncoder(<a href="java.awt.Image.html#_top_">Image</a> image) throws <a href="java.awt.AWTException.html#_top_">AWTException</a>
</pre>
<dl>
<dd> Construct a GIFEncoder. The constructor will convert the image to
an indexed color array. <B>This may take some time.</B><P>
<dl>
<dt> <b>Parameters:</b>
<dd> image - The image to encode. The image <B>must</B> be
completely loaded.
<dt> <b>Throws:</b> <a href="java.awt.AWTException.html#_top_">AWTException</a>
<dd> 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.
</dl>
</dl>
<a name="GIFEncoder(byte[][], byte[][], byte[][])"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>GIFEncoder</b>
<pre>
public GIFEncoder(byte r[][],
byte g[][],
byte b[][]) throws <a href="java.awt.AWTException.html#_top_">AWTException</a>
</pre>
<dl>
<dd> Construct a GIFEncoder. The constructor will convert the image to
an indexed color array. <B>This may take some time.</B><P>
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.<P>
<dl>
<dt> <b>Parameters:</b>
<dd> r - An array containing the red intensity values.
<dd> g - An array containing the green intensity values.
<dd> b - An array containing the blue intensity values.
<dt> <b>Throws:</b> <a href="java.awt.AWTException.html#_top_">AWTException</a>
<dd> Will be thrown if the image contains more than
256 colors.
</dl>
</dl>
<a name="methods"></a>
<h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="Write(java.io.OutputStream)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="Write"><b>Write</b></a>
<pre>
public void Write(<a href="java.io.OutputStream.html#_top_">OutputStream</a> output) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
<dd> 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.
<B>This may take some time.</B><P>
<dl>
<dt> <b>Parameters:</b>
<dd> output - The stream to output to. This should probably be a
buffered stream.
<dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
<dd> Will be thrown if a write operation fails.
</dl>
</dl>
</body>
</html>