All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.image.GifConverter

java.lang.Object
   |
   +----jclass.image.GifConverter

public class GifConverter
extends Object
implements ImageConsumer
The GifConverter class takes and image and writes it to an OutputStream, in GIF format.


Constructor Index

 o GifConverter(Image, OutputStream)
 o GifConverter(ImageProducer, OutputStream)

Method Index

 o convert()
 o convertSynchronous()
convertSynchronous() finds out which thread is doing the image production then join()s it.
 o getThread()
ImageProducers do their thing in their own thread.
 o imageComplete(int)
The following methods are all ImageConsumer memebers and are how GifConverter gets the image data imageComplete() is called when the ImageProducer has sent all its data to the ImageConsumer, thus this is our cue to start doing the output in GIF format.
 o setColorModel(ColorModel)
 o setDestination(OutputStream)
 o setDimensions(int, int)
 o setHints(int)
 o setPixels(int, int, int, int, ColorModel, byte[], int, int)
There are two flavours of setPixels() - one for 8 bit images, one for 24 bit images.
 o setPixels(int, int, int, int, ColorModel, int[], int, int)
 o setProperties(Hashtable)
The properties are ignored, as they're undocumented anyways.
 o setSource(Image)

Constructors

 o GifConverter
 public GifConverter(ImageProducer ip,
                     OutputStream os)
 o GifConverter
 public GifConverter(Image i,
                     OutputStream os)

Methods

 o setSource
 public void setSource(Image i)
 o setDestination
 public void setDestination(OutputStream os)
 o getThread
 public Thread getThread()
ImageProducers do their thing in their own thread. Which thread is doing the work?

 o convert
 public synchronized void convert() throws IOException
 o convertSynchronous
 public synchronized void convertSynchronous() throws IOException
convertSynchronous() finds out which thread is doing the image production then join()s it.

 o imageComplete
 public void imageComplete(int status)
The following methods are all ImageConsumer memebers and are how GifConverter gets the image data imageComplete() is called when the ImageProducer has sent all its data to the ImageConsumer, thus this is our cue to start doing the output in GIF format.

 o setColorModel
 public void setColorModel(ColorModel model)
 o setDimensions
 public void setDimensions(int width,
                           int height)
 o setHints
 public void setHints(int hints)
 o setPixels
 public void setPixels(int x,
                       int y,
                       int w,
                       int h,
                       ColorModel model,
                       byte pixels[],
                       int off,
                       int scansize)
There are two flavours of setPixels() - one for 8 bit images, one for 24 bit images. In theory you can't really predict which is going to get called and due to sloppy specifications, you really can't predict it in practice either. Therefore, GifConverter is set up to handle data coming in through either version of setPixels().

 o setPixels
 public void setPixels(int x,
                       int y,
                       int w,
                       int h,
                       ColorModel model,
                       int pixels[],
                       int off,
                       int scansize)
 o setProperties
 public void setProperties(Hashtable props)
The properties are ignored, as they're undocumented anyways.


All Packages  Class Hierarchy  This Package  Previous  Next  Index