multipixelpackedsamplemodel.html

来自「API資料大全」· HTML 代码 · 共 858 行 · 第 1/4 页

HTML
858
字号
                      int&nbsp;y,                      int&nbsp;b,                      int&nbsp;s,                      <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A>&nbsp;data)</PRE><DL><DD>Sets a sample in the specified band for the pixel located at  (x,&nbsp;y) in the <code>DataBuffer</code> using an <code>int</code> for input. An <code>ArrayIndexOutOfBoundsException</code> is thrown if the coordinates are not in bounds.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/SampleModel.html#setSample(int, int, int, int, java.awt.image.DataBuffer)">setSample</A></CODE> in class <CODE><A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x,&nbsp;y</CODE> - the coordinates of the specified pixel<DD><CODE>b</CODE> - the band to return, which is assumed to be 0<DD><CODE>s</CODE> - the input sample as an <code>int</code><DD><CODE>data</CODE> - the <code>DataBuffer</code> where image data is stored<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if the coordinates are  not in bounds.</DL></DD></DL><HR><A NAME="getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)"><!-- --></A><H3>getDataElements</H3><PRE>public <A HREF="../../../java/lang/Object.html">Object</A> <B>getDataElements</B>(int&nbsp;x,                              int&nbsp;y,                              <A HREF="../../../java/lang/Object.html">Object</A>&nbsp;obj,                              <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A>&nbsp;data)</PRE><DL><DD>Returns data for a single pixel in a primitive array of type TransferType.  For a <code>MultiPixelPackedSampleModel</code>,  the array has one element, and the type is the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT that can hold a single pixel.  Generally, <code>obj</code> should be passed in as <code>null</code>, so that the  <code>Object</code> is created automatically and is the correct primitive data type. <p> The following code illustrates transferring data for one pixel from <code>DataBuffer</code> <code>db1</code>, whose storage layout is described by <code>MultiPixelPackedSampleModel</code>  <code>mppsm1</code>, to <code>DataBuffer</code> <code>db2</code>, whose storage layout is described by <code>MultiPixelPackedSampleModel</code> <code>mppsm2</code>. The transfer is generally more efficient than using <code>getPixel</code> or <code>setPixel</code>. <pre> 	     MultiPixelPackedSampleModel mppsm1, mppsm2;	     DataBufferInt db1, db2; 	     mppsm2.setDataElements(x, y, mppsm1.getDataElements(x, y, null,                              db1), db2); </pre> Using <code>getDataElements</code> or <code>setDataElements</code>  to transfer between two <code>DataBuffer/SampleModel</code> pairs is legitimate if the <code>SampleModels</code> have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same. <p> If <code>obj</code> is not <code>null</code>, it should be a primitive array of type TransferType.  Otherwise, a  <code>ClassCastException</code> is thrown.  An <code>ArrayIndexOutOfBoundsException</code> is thrown if the coordinates are not in bounds, or if <code>obj</code> is not  <code>null</code> and is not large enough to hold the pixel data.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/SampleModel.html#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)">getDataElements</A></CODE> in class <CODE><A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x,&nbsp;y</CODE> - coordinates of the pixel location.<DD><CODE>obj</CODE> - a primitive array in which to return the pixel data or		<code>null</code>.<DD><CODE>data</CODE> - the <code>DataBuffer</code> containing the image data.<DT><B>Returns:</B><DD>an <code>Object</code> containing data for the specified	pixel.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <code>obj</code> is not a 	primitive array of type TransferType or is not <code>null</code><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if the coordinates are not in bounds, or if <code>obj</code> is not <code>null</code> or  not large enough to hold the pixel data</DL></DD></DL><HR><A NAME="getPixel(int, int, int[], java.awt.image.DataBuffer)"><!-- --></A><H3>getPixel</H3><PRE>public int[] <B>getPixel</B>(int&nbsp;x,                      int&nbsp;y,                      int[]&nbsp;iArray,                      <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A>&nbsp;data)</PRE><DL><DD>Returns the specified single band pixel in the first element of an <code>int</code> array. <code>ArrayIndexOutOfBoundsException</code> is thrown if the coordinates are not in bounds.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/SampleModel.html#getPixel(int, int, int[], java.awt.image.DataBuffer)">getPixel</A></CODE> in class <CODE><A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x,&nbsp;y</CODE> - the coordinates of the pixel location<DD><CODE>iArray</CODE> - the array containing the pixel to be returned or 	<code>null</code><DD><CODE>data</CODE> - the <code>DataBuffer</code> where image data is stored<DT><B>Returns:</B><DD>an array containing the specified pixel.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if the coordinates	are not in bounds</DL></DD></DL><HR><A NAME="setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)"><!-- --></A><H3>setDataElements</H3><PRE>public void <B>setDataElements</B>(int&nbsp;x,                            int&nbsp;y,                            <A HREF="../../../java/lang/Object.html">Object</A>&nbsp;obj,                            <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A>&nbsp;data)</PRE><DL><DD>Sets the data for a single pixel in the specified  <code>DataBuffer</code> from a primitive array of type TransferType.  For a <code>MultiPixelPackedSampleModel</code>, only the first element of the array holds valid data, and the type must be the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT that can hold a single pixel. <p> The following code illustrates transferring data for one pixel from <code>DataBuffer</code> <code>db1</code>, whose storage layout is described by <code>MultiPixelPackedSampleModel</code>  <code>mppsm1</code>, to <code>DataBuffer</code> <code>db2</code>, whose storage layout is described by <code>MultiPixelPackedSampleModel</code> <code>mppsm2</code>. The transfer is generally more efficient than using <code>getPixel</code> or <code>setPixel</code>. <pre> 	     MultiPixelPackedSampleModel mppsm1, mppsm2;	     DataBufferInt db1, db2; 	     mppsm2.setDataElements(x, y, mppsm1.getDataElements(x, y, null,                              db1), db2); </pre> Using <code>getDataElements</code> or <code>setDataElements</code> to transfer between two <code>DataBuffer/SampleModel</code> pairs is legitimate if the <code>SampleModel</code> objects have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same. <p> <code>obj</code> must be a primitive array of type TransferType. Otherwise, a <code>ClassCastException</code> is thrown.  An <code>ArrayIndexOutOfBoundsException</code> is thrown if the coordinates are not in bounds, or if <code>obj</code> is not large enough to hold the pixel data.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/SampleModel.html#setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)">setDataElements</A></CODE> in class <CODE><A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x,&nbsp;y</CODE> - the coordinates of the pixel location<DD><CODE>obj</CODE> - a primitive array containing pixel data<DD><CODE>data</CODE> - the <code>DataBuffer</code> containing the image data</DL></DD></DL><HR><A NAME="setPixel(int, int, int[], java.awt.image.DataBuffer)"><!-- --></A><H3>setPixel</H3><PRE>public void <B>setPixel</B>(int&nbsp;x,                     int&nbsp;y,                     int[]&nbsp;iArray,                     <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A>&nbsp;data)</PRE><DL><DD>Sets a pixel in the <code>DataBuffer</code> using an <code>int</code> array for input. <code>ArrayIndexOutOfBoundsException</code> is thrown if the coordinates are not in bounds.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/SampleModel.html#setPixel(int, int, int[], java.awt.image.DataBuffer)">setPixel</A></CODE> in class <CODE><A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x,&nbsp;y</CODE> - the coordinates of the pixel location<DD><CODE>iArray</CODE> - the input pixel in an <code>int</code> array<DD><CODE>data</CODE> - the <code>DataBuffer</code> containing the image data</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MultiPixelPackedSampleModel.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../java/awt/image/MemoryImageSource.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../java/awt/image/PackedColorModel.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="MultiPixelPackedSampleModel.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_java.awt.image.SampleModel">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation  contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font></BODY></HTML>

⌨️ 快捷键说明

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