⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extending the api.htm

📁 是一部关于java高级图像处理的的一本入门书
💻 HTM
📖 第 1 页 / 共 5 页
字号:
      <TR vAlign=top>
        <TD><CODE>productName</CODE> 
          <P></P>
        <TD>The product name, as a <CODE>String</CODE>. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>RIF</CODE> 
          <P></P>
        <TD>The <CODE>RenderedImageFactory</CODE> to be registered. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>void registerRIFByClassName(String operationName, 
       String  productName, String RIFClassName)
<P></P></LI></UL></PRE>
  <DL><A name=54801>
    <DT>
    <DD>registers a <CODE>RIF</CODE> with a particular product and operation, 
    constructing an instance using its class name.
    <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>
      <TR vAlign=top>
        <TD><CODE>productName</CODE> 
          <P></P>
        <TD>The product name, as a <CODE>String</CODE>. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>RIFClassName</CODE> 
          <P></P>
        <TD>The fully-qualified class name of a 
          <CODE>RenderedImageFactory</CODE>. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><A name=51261>
  <H2>14.4 <IMG 
  src="Extending the API.files/space.gif">Iterators</H2></A>Iterators are 
  provided to help the programmer who writes extensions to the JAI API and does 
  not want to use any of the existing API methods for traversing pixels. 
  Iterators define the manner in which the source image pixels are traversed for 
  processing. Iterators may be used both in the implementation of 
  <CODE>computeRect</CODE> methods or <CODE>getTile</CODE> methods of OpImage 
  subclasses, and for ad-hoc pixel-by-pixel image manipulation. 
  <P>Iterators provide a mechanism for avoiding the need to cobble sources, as 
  well as to abstract away the details of source pixel formatting. An iterator 
  is instantiated to iterate over a specified rectangular area of a source 
  <CODE>RenderedImage</CODE> or <CODE>Raster</CODE>. The iterator returns pixel 
  values in <CODE>int</CODE>, <CODE>float</CODE>, or <CODE>double</CODE> format, 
  automatically promoting integral values smaller than 32 bits to 
  <CODE>int</CODE> when reading, and performing the corresponding packing when 
  writing. 
  <P>JAI offers three different types of iterator, which should cover nearly all 
  of a programmer's needs. However, extenders may wish to build others for more 
  specialized needs. 
  <P>The most basic iterator is <CODE>RectIter</CODE>, which provides the 
  ability to move one line or pixel at a time to the right or downwards, and to 
  step forward in the list of bands. <CODE>RookIter</CODE> offers slightly more 
  functionality than <CODE>RectIter</CODE>, allowing leftward and upward 
  movement and backwards motion through the set of bands. Both 
  <CODE>RectIter</CODE> and <CODE>RookIter</CODE> allow jumping to an arbitrary 
  line or pixel, and reading and writing of a random band of the current pixel. 
  The <CODE>RookIter</CODE> also allows jumping back to the first line or pixel, 
  and to the last line or pixel. 
  <P><CODE>RandomIter</CODE> allows an unrelated set of samples to be read by 
  specifying their <EM>x</EM> and <EM>y</EM> coordinates and band offset. The 
  <CODE>RandomIter</CODE> will generally be slower than either the 
  <CODE>RectIter</CODE> or <CODE>RookIter</CODE>, but remains useful for its 
  ability to hide pixel formats and tile boundaries. 
  <P><A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Extension.doc.html#57709">Figure 
  14-1</A> shows the Iterator package hierarchy. The classes are described in 
  the following paragraphs. 
  <P><A name=51439>
  <H3>14.4.1 <IMG src="Extending the API.files/space.gif">RectIter</H3></A>The 
  <CODE>RectIter</CODE> interface represents an iterator for traversing a 
  read-only image in top-to-bottom, left-to-right order (<A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Extension.doc.html#52169">Figure 
  14-2</A>). The RectIter traversal will generally be the fastest style of 
  iterator, since it does not need to perform bounds checks against the top or 
  left edges of tiles. The <CODE>WritableRectIter</CODE> interface traverses a 
  read/write image in the same manner as the RectIter. 
  <P>The iterator is initialized with a particular rectangle as its bounds. The 
  initialization takes place in a factory method (the 
  <CODE>RectIterFactory</CODE> class) and is not a part of the iterator 
  interface itself. Once initialized, the iterator may be reset to its initial 
  state by means of the <CODE>startLines()</CODE>, <CODE>startPixels()</CODE>, 
  and <CODE>startBands()</CODE> methods. Its position may be advanced using the 
  <CODE>nextLine()</CODE>, <CODE>jumpLines()</CODE>, <CODE>nextPixel()</CODE>, 
  <CODE>jumpPixels()</CODE>, and <CODE>nextBand()</CODE> methods. 
  <P><A name=57707>
  <HR>

  <CENTER><IMG src="Extending the API.files/Extension.doc.ancA.gif"></CENTER>
  <HR>
  </A><A name=57709>
  <CENTER><FONT size=-1><B><I>Figure 14-1 </I><IMG 
  src="Extending the API.files/sm-blank.gif" border=0> Iterator 
  Hierarchy</B></FONT></CENTER></A>
  <P><A name=52168>
  <HR>

  <CENTER><IMG src="Extending the API.files/Extension.doc.anc.gif"></CENTER>
  <HR>
  </A><A name=52169>
  <CENTER><FONT size=-1><B><I>Figure 14-2 </I><IMG 
  src="Extending the API.files/sm-blank.gif" border=0> RectIter Traversal 
  Pattern</B></FONT></CENTER></A>
  <P>The <CODE>WritableRookIter</CODE> interface adds the ability to alter the 
  source pixel values using the various <CODE>setSample()</CODE> and 
  <CODE>setPixel()</CODE> methods. 
  <P>An instance of <CODE>RectIter</CODE> may be obtained by means of the 
  <CODE>RectIterFactory.create()</CODE> method, which returns an opaque object 
  implementing this interface. 
  <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.iterator.RectIterFactory </CODE>
        <HR>
      </TD></TR></TBODY></TABLE><PRE><UL>
