| java.lang.Object com.javelin.swinglets.GIFEncoder
GIFEncoder | public class GIFEncoder (Code) | | 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: DWC 0.91 1997-09-28 derived from version 0.90 21 Apr 1996 author: Adam Doppelt author: David W. Croft |
Constructor Summary | |
public | GIFEncoder(Image image) Construct a GIFEncoder. | public | GIFEncoder(byte r, byte g, byte b) Construct a GIFEncoder. | public | GIFEncoder(short width, short height, int[] values) Parameters: values - An array of 24-bit color values. |
Method Summary | |
void | toIndexedColor(byte r, byte g, byte b) | public static void | toRGB(short width, short height, int[] values, byte[][] r, byte[][] g, byte[][] b) Loads the values of three 8-bit arrays (red, green, blue) of
arrays ([ width ] [ height ]) with the masked values from a
24-bit color array of length width * height.
Parameters: values - An array of 24-bit color values. | public synchronized void | write(OutputStream output) Writes the image out to a stream in the GIF file format. |
numColors_ | int numColors_(Code) | | |
pixels_colors_ | byte pixels_colors_(Code) | | |
sd_ | ScreenDescriptor sd_(Code) | | |
width_height_ | short width_height_(Code) | | |
GIFEncoder | public GIFEncoder(Image image) throws AWTException(Code) | | Construct a GIFEncoder. The constructor will convert the image to
an indexed color array. This may take some time.
Parameters: image - The image to encode. The image must becompletely loaded. exception: AWTException - Will be thrown if the pixel grab fails. Thiscan happen if Java runs out of memory. It may also indicate that the imagecontains more than 256 colors. |
GIFEncoder | public GIFEncoder(byte r, byte g, byte b) throws AWTException(Code) | | 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. Parameters: g - An array containing the green intensity values. Parameters: b - An array containing the blue intensity values. exception: AWTException - Will be thrown if the image contains more than256 colors. |
GIFEncoder | public GIFEncoder(short width, short height, int[] values) throws AWTException(Code) | | Parameters: values - An array of 24-bit color values. The length of values[]must be width * height. There must be 256 colors or less. author: David W. Croft |
toRGB | public static void toRGB(short width, short height, int[] values, byte[][] r, byte[][] g, byte[][] b) throws AWTException(Code) | | Loads the values of three 8-bit arrays (red, green, blue) of
arrays ([ width ] [ height ]) with the masked values from a
24-bit color array of length width * height.
Parameters: values - An array of 24-bit color values. The length of values[]must be width * height. There must be 256 colors or less. author: David W. Croft |
write | public synchronized void write(OutputStream output) throws IOException(Code) | | 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.
Parameters: output - The stream to output to. This should probably be abuffered stream. exception: IOException - Will be thrown if a write operation fails. |
|
|