KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > ext > awt > image > codec > ImageEncoder


1 /*
2
3    Copyright 2001 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.ext.awt.image.codec;
19
20 import java.awt.image.ColorModel JavaDoc;
21 import java.awt.image.Raster JavaDoc;
22 import java.awt.image.RenderedImage JavaDoc;
23 import java.io.IOException JavaDoc;
24 import java.io.OutputStream JavaDoc;
25
26 /**
27  * An interface describing objects that transform a BufferedImage or
28  * Raster into an OutputStream.
29  *
30  * <p><b> This interface is not a committed part of the JAI API. It may
31  * be removed or changed in future releases of JAI.</b>
32  */

33 public interface ImageEncoder {
34
35     /**
36      * Returns the current parameters as an instance of the
37      * ImageEncodeParam interface. Concrete implementations of this
38      * interface will return corresponding concrete implementations of
39      * the ImageEncodeParam interface. For example, a JPEGImageEncoder
40      * will return an instance of JPEGEncodeParam.
41      */

42     public ImageEncodeParam getParam();
43
44     /**
45      * Sets the current parameters to an instance of the
46      * ImageEncodeParam interface. Concrete implementations
47      * of ImageEncoder may throw a RuntimeException if the
48      * params argument is not an instance of the appropriate
49      * subclass or subinterface. For example, a JPEGImageEncoder
50      * will expect param to be an instance of JPEGEncodeParam.
51      */

52     public void setParam(ImageEncodeParam param);
53
54     /** Returns the OutputStream associated with this ImageEncoder. */
55     public OutputStream JavaDoc getOutputStream();
56     
57     /**
58      * Encodes a Raster with a given ColorModel and writes the output
59      * to the OutputStream associated with this ImageEncoder.
60      */

61     public void encode(Raster JavaDoc ras, ColorModel JavaDoc cm) throws IOException JavaDoc;
62
63     /**
64      * Encodes a RenderedImage and writes the output to the
65      * OutputStream associated with this ImageEncoder.
66      */

67     public void encode(RenderedImage JavaDoc im) throws IOException JavaDoc;
68 }
69
Popular Tags