001: /*
002: * $RCSfile: RemoteCRIF.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:52 $
010: * $State: Exp $
011: */package javax.media.jai.remote;
012:
013: import java.awt.geom.Rectangle2D;
014: import java.awt.image.RenderedImage;
015: import java.awt.image.renderable.RenderContext;
016: import java.awt.image.renderable.RenderableImage;
017: import java.awt.image.renderable.ParameterBlock;
018:
019: /**
020: * The <code>RemoteCRIF</code> interface is equivalent to the
021: * <code>ContextualRenderedImageFactory</code> for operations that are
022: * intended to be performed remotely.
023: *
024: * <code>RemoteCRIF</code> provides an interface for the functionality
025: * that may differ between instances of <code>RemoteRenderableOp</code>.
026: * Thus different remote operations on <code>RenderableImages</code> may be
027: * performed by a single class such as <code>RemoteRenderedOp</code> through
028: * the use of multiple instances of <code>RemoteCRIF</code>.
029: *
030: * <p> All remote operations that are to be used in a rendering-independent
031: * chain must provide a factory that implements <code>RemoteCRIF</code>.
032: *
033: * <p> Classes that implement this interface must provide a
034: * constructor with no arguments.
035: *
036: * @since JAI 1.1
037: */
038: public interface RemoteCRIF extends RemoteRIF {
039:
040: /**
041: * Maps the operation's output <code>RenderContext</code> into a
042: * <code>RenderContext</code> for each of the operation's sources.
043: * This is useful for operations that can be expressed in whole or in
044: * part simply as alterations in the <code>RenderContext</code>, such as
045: * an affine mapping, or operations that wish to obtain lower quality
046: * renderings of their sources in order to save processing effort or
047: * transmission bandwith. Some operations, such as blur, can also
048: * use this mechanism to avoid obtaining sources of higher quality
049: * than necessary.
050: *
051: * @param serverName A <code>String</code> specifying the name of the
052: * server to perform the remote operation on.
053: * @param operationName The <code>String</code> specifying the name of the
054: * operation to be performed remotely.
055: * @param i The index of the source image.
056: * @param renderContext The <code>RenderContext</code> being applied to the
057: * operation.
058: * @param paramBlock A <code>ParameterBlock</code> containing the
059: * operation's sources and parameters.
060: * @param image the <code>RenderableImage</code> being rendered.
061: */
062: RenderContext mapRenderContext(String serverName,
063: String operationName, int i, RenderContext renderContext,
064: ParameterBlock paramBlock, RenderableImage image)
065: throws RemoteImagingException;
066:
067: /**
068: * Creates a rendering, given a <code>RenderContext</code> and a
069: * <code>ParameterBlock</code> containing the operation's sources
070: * and parameters. The output is a <code>RemoteRenderedImage</code>
071: * that takes the <code>RenderContext</code> into account to
072: * determine its dimensions and placement on the image plane.
073: * This method houses the "intelligence" that allows a
074: * rendering-independent operation to adapt to a specific
075: * <code>RenderContext</code>.
076: *
077: * @param serverName A <code>String</code> specifying the name of the
078: * server to perform the remote operation on.
079: * @param operationName The <code>String</code> specifying the name of the
080: * operation to be performed remotely.
081: * @param renderContext The <code>RenderContext</code> specifying the
082: * rendering context.
083: * @param paramBlock A <code>ParameterBlock</code> containing the
084: * operation's sources and parameters.
085: */
086: RemoteRenderedImage create(String serverName, String operationName,
087: RenderContext renderContext, ParameterBlock paramBlock)
088: throws RemoteImagingException;
089:
090: /**
091: * Returns the bounding box for the output of the operation,
092: * performed on a given set of sources, in rendering-independent
093: * space. The bounds are returned as a <code>Rectangle2D</code>,
094: * that is, an axis-aligned rectangle with floating-point corner
095: * coordinates.
096: *
097: * @param serverName A <code>String</code> specifying the name of the
098: * server to perform the remote operation on.
099: * @param operationName The <code>String</code> specifying the name of the
100: * operation to be performed remotely.
101: * @param paramBlock A <code>ParameterBlock</code> containing the
102: * operation's sources and parameters.
103: * @return a <code>Rectangle2D</code> specifying the rendering-independent
104: * bounding box of the output.
105: *
106: */
107: Rectangle2D getBounds2D(String serverName, String operationName,
108: ParameterBlock paramBlock) throws RemoteImagingException;
109:
110: /**
111: * Gets the appropriate instance of the property specified by the name
112: * parameter. This method must determine which instance of a property to
113: * return when there are multiple sources that each specify the property.
114: *
115: * @param serverName A <code>String</code> specifying the name of the
116: * server to perform the remote operation on.
117: * @param operationName The <code>String</code> specifying the name of the
118: * operation to be performed remotely.
119: * @param paramBlock A <code>ParameterBlock</code> containing the
120: * operation's sources and parameters.
121: * @param name A <code>String</code> naming the desired property.
122: * @return an object reference to the value of the property requested.
123: */
124: Object getProperty(String serverName, String operationName,
125: ParameterBlock paramBlock, String name)
126: throws RemoteImagingException;
127:
128: /**
129: * Returns a list of names recognized by <code>getProperty</code>.
130: *
131: * @param serverName A <code>String</code> specifying the name of the
132: * server to perform the remote operation on.
133: * @param operationName The <code>String</code> specifying the name of the
134: * operation to be performed remotely.
135: */
136: String[] getPropertyNames(String serverName, String operationName)
137: throws RemoteImagingException;
138:
139: /**
140: * Returns true if successive renderings (that is, calls to
141: * create(<code>RenderContext</code>, <code>ParameterBlock</code>))
142: * with the same arguments may produce different results. This method
143: * may be used to determine whether an existing rendering may be cached
144: * and reused. It is always safe to return true.
145: *
146: * @param serverName A <code>String</code> specifying the name of the
147: * server to perform the remote operation on.
148: * @param operationName The <code>String</code> specifying the name of the
149: * operation to be performed remotely.
150: */
151: boolean isDynamic(String serverName, String operationName)
152: throws RemoteImagingException;
153: }
|