01: /*
02: * $RCSfile: TileEncoder.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:57:56 $
10: * $State: Exp $
11: */package javax.media.jai.tilecodec;
12:
13: import java.awt.image.Raster;
14: import java.io.IOException;
15: import java.io.OutputStream;
16:
17: /**
18: * An interface describing objects that transform a <code>Raster</code>
19: * into an <code>OutputStream</code>.
20: *
21: * If the <code>TileCodecDescriptor</code> for this format returns true from
22: * its <code>includesSampleModelInfo()</code> and
23: * <code>includesLocationInfo()</code> methods, then the encoder must encode
24: * this information in the encoded tiles. If these methods return false, then
25: * this information (needed to create a <code>Raster</code> on decoding) must
26: * be provided to the <code>TileDecoder</code> by setting the
27: * <code>SampleModel</code> on the <code>TileCodecParameterList</code> supplied
28: * to the <code>TileDecoder</code> and supplying the tile upper left corner
29: * location to the <code>TileDecoder</code> via the <code>TileDecoder</code>'s
30: * <code>decode(Point location)</code> method. The <code>SampleModel</code>
31: * value set on the <code>TileCodecParameterList</code> for the
32: * <code>TileDecoder</code> should be the same as that of the
33: * <code>Raster</code> to be encoded, in order to get a <code>Raster</code>
34: * on decoding that is equivalent to the one being encoded.
35: *
36: * @see TileCodecDescriptor
37: * @see TileDecoder
38: *
39: * @since JAI 1.1
40: */
41: public interface TileEncoder {
42:
43: /**
44: * Returns the format name of the encoding scheme.
45: */
46: String getFormatName();
47:
48: /**
49: * Returns the current parameters as an instance of the
50: * <code>TileCodecParameterList</code> interface.
51: */
52: TileCodecParameterList getEncodeParameterList();
53:
54: /**
55: * Returns the <code>OutputStream</code> to which the encoded data
56: * will be written.
57: */
58: public OutputStream getOutputStream();
59:
60: /**
61: * Encodes a <code>Raster</code> and writes the output
62: * to the <code>OutputStream</code> associated with this
63: * <code>TileEncoder</code>.
64: *
65: * @param ras the <code>Raster</code> to encode.
66: * @throws IOException if an I/O error occurs while writing to the
67: * OutputStream.
68: * @throws IllegalArgumentException if ras is null.
69: */
70: public void encode(Raster ras) throws IOException;
71: }
|