001: /*
002: * $RCSfile: ExpDescriptor.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 java.awt.RenderingHints;
015: import java.awt.image.RenderedImage;
016: import java.awt.image.renderable.RenderableImage;
017: import javax.media.jai.JAI;
018: import javax.media.jai.OperationDescriptorImpl;
019: import javax.media.jai.ParameterBlockJAI;
020: import javax.media.jai.RenderableOp;
021: import javax.media.jai.RenderedOp;
022: import javax.media.jai.registry.RenderableRegistryMode;
023: import javax.media.jai.registry.RenderedRegistryMode;
024:
025: /**
026: * An <code>OperationDescriptor</code> describing the "Exp" operation.
027: *
028: * <p> The "Exp" operation takes the exponential of the pixel values
029: * of an image. The pixel values of the destination image are defined
030: * by the pseudocode:
031: *
032: * <pre>dst[x][y][b] = java.lang.Math.exp(src[x][y][b])</pre>
033: *
034: * <p> For integral image datatypes, the result will be rounded and clamped
035: * as needed.
036: *
037: * <p><table border=1>
038: * <caption>Resource List</caption>
039: * <tr><th>Name</th> <th>Value</th></tr>
040: * <tr><td>GlobalName</td> <td>Exp</td></tr>
041: * <tr><td>LocalName</td> <td>Exp</td></tr>
042: * <tr><td>Vendor</td> <td>com.sun.media.jai</td></tr>
043: * <tr><td>Description</td> <td>Computes the exponential of the pixel values
044: * of an image.</td></tr>
045: * <tr><td>DocURL</td> <td>http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ExpDescriptor.html</td></tr>
046: * <tr><td>Version</td> <td>1.0</td></tr>
047: * </table></p>
048: *
049: * <p> No parameters are needed for the "Exp" operation.
050: *
051: * @see javax.media.jai.OperationDescriptor
052: */
053: public class ExpDescriptor extends OperationDescriptorImpl {
054:
055: /**
056: * The resource strings that provide the general documentation
057: * and specify the parameter list for this operation.
058: */
059: private static final String[][] resources = {
060: { "GlobalName", "Exp" },
061: { "LocalName", "Exp" },
062: { "Vendor", "com.sun.media.jai" },
063: { "Description", JaiI18N.getString("ExpDescriptor0") },
064: {
065: "DocURL",
066: "http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ExpDescriptor.html" },
067: { "Version", JaiI18N.getString("DescriptorVersion") } };
068:
069: /** Constructor. */
070: public ExpDescriptor() {
071: super (resources, 1, null, null, null);
072: }
073:
074: /** Returns <code>true</code> since renderable operation is supported. */
075: public boolean isRenderableSupported() {
076: return true;
077: }
078:
079: /**
080: * Computes the exponential of the pixel values of an image.
081: *
082: * <p>Creates a <code>ParameterBlockJAI</code> from all
083: * supplied arguments except <code>hints</code> and invokes
084: * {@link JAI#create(String,ParameterBlock,RenderingHints)}.
085: *
086: * @see JAI
087: * @see ParameterBlockJAI
088: * @see RenderedOp
089: *
090: * @param source0 <code>RenderedImage</code> source 0.
091: * @param hints The <code>RenderingHints</code> to use.
092: * May be <code>null</code>.
093: * @return The <code>RenderedOp</code> destination.
094: * @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
095: */
096: public static RenderedOp create(RenderedImage source0,
097: RenderingHints hints) {
098: ParameterBlockJAI pb = new ParameterBlockJAI("Exp",
099: RenderedRegistryMode.MODE_NAME);
100:
101: pb.setSource("source0", source0);
102:
103: return JAI.create("Exp", pb, hints);
104: }
105:
106: /**
107: * Computes the exponential of the pixel values of an image.
108: *
109: * <p>Creates a <code>ParameterBlockJAI</code> from all
110: * supplied arguments except <code>hints</code> and invokes
111: * {@link JAI#createRenderable(String,ParameterBlock,RenderingHints)}.
112: *
113: * @see JAI
114: * @see ParameterBlockJAI
115: * @see RenderableOp
116: *
117: * @param source0 <code>RenderableImage</code> source 0.
118: * @param hints The <code>RenderingHints</code> to use.
119: * May be <code>null</code>.
120: * @return The <code>RenderableOp</code> destination.
121: * @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
122: */
123: public static RenderableOp createRenderable(
124: RenderableImage source0, RenderingHints hints) {
125: ParameterBlockJAI pb = new ParameterBlockJAI("Exp",
126: RenderableRegistryMode.MODE_NAME);
127:
128: pb.setSource("source0", source0);
129:
130: return JAI.createRenderable("Exp", pb, hints);
131: }
132: }
|