All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class picture.ImageEncoder

java.lang.Object
   |
   +----picture.ImageEncoder

public abstract class ImageEncoder
extends Object
implements ImageConsumer
Abstract class for writing out an image.

A framework for classes that encode and write out an image in a particular file format.

This provides a simplified rendition of the ImageConsumer interface. It always delivers the pixels as ints in the RGBdefault color model. It always provides them in top-down left-right order. If you want more flexibility you can always implement ImageConsumer directly.

Fetch the software.
Fetch the entire Acme package.

See Also:
GifEncoder, PpmEncoder

Variable Index

 o accumulate
 o accumulator
 o encoding
 o height
 o hintflags
 o iox
 o out
 o producer
 o props
 o rgbModel
 o started
 o width

Constructor Index

 o ImageEncoder(Image, OutputStream)
Constructor.
 o ImageEncoder(ImageProducer, OutputStream)
Constructor.

Method Index

 o encode()
Call this after initialization to get things going.
 o encodeDone()
Subclasses implement this to finish an encoding.
 o encodeFinish()
 o encodePixels(int, int, int, int, int[], int, int)
Subclasses implement this to actually write out some bits.
 o encodePixelsWrapper(int, int, int, int, int[], int, int)
 o encodeStart(int, int)
Subclasses implement this to initialize an encoding.
 o imageComplete(int)
 o setColorModel(ColorModel)
 o setDimensions(int, int)
 o setHints(int)
 o setPixels(int, int, int, int, ColorModel, byte[], int, int)
 o setPixels(int, int, int, int, ColorModel, int[], int, int)
 o setProperties(Hashtable)
 o stop()

Variables

 o out
 protected OutputStream out
 o producer
 private ImageProducer producer
 o width
 private int width
 o height
 private int height
 o hintflags
 private int hintflags
 o started
 private boolean started
 o encoding
 private boolean encoding
 o iox
 private IOException iox
 o rgbModel
 private static final ColorModel rgbModel
 o props
 private Hashtable props
 o accumulate
 private boolean accumulate
 o accumulator
 private int accumulator[]

Constructors

 o ImageEncoder
 public ImageEncoder(Image img,
                     OutputStream out) throws IOException
Constructor.

Parameters:
img - The image to encode.
out - The stream to write the bytes to.
 o ImageEncoder
 public ImageEncoder(ImageProducer producer,
                     OutputStream out) throws IOException
Constructor.

Parameters:
producer - The ImageProducer to encode.
out - The stream to write the bytes to.

Methods

 o encodeStart
 abstract void encodeStart(int w,
                           int h) throws IOException
Subclasses implement this to initialize an encoding.

 o encodePixels
 abstract void encodePixels(int x,
                            int y,
                            int w,
                            int h,
                            int rgbPixels[],
                            int off,
                            int scansize) throws IOException
Subclasses implement this to actually write out some bits. They are guaranteed to be delivered in top-down-left-right order. One int per pixel, index is row * scansize + off + col, RGBdefault (AARRGGBB) color model.

 o encodeDone
 abstract void encodeDone() throws IOException
Subclasses implement this to finish an encoding.

 o encode
 public synchronized void encode() throws IOException
Call this after initialization to get things going.

 o encodePixelsWrapper
 private void encodePixelsWrapper(int x,
                                  int y,
                                  int w,
                                  int h,
                                  int rgbPixels[],
                                  int off,
                                  int scansize) throws IOException
 o encodeFinish
 private void encodeFinish() throws IOException
 o stop
 private synchronized void stop()
 o setDimensions
 public void setDimensions(int width,
                           int height)
 o setProperties
 public void setProperties(Hashtable props)
 o setColorModel
 public void setColorModel(ColorModel model)
 o setHints
 public void setHints(int hintflags)
 o setPixels
 public void setPixels(int x,
                       int y,
                       int w,
                       int h,
                       ColorModel model,
                       byte pixels[],
                       int off,
                       int scansize)
 o setPixels
 public void setPixels(int x,
                       int y,
                       int w,
                       int h,
                       ColorModel model,
                       int pixels[],
                       int off,
                       int scansize)
 o imageComplete
 public void imageComplete(int status)

All Packages  Class Hierarchy  This Package  Previous  Next  Index