01: /*
02: * $RCSfile: ImageEncoder.java,v $
03: *
04: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Use is subject to license terms.
07: *
08: * $Revision: 1.1 $
09: * $Date: 2005/02/11 04:55:31 $
10: * $State: Exp $
11: */
12: package com.sun.media.jai.codec;
13:
14: import java.awt.image.ColorModel;
15: import java.awt.image.Raster;
16: import java.awt.image.RenderedImage;
17: import java.io.IOException;
18: import java.io.OutputStream;
19:
20: /**
21: * An interface describing objects that transform a BufferedImage or
22: * Raster into an OutputStream.
23: *
24: * <p><b> This interface is not a committed part of the JAI API. It may
25: * be removed or changed in future releases of JAI.</b>
26: */
27: public interface ImageEncoder {
28:
29: /**
30: * Returns the current parameters as an instance of the
31: * ImageEncodeParam interface. Concrete implementations of this
32: * interface will return corresponding concrete implementations of
33: * the ImageEncodeParam interface. For example, a JPEGImageEncoder
34: * will return an instance of JPEGEncodeParam.
35: */
36: public ImageEncodeParam getParam();
37:
38: /**
39: * Sets the current parameters to an instance of the
40: * ImageEncodeParam interface. Concrete implementations
41: * of ImageEncoder may throw a RuntimeException if the
42: * params argument is not an instance of the appropriate
43: * subclass or subinterface. For example, a JPEGImageEncoder
44: * will expect param to be an instance of JPEGEncodeParam.
45: */
46: public void setParam(ImageEncodeParam param);
47:
48: /** Returns the OutputStream associated with this ImageEncoder. */
49: public OutputStream getOutputStream();
50:
51: /**
52: * Encodes a Raster with a given ColorModel and writes the output
53: * to the OutputStream associated with this ImageEncoder.
54: */
55: public void encode(Raster ras, ColorModel cm) throws IOException;
56:
57: /**
58: * Encodes a RenderedImage and writes the output to the
59: * OutputStream associated with this ImageEncoder.
60: */
61: public void encode(RenderedImage im) throws IOException;
62: }
|