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