<LI>static RectIter create(RenderedImage im, Rectangle bounds)
<P></P></LI></UL></PRE>
  <DL><A name=52667>
    <DT>
    <DD>constructs and returns an instance of <CODE>RectIter</CODE> suitable for 
    iterating over the given bounding rectangle within the given 
    <CODE>RenderedImage</CODE> source. If the <CODE>bounds</CODE> parameter is 
    null, the entire image will be used.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=2><EM>Parameters</EM>:<EM></EM> 
          <P></P>
        <TD><CODE>im</CODE> 
          <P></P>
        <TD>A read-only <CODE>RenderedImage</CODE> source. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>bounds</CODE> 
          <P></P>
        <TD>The bounding <CODE>Rectangle</CODE> for the iterator, or null. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>static RectIter create(Raster ras, Rectangle bounds)
<P></P></LI></UL></PRE>
  <DL><A name=52735>
    <DT>
    <DD>constructs and returns an instance of <CODE>RectIter</CODE> suitable for 
    iterating over the given bounding rectangle within the given 
    <CODE>Raster</CODE> source. If the <CODE>bounds</CODE> parameter is null, 
    the entire Raster will be used.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=2><EM>Parameters</EM>:<EM></EM> 
          <P></P>
        <TD><CODE>ras</CODE> 
          <P></P>
        <TD>A read-only <CODE>Raster</CODE> source. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>bounds</CODE> 
          <P></P>
        <TD>The bounding <CODE>Rectangle</CODE> for the iterator, or null. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>static WritableRectIter createWritable(WritableRenderedImage 
       im, Rectangle bounds)
<P></P></LI></UL></PRE>
  <DL><A name=52793>
    <DT>
    <DD>constructs and returns an instance of <CODE>WritableRectIter</CODE> 
    suitable for iterating over the given bounding rectangle within the given 
    <CODE>WritableRenderedImage</CODE> source. If the <CODE>bounds</CODE> 
    parameter is null, the entire image will be used.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=2><EM>Parameters</EM>:<EM></EM> 
          <P></P>
        <TD><CODE>im</CODE> 
          <P></P>
        <TD>A <CODE>WritableRenderedImage</CODE> source. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>bounds</CODE> 
          <P></P>
        <TD>The bounding <CODE>Rectangle</CODE> for the iterator, or null. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>static WritableRectIter createWritable(WritableRaster ras, 
       Rectangle bounds)
<P></P></LI></UL></PRE>
  <DL><A name=52845>
    <DT>
    <DD>constructs and returns an instance of <CODE>WritableRectIter</CODE> 
    suitable for iterating over the given bounding rectangle within the given 
    <CODE>WritableRaster</CODE> source. If the <CODE>bounds</CODE> parameter is 
    null, the entire <CODE>Raster</CODE> will be used.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=2><EM>Parameters</EM>:<EM></EM> 
          <P></P>
        <TD><CODE>ras</CODE> 
          <P></P>
        <TD>A <CODE>WritableRaster</CODE> source. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>bounds</CODE> 
          <P></P>
        <TD>The bounding <CODE>Rectangle</CODE> for the iterator, or null. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL>
  <TABLE border=0>
    <TBODY>
    <TR>
      <TD><IMG src="Extending the API.files/cistine.gif"></TD>
      <TD>
        <HR>
        <B>API:</B> <CODE>javax.media.jai.iterator.RectIter </CODE>
        <HR>
      </TD></TR></TBODY></TABLE><PRE><UL>
<LI>void startLines()
<P></P></LI></UL></PRE>
  <DL><A name=52911>
    <DT>
    <DD>sets the iterator to the first line of its bounding rectangle. The pixel 
    and band offsets are unchanged. </A>
    <P></P></DD></DL><PRE><UL>
<LI>void startPixels()
<P></P></LI></UL></PRE>
  <DL><A name=52936>
    <DT>
    <DD>sets the iterator to the leftmost pixel of its bounding rectangle. The 
    line and band offsets are unchanged. </A>
    <P></P></DD></DL><PRE><UL>
<LI>void startBands()
<P></P></LI></UL></PRE>
  <DL><A name=52951>
    <DT>
    <DD>sets the iterator to the first band of the image. The pixel column and 
    line are unchanged. </A>
    <P></P></DD></DL><PRE><UL>
<LI>void nextLine()
<P></P></LI></UL></PRE>
  <DL><A name=52967>
    <DT>
    <DD>sets the iterator to the next line of the image. The pixel and band 
    offsets are unchanged. If the iterator passes the bottom line of the 
    rectangles, calls to <CODE>get()</CODE> methods are not valid. </A>
    <P></P></DD></DL><PRE><UL>
<LI>void jumpLines(int num)
<P></P></LI></UL></PRE>
  <DL><A name=52984>
    <DT>
    <DD>jumps downward <CODE>num</CODE> lines from the current position. The 
    <CODE>num</CODE> parameter may be negative. The pixel and band offsets are 
    unchanged. </A>
    <P></P></DD></DL><PRE><UL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -