001: /*
002: * $RCSfile: GIFDescriptor.java,v $
003: *
004: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005: *
006: * Use is subject to license terms.
007: *
008: * $Revision: 1.1 $
009: * $Date: 2005/02/11 04:57:36 $
010: * $State: Exp $
011: */
012: package javax.media.jai.operator;
013:
014: import com.sun.media.jai.codec.SeekableStream;
015: import java.awt.RenderingHints;
016: import java.awt.image.RenderedImage;
017: import java.awt.image.renderable.ParameterBlock;
018: import javax.media.jai.JAI;
019: import javax.media.jai.OperationDescriptorImpl;
020: import javax.media.jai.ParameterBlockJAI;
021: import javax.media.jai.RenderedOp;
022: import javax.media.jai.registry.RenderedRegistryMode;
023:
024: /**
025: * An <code>OperationDescriptor</code> describing the "GIF" operation.
026: *
027: * <p> The "GIF" operation reads an image from a GIF stream.
028: *
029: * <p><b> The classes in the <code>com.sun.media.jai.codec</code>
030: * package are not a committed part of the JAI API. Future releases
031: * of JAI will make use of new classes in their place. This
032: * class will change accordingly.</b>
033: *
034: * <p><table border=1>
035: * <caption>Resource List</caption>
036: * <tr><th>Name</th> <th>Value</th></tr>
037: * <tr><td>GlobalName</td> <td>GIF</td></tr>
038: * <tr><td>LocalName</td> <td>GIF</td></tr>
039: * <tr><td>Vendor</td> <td>com.sun.media.jai</td></tr>
040: * <tr><td>Description</td> <td>Reads an image from a GIF stream.</td></tr>
041: * <tr><td>DocURL</td> <td>http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/GIFDescriptor.html</td></tr>
042: * <tr><td>Version</td> <td>1.0</td></tr>
043: * <tr><td>arg0Desc</td> <td>The SeekableStream to read from.</td></tr>
044: * </table></p>
045: *
046: * <p><table border=1>
047: * <caption>Parameter List</caption>
048: * <tr><th>Name</th> <th>Class Type</th>
049: * <th>Default Value</th></tr>
050: * <tr><td>stream</td> <td>com.sun.media.jai.codec.SeekableStream</td>
051: * <td>NO_PARAMETER_DEFAULT</td>
052: * </table></p>
053: *
054: * @see com.sun.media.jai.codec.SeekableStream
055: * @see javax.media.jai.OperationDescriptor
056: */
057: public class GIFDescriptor extends OperationDescriptorImpl {
058:
059: /**
060: * The resource strings that provide the general documentation and
061: * specify the parameter list for the "GIF" operation.
062: */
063: private static final String[][] resources = {
064: { "GlobalName", "GIF" },
065: { "LocalName", "GIF" },
066: { "Vendor", "com.sun.media.jai" },
067: { "Description", JaiI18N.getString("GIFDescriptor0") },
068: {
069: "DocURL",
070: "http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/GIFDescriptor.html" },
071: { "Version", JaiI18N.getString("DescriptorVersion") },
072: { "arg0Desc", JaiI18N.getString("GIFDescriptor1") }, };
073:
074: /** The parameter names for the "GIF" operation. */
075: private static final String[] paramNames = { "stream" };
076:
077: /** The parameter class types for the "GIF" operation. */
078: private static final Class[] paramClasses = { com.sun.media.jai.codec.SeekableStream.class };
079:
080: /** The parameter default values for the "GIF" operation. */
081: private static final Object[] paramDefaults = { NO_PARAMETER_DEFAULT };
082:
083: /** Constructor. */
084: public GIFDescriptor() {
085: super (resources, 0, paramClasses, paramNames, paramDefaults);
086: }
087:
088: /**
089: * Reads an image from a GIF stream.
090: *
091: * <p>Creates a <code>ParameterBlockJAI</code> from all
092: * supplied arguments except <code>hints</code> and invokes
093: * {@link JAI#create(String,ParameterBlock,RenderingHints)}.
094: *
095: * @see JAI
096: * @see ParameterBlockJAI
097: * @see RenderedOp
098: *
099: * @param stream The SeekableStream to read from.
100: * @param hints The <code>RenderingHints</code> to use.
101: * May be <code>null</code>.
102: * @return The <code>RenderedOp</code> destination.
103: * @throws IllegalArgumentException if <code>stream</code> is <code>null</code>.
104: */
105: public static RenderedOp create(SeekableStream stream,
106: RenderingHints hints) {
107: ParameterBlockJAI pb = new ParameterBlockJAI("GIF",
108: RenderedRegistryMode.MODE_NAME);
109:
110: pb.setParameter("stream", stream);
111:
112: return JAI.create("GIF", pb, hints);
113: }
114: }
|