📄 pixelgrabber.html
字号:
<BR> The setHints method is part of the ImageConsumer API which this class must implement to retrieve the pixels.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int)">setPixels</A></B>(int srcX, int srcY, int srcW, int srcH, <A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A> model, byte[] pixels, int srcOff, int srcScan)</CODE><BR> The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int)">setPixels</A></B>(int srcX, int srcY, int srcW, int srcH, <A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A> model, int[] pixels, int srcOff, int srcScan)</CODE><BR> The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#setProperties(java.util.Hashtable)">setProperties</A></B>(<A HREF="../../../java/util/Hashtable.html">Hashtable</A> props)</CODE><BR> The setProperties method is part of the ImageConsumer API which this class must implement to retrieve the pixels.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#startGrabbing()">startGrabbing</A></B>()</CODE><BR> Request the PixelGrabber to start fetching the pixels.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#status()">status</A></B>()</CODE><BR> Returns the status of the pixels.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="PixelGrabber(java.awt.Image, int, int, int, int, int[], int, int)"><!-- --></A><H3>PixelGrabber</H3><PRE>public <B>PixelGrabber</B>(<A HREF="../../../java/awt/Image.html">Image</A> img, int x, int y, int w, int h, int[] pix, int off, int scansize)</PRE><DL><DD>Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image into the given array. The pixels are stored into the array in the default RGB ColorModel. The RGB data for pixel (i, j) where (i, j) is inside the rectangle (x, y, w, h) is stored in the array at <tt>pix[(j - y) * scansize + (i - x) + off]</tt>.<DD><DL><DT><B>Parameters:</B><DD><CODE>img</CODE> - the image to retrieve pixels from<DD><CODE>x</CODE> - the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image<DD><CODE>y</CODE> - the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image<DD><CODE>w</CODE> - the width of the rectangle of pixels to retrieve<DD><CODE>h</CODE> - the height of the rectangle of pixels to retrieve<DD><CODE>pix</CODE> - the array of integers which are to be used to hold the RGB pixels retrieved from the image<DD><CODE>off</CODE> - the offset into the array of where to store the first pixel<DD><CODE>scansize</CODE> - the distance from one row of pixels to the next in the array<DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ColorModel.html#getRGBdefault()"><CODE>ColorModel.getRGBdefault()</CODE></A></DL></DD></DL><HR><A NAME="PixelGrabber(java.awt.image.ImageProducer, int, int, int, int, int[], int, int)"><!-- --></A><H3>PixelGrabber</H3><PRE>public <B>PixelGrabber</B>(<A HREF="../../../java/awt/image/ImageProducer.html">ImageProducer</A> ip, int x, int y, int w, int h, int[] pix, int off, int scansize)</PRE><DL><DD>Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the image produced by the specified ImageProducer into the given array. The pixels are stored into the array in the default RGB ColorModel. The RGB data for pixel (i, j) where (i, j) is inside the rectangle (x, y, w, h) is stored in the array at <tt>pix[(j - y) * scansize + (i - x) + off]</tt>.<DD><DL><DT><B>Parameters:</B><DD><CODE>img</CODE> - the image to retrieve pixels from<DD><CODE>x</CODE> - the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image<DD><CODE>y</CODE> - the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image<DD><CODE>w</CODE> - the width of the rectangle of pixels to retrieve<DD><CODE>h</CODE> - the height of the rectangle of pixels to retrieve<DD><CODE>pix</CODE> - the array of integers which are to be used to hold the RGB pixels retrieved from the image<DD><CODE>off</CODE> - the offset into the array of where to store the first pixel<DD><CODE>scansize</CODE> - the distance from one row of pixels to the next in the array<DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ColorModel.html#getRGBdefault()"><CODE>ColorModel.getRGBdefault()</CODE></A></DL></DD></DL><HR><A NAME="PixelGrabber(java.awt.Image, int, int, int, int, boolean)"><!-- --></A><H3>PixelGrabber</H3><PRE>public <B>PixelGrabber</B>(<A HREF="../../../java/awt/Image.html">Image</A> img, int x, int y, int w, int h, boolean forceRGB)</PRE><DL><DD>Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image. The pixels are accumulated in the original ColorModel if the same ColorModel is used for every call to setPixels, otherwise the pixels are accumulated in the default RGB ColorModel. If the forceRGB parameter is true, then the pixels will be accumulated in the default RGB ColorModel anyway. A buffer is allocated by the PixelGrabber to hold the pixels in either case. If (w < 0) or (h < 0), then they will default to the remaining width and height of the source data when that information is delivered.<DD><DL><DT><B>Parameters:</B><DD><CODE>img</CODE> - the image to retrieve the image data from<DD><CODE>x</CODE> - the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image<DD><CODE>y</CODE> - the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image<DD><CODE>w</CODE> - the width of the rectangle of pixels to retrieve<DD><CODE>h</CODE> - the height of the rectangle of pixels to retrieve<DD><CODE>forceRGB</CODE> - true if the pixels should always be converted to the default RGB ColorModel</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="startGrabbing()"><!-- --></A><H3>startGrabbing</H3><PRE>public void <B>startGrabbing</B>()</PRE><DL><DD>Request the PixelGrabber to start fetching the pixels.<DD><DL></DL></DD></DL><HR><A NAME="abortGrabbing()"><!-- --></A><H3>abortGrabbing</H3><PRE>public void <B>abortGrabbing</B>()</PRE><DL><DD>Request the PixelGrabber to abort the image fetch.<DD><DL></DL></DD></DL><HR><A NAME="grabPixels()"><!-- --></A><H3>grabPixels</H3><PRE>public boolean <B>grabPixels</B>() throws <A HREF="../../../java/lang/InterruptedException.html">InterruptedException</A></PRE><DL><DD>Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>true if the pixels were successfully grabbed, false on abort, error or timeout<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/InterruptedException.html">InterruptedException</A></CODE> - Another thread has interrupted this thread.</DL></DD></DL><HR><A NAME="grabPixels(long)"><!-- --></A><H3>grabPixels</H3><PRE>public boolean <B>grabPixels</B>(long ms) throws <A HREF="../../../java/lang/InterruptedException.html">InterruptedException</A></PRE><DL><DD>Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered or until the specified timeout has elapsed. This method behaves in the following ways, depending on the value of <code>ms</code>: <ul> <li> If <code>ms</code> == 0, waits until all pixels are delivered <li> If <code>ms</code> > 0, waits until all pixels are delivered as timeout expires. <li> If <code>ms</code> < 0, returns <code>true</code> if all pixels are grabbed, <code>false</code> otherwise and does not wait. </ul><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>ms</CODE> - the number of milliseconds to wait for the image pixels to arrive before timing out<DT><B>Returns:</B><DD>true if the pixels were successfully grabbed, false on abort, error or timeout<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/InterruptedException.html">InterruptedException</A></CODE> - Another thread has interrupted this thread.</DL></DD></DL><HR><A NAME="getStatus()"><!-- --></A><H3>getStatus</H3><PRE>public int <B>getStatus</B>()</PRE><DL><DD>Return the status of the pixels. The ImageObserver flags representing the available pixel information are returned.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the bitwise OR of all relevant ImageObserver flags<DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ImageObserver.html"><CODE>ImageObserver</CODE></A></DL></DD></DL><HR><A NAME="getWidth()"><!-- --></A><H3>getWidth</H3><PRE>public int <B>getWidth</B>()</PRE><DL><DD>Get the width of the pixel buffer (after adjusting for image width). If no width was specified for the rectangle of pixels to grab then then this information will only be available after the image has delivered the dimensions.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the final width used for the pixel buffer or -1 if the width is not yet known<DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/PixelGrabber.html#getStatus()"><CODE>getStatus()</CODE></A></DL></DD></DL><HR><A NAME="getHeight()"><!-- --></A><H3>getHeight</H3><PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -