public abstract class ImageEncoder
extends java.lang.Object
implements java.awt.image.ImageConsumer
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.
GifEncoder
,
PngEncoder
Modifier and Type | Field and Description |
---|---|
protected java.io.OutputStream |
out |
Constructor and Description |
---|
ImageEncoder(java.awt.Image img,
java.io.OutputStream out) |
ImageEncoder(java.awt.image.ImageProducer producer,
java.io.OutputStream out) |
Modifier and Type | Method and Description |
---|---|
void |
encode() |
void |
imageComplete(int status) |
void |
setColorModel(java.awt.image.ColorModel model) |
void |
setDimensions(int width,
int height) |
void |
setHints(int hintflags) |
void |
setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
byte[] pixels,
int off,
int scansize) |
void |
setPixels(int x,
int y,
int w,
int h,
java.awt.image.ColorModel model,
int[] pixels,
int off,
int scansize) |
void |
setProperties(java.util.Hashtable props) |
public ImageEncoder(java.awt.Image img, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public ImageEncoder(java.awt.image.ImageProducer producer, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void encode() throws java.io.IOException
java.io.IOException
public void setDimensions(int width, int height)
setDimensions
in interface java.awt.image.ImageConsumer
public void setProperties(java.util.Hashtable props)
setProperties
in interface java.awt.image.ImageConsumer
public void setColorModel(java.awt.image.ColorModel model)
setColorModel
in interface java.awt.image.ImageConsumer
public void setHints(int hintflags)
setHints
in interface java.awt.image.ImageConsumer
public void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, byte[] pixels, int off, int scansize)
setPixels
in interface java.awt.image.ImageConsumer
public void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, int[] pixels, int off, int scansize)
setPixels
in interface java.awt.image.ImageConsumer
public void imageComplete(int status)
imageComplete
in interface java.awt.image.ImageConsumer