📄 extending the api.htm
字号:
operation's property management.
<P>Each family of the image operation in JAI must have a descriptor that
implements this interface. The following basic resource data must be provided:
<P>
<UL>
<LI>GlobalName - a global operation name that is visible to all and is the
same in all <CODE>Locale</CODE>s
<P></P></LI></UL>
<UL>
<LI>LocalName - a localized operation name that may be used as a synonym for
the global operation name
<P></P></LI></UL>
<UL>
<LI>Vendor - the name of the vendor (company name) defining this operation
<P></P></LI></UL>
<UL>
<LI>Description - a brief description of this operation
<P></P></LI></UL>
<UL>
<LI>DocURL - a URL where additional documentation on this operation may be
found (the javadoc for the operation)
<P></P></LI></UL>
<UL>
<LI>Version - the version of the operation
<P></P></LI></UL>
<UL>
<LI>arg0Desc, arg1Desc, etc. - descriptions of the arguments. There must be
a property for each argument.
<P></P></LI></UL>
<UL>
<LI>hint0Desc, hint1Desc, etc. - descriptions of the rendering hints. There
must be a property for each hint.
<P></P></LI></UL>Additional information about the operation must be provided
when appropriate. It is also good idea to provide a detailed description of
the operation's functionality in the class comment. When all of the above data
is provided, the operation can be added to an <CODE>OperationRegistry</CODE>.
<P><A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Extension.doc.html#58545">Listing
14-2</A> shows an example of an operation descriptor for the Clamp operation.
Note that the descriptor also contains descriptions of the two required
operation parameters, but no hints as these aren't required for the operation.
<P><CAPTION><FONT size=-1><B><A name=58545>
<CENTER><FONT size=-1><B><I>Listing 14-2 </I><IMG
src="Extending the API.files/sm-blank.gif" border=0> Operation Descriptor for
Clamp Operation</B></FONT></CENTER></A>
<P></B></FONT></CAPTION>
<HR>
<TR valign="top"><TD rowspan="16" colspan="1"><PRE> public class ClampDescriptor extends OperationDescriptorImpl {
/**
* The resource strings that provide the general documentation
* and specify the parameter list for this operation.
*/
private static final String[][] resources = {
{"GlobalName", "Clamp"},
{"LocalName", "Clamp"},
{"Vendor", "com.sun.javax.media.jai"},
{"Description", "Clamps the pixel values of a rendered image"},
{"DocURL", "http://java.sun.com/products/java-media/jai/
forDevelopers/jaiapi/
javax.media.jai.operator.ClampDescriptor.html"},
{"Version", "Beta")},
{"arg0Desc", "The lower boundary for each band."},
{"arg1Desc", "The upper boundary for each band."}
};
</PRE><TR valign="top"><TR valign="top"><TR valign="top"><TR valign="top"><TR
valign="top"><TR valign="top"><TR valign="top"><TR valign="top"><TR
valign="top"><TR valign="top"><TR valign="top"><TR valign="top"><TR
valign="top"><TR valign="top"><TR valign="top">
<HR>
<P>As described in <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Programming-environ.doc.html#55910">Section
3.3, "Processing Graphs</A>," JAI has two image modes: Rendered and
Renderable. An operation supporting the Rendered mode takes
<CODE>RenderedImages</CODE> as its sources, can only be used in a Rendered op
chain, and produces a <CODE>RenderedImage</CODE>. An operation supporting the
Renderable mode takes <CODE>RenderableImage</CODE>s as its sources, can only
be used in a Renderable op chain, and produces a <CODE>RenderableImage</CODE>.
Therefore, the class types of the sources and the destination of an operation
are different between the two modes, but the parameters must be the same for
both modes.
<P>All operations must support the rendered mode and implement those methods
that supply the information for this mode. Those operations that support the
renderable mode must specify this feature using the
<CODE>isRenderableSupported</CODE> method and implement those methods that
supply the additional information for the Renderable mode.
<P><A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Extension.doc.html#58685">Table
14-2</A> lists the Rendered mode methods. <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Extension.doc.html#58718">Table
14-3</A> lists the Renderable mode methods. <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Extension.doc.html#58876">Table
14-4</A> lists the methods relative to operation parameters.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B><A name=58685><I>Table 14-2 </I><IMG
src="Extending the API.files/sm-blank.gif" border=0> Rendered Mode Methods
</A></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TH><A name=58689>Method </A>
<TH><A name=58691>Description </A>
<TR vAlign=top>
<TD><A name=58693>isRenderedSupported</A><BR>
<TD><A name=58695>Returns true if the operation supports the Rendered
image mode. This must be true for all operations.</A><BR>
<TR vAlign=top>
<TD><A name=58697>isImmediate</A><BR>
<TD><A name=58749>Returns true if the operation should be rendered
immediately during the call to JAI.create; that is, the operation is
placed in immediate mode.</A><BR>
<TR vAlign=top>
<TD><A name=58701>getSourceClasses</A><BR>
<TD><A name=58760>Returns an array of Classes that describe the types of
sources required by this operation in the Rendered image mode.</A><BR>
<TR vAlign=top>
<TD><A name=58705>getDestClass</A><BR>
<TD><A name=58771>Returns a Class that describes the type of destination
this operation produces in the Rendered image mode.</A><BR>
<TR vAlign=top>
<TD><A name=58709>validateArguments</A><BR>
<TD><A name=58785>Returns true if this operation is capable of handling
the input rendered source(s) and/or parameter(s) specified in the
ParameterBlock.</A><BR></TR></TBODY></TABLE>
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B><A name=58718><I>Table 14-3 </I><IMG
src="Extending the API.files/sm-blank.gif" border=0> Renderable Mode Methods
</A></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TH><A name=58722>Method </A>
<TH><A name=58724>Description </A>
<TR vAlign=top>
<TD><A name=58726>isRenderableSupported</A><BR>
<TD><A name=58811>Returns true if the operation supports the Renderable
image mode.</A><BR>
<TR vAlign=top>
<TD><A name=58801>getRenderableSourceClasses</A><BR>
<TD><A name=58836>Returns an array of Classes that describe the types of
sources required by this operation in the Renderable image mode.</A><BR>
<TR vAlign=top>
<TD><A name=58803>getRenderableDestClass</A><BR>
<TD><A name=58847>Returns a Class that describes the type of destination
this operation produces in the Renderable image mode.</A><BR>
<TR vAlign=top>
<TD><A name=58738>validateRenderableArguments</A><BR>
<TD><A name=58861>Returns true if this operation is capable of handling
the input Renderable source(s) and/or parameter(s) specified in the
ParameterBlock.</A><BR></TR></TBODY></TABLE>
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B><A name=58876><I>Table 14-4 </I><IMG
src="Extending the API.files/sm-blank.gif" border=0> Parameter Methods
</A></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TH><A name=58880>Method </A>
<TH><A name=58882>Description </A>
<TR vAlign=top>
<TD><A name=58884>getNumParameters</A><BR>
<TD><A name=58924>Returns the number of parameters (not including the
sources) required by this operation.</A><BR>
<TR vAlign=top>
<TD><A name=58888>getParamClasses</A><BR>
<TD><A name=58935>Returns an array of Classes that describe the types of
parameters required by this operation.</A><BR>
<TR vAlign=top>
<TD><A name=58892>getParamNames</A><BR>
<TD><A name=58946>Returns an array of Strings that are the localized
parameter names of this operation.</A><BR>
<TR vAlign=top>
<TD><A name=58896>getParamDefaults</A><BR>
<TD><A name=58957>Returns an array of Objects that define the default
values of the parameters for this operation.</A><BR>
<TR vAlign=top>
<TD><A name=58900>getParamDefaultValue</A><BR>
<TD><A name=58902>Returns the default value of a specified
parameter.</A><BR>
<TR vAlign=top>
<TD><A name=58904>getParamMinValue</A><BR>
<TD><A name=58972>Returns the minimum legal value of a specified numeric
parameter for this operation.</A><BR>
<TR vAlign=top>
<TD><A name=58908>getParamMaxValue</A><BR>
<TD><A name=58979>Returns the maximum legal value of a specified numeric
parameter for this operation.</A><BR></TR></TBODY></TABLE>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Extending the API.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.OperationRegistry </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>void registerOperationDescriptor(OperationDescriptor odesc,
String operationName)
<P></P></LI></UL></PRE>
<DL><A name=54658>
<DT>
<DD>registers an <CODE>OperationDescriptor</CODE> with the registry. Each
operation must have an <CODE>OperationDescriptor</CODE> before
<CODE>registerRIF()</CODE> may be called to add RIFs to the operation.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameter</EM>:
<P></P>
<TD><CODE>odesc</CODE>
<P></P>
<TD>An <CODE>OperationDescriptor</CODE> containing information about
the operation.
<P></P>
<TR vAlign=top>
<TD><CODE>operationName</CODE>
<P></P>
<TD>The operation name as a <CODE>String</CODE>.
<P></P></TR></TBODY></TABLE></A>
<P><A name=54665></P>
<DT>
<DD>A <CODE>OperationDescriptor</CODE> cannot be registered under an
operation name under which another <CODE>OperationDescriptor</CODE> was
registered previously. If such an attempt is made, an Error will be thrown.
</A>
<P></P></DD></DL><PRE><UL>
<LI>void registerOperationByName(String odescClassName,
String operationName)
<P></P></LI></UL></PRE>
<DL><A name=54612>
<DT>
<DD>registers an <CODE>OperationDescriptor</CODE> by its class name.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameter</EM>:<EM></EM>
<P></P>
<TD><CODE>odescClassName</CODE>
<P></P>
<TD>The fully-qualified class name of the
<CODE>OperationDescriptor</CODE>.
<P></P>
<TR vAlign=top>
<TD><CODE>operationName</CODE>
<P></P>
<TD>The operation name as a <CODE>String</CODE>.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>void unregisterOperationDescriptor(String operationName)
<P></P></LI></UL></PRE>
<DL><A name=54714>
<DT>
<DD>unregisters an <CODE>OperationDescriptor</CODE> from the registry. </A>
<P></P></DD></DL><PRE><UL>
<LI>void registerRIF(String operationName, String productName,
RenderedImageFactory RIF)
<P></P></LI></UL></PRE>
<DL><A name=54736>
<DT>
<DD>registers a <CODE>RIF</CODE> with a particular product and operation.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=3><EM>Parameter</EM>:<EM></EM>
<P></P>
<TD><CODE>operationName</CODE>
<P></P>
<TD>The operation name as a <CODE>String</CODE>.
<P></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -