001: /*
002: * $RCSfile: FPXDescriptor.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:35 $
010: * $State: Exp $
011: */
012: package javax.media.jai.operator;
013:
014: import com.sun.media.jai.codec.FPXDecodeParam;
015: import com.sun.media.jai.codec.SeekableStream;
016: import java.awt.RenderingHints;
017: import java.awt.image.RenderedImage;
018: import java.awt.image.renderable.ParameterBlock;
019: import javax.media.jai.JAI;
020: import javax.media.jai.OperationDescriptorImpl;
021: import javax.media.jai.ParameterBlockJAI;
022: import javax.media.jai.RenderedOp;
023: import javax.media.jai.registry.RenderedRegistryMode;
024:
025: /**
026: * An <code>OperationDescriptor</code> describing the "FPX" operation.
027: *
028: * The "FPX" operation reads an image from a FlashPix stream.
029: *
030: * <p> The second parameter contains an instance of
031: * <code>FPXDecodeParam</code> to be used during the decoding.
032: * It may be set to <code>null</code> in order to perform default
033: * decoding, or equivalently may be omitted.
034: *
035: * <p><b> The classes in the <code>com.sun.media.jai.codec</code>
036: * package are not a committed part of the JAI API. Future releases
037: * of JAI will make use of new classes in their place. This
038: * class will change accordingly.</b>
039: *
040: * <p><table border=1>
041: * <caption>Resource List</caption>
042: * <tr><th>Name</th> <th>Value</th></tr>
043: * <tr><td>GlobalName</td> <td>FPX</td></tr>
044: * <tr><td>LocalName</td> <td>FPX</td></tr>
045: * <tr><td>Vendor</td> <td>com.sun.media.jai</td></tr>
046: * <tr><td>Description</td> <td>Reads an image from a FlashPix stream.</td></tr>
047: * <tr><td>DocURL</td> <td>http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/FPXDescriptor.html</td></tr>
048: * <tr><td>Version</td> <td>1.0</td></tr>
049: * <tr><td>arg0Desc</td> <td>The SeekableStream to read from.</td></tr>
050: * <tr><td>arg1Desc</td> <td>The FPXDecodeParam to use.</td></tr>
051: * </table></p>
052: *
053: * <p><table border=1>
054: * <caption>Parameter List</caption>
055: * <tr><th>Name</th> <th>Class Type</th>
056: * <th>Default Value</th></tr>
057: * <tr><td>stream</td> <td>com.sun.media.jai.codec.SeekableStream</td>
058: * <td>NO_PARAMETER_DEFAULT</td>
059: * <tr><td>param</td> <td>com.sun.media.jai.codec.FPXDecodeParam</td>
060: * <td>null</td>
061: * </table></p>
062: *
063: * @see com.sun.media.jai.codec.SeekableStream
064: * @see javax.media.jai.OperationDescriptor
065: */
066: public class FPXDescriptor extends OperationDescriptorImpl {
067:
068: /** Convenience name for the Max Resolution of an FPX image */
069: public static final Integer MAX_RESOLUTION = new Integer(-1);
070:
071: /**
072: * The resource strings that provide the general documentation and
073: * specify the parameter list for the "FPX" operation.
074: */
075: private static final String[][] resources = {
076: { "GlobalName", "FPX" },
077: { "LocalName", "FPX" },
078: { "Vendor", "com.sun.media.jai" },
079: { "Description", JaiI18N.getString("FPXDescriptor0") },
080: {
081: "DocURL",
082: "http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/FPXDescriptor.html" },
083: { "Version", JaiI18N.getString("DescriptorVersion") },
084: { "arg0Desc", JaiI18N.getString("FPXDescriptor1") },
085: { "arg1Desc", JaiI18N.getString("FPXDescriptor2") } };
086:
087: /** The parameter names for the "FPX" operation. */
088: private static final String[] paramNames = { "stream", "param" };
089:
090: /** The parameter class types for the "FPX" operation. */
091: private static final Class[] paramClasses = {
092: com.sun.media.jai.codec.SeekableStream.class,
093: com.sun.media.jai.codec.FPXDecodeParam.class };
094:
095: /** The parameter default values for the "FPX" operation. */
096: private static final Object[] paramDefaults = {
097: NO_PARAMETER_DEFAULT, null };
098:
099: /** Constructor. */
100: public FPXDescriptor() {
101: super (resources, 0, paramClasses, paramNames, paramDefaults);
102: }
103:
104: /**
105: * Reads an image from a FlashPix stream.
106: *
107: * <p>Creates a <code>ParameterBlockJAI</code> from all
108: * supplied arguments except <code>hints</code> and invokes
109: * {@link JAI#create(String,ParameterBlock,RenderingHints)}.
110: *
111: * @see JAI
112: * @see ParameterBlockJAI
113: * @see RenderedOp
114: *
115: * @param stream The SeekableStream to read from.
116: * @param param The FPXDecodeParam to use.
117: * May be <code>null</code>.
118: * @param hints The <code>RenderingHints</code> to use.
119: * May be <code>null</code>.
120: * @return The <code>RenderedOp</code> destination.
121: * @throws IllegalArgumentException if <code>stream</code> is <code>null</code>.
122: */
123: public static RenderedOp create(SeekableStream stream,
124: FPXDecodeParam param, RenderingHints hints) {
125: ParameterBlockJAI pb = new ParameterBlockJAI("FPX",
126: RenderedRegistryMode.MODE_NAME);
127:
128: pb.setParameter("stream", stream);
129: pb.setParameter("param", param);
130:
131: return JAI.create("FPX", pb, hints);
132: }
133: }
|