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

📄 pixelgrabber.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:34:12 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  PixelGrabber</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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/PixelGrabber.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/PackedColorModel.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../java/awt/image/PixelInterleavedSampleModel.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="PixelGrabber.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;FIELD&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><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.awt.image</FONT><BR>Class  PixelGrabber</H2><PRE><A HREF="../../../java/lang/Object.html">java.lang.Object</A>  |  +--<B>java.awt.image.PixelGrabber</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../java/awt/image/ImageConsumer.html">ImageConsumer</A></DD></DL><HR><DL><DT>public class <B>PixelGrabber</B><DT>extends <A HREF="../../../java/lang/Object.html">Object</A><DT>implements <A HREF="../../../java/awt/image/ImageConsumer.html">ImageConsumer</A></DL><P>The PixelGrabber class implements an ImageConsumer which can be attached to an Image or ImageProducer object to retrieve a subset of the pixels in that image.  Here is an example: <pre> public void handlesinglepixel(int x, int y, int pixel) {	int alpha = (pixel >> 24) & 0xff;	int red   = (pixel >> 16) & 0xff;	int green = (pixel >>  8) & 0xff;	int blue  = (pixel      ) & 0xff;	// Deal with the pixel as necessary... } public void handlepixels(Image img, int x, int y, int w, int h) {	int[] pixels = new int[w * h];	PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);	try {	    pg.grabPixels();	} catch (InterruptedException e) {	    System.err.println("interrupted waiting for pixels!");	    return;	}	if ((pg.getStatus() & ImageObserver.ABORT) != 0) {	    System.err.println("image fetch aborted or errored");	    return;	}	for (int j = 0; j < h; j++) {	    for (int i = 0; i < w; i++) {		handlesinglepixel(x+i, y+j, pixels[j * w + i]);	    }	} } </pre><P><DL><DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ColorModel.html#getRGBdefault()"><CODE>ColorModel.getRGBdefault()</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="fields_inherited_from_class_java.awt.image.ImageConsumer"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface java.awt.image.<A HREF="../../../java/awt/image/ImageConsumer.html">ImageConsumer</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/awt/image/ImageConsumer.html#COMPLETESCANLINES">COMPLETESCANLINES</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#IMAGEABORTED">IMAGEABORTED</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#IMAGEERROR">IMAGEERROR</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#RANDOMPIXELORDER">RANDOMPIXELORDER</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#SINGLEFRAME">SINGLEFRAME</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#SINGLEFRAMEDONE">SINGLEFRAMEDONE</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#SINGLEPASS">SINGLEPASS</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#STATICIMAGEDONE">STATICIMAGEDONE</A>, <A HREF="../../../java/awt/image/ImageConsumer.html#TOPDOWNLEFTRIGHT">TOPDOWNLEFTRIGHT</A></CODE></TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#PixelGrabber(java.awt.Image, int, int, int, int, boolean)">PixelGrabber</A></B>(<A HREF="../../../java/awt/Image.html">Image</A>&nbsp;img,             int&nbsp;x,             int&nbsp;y,             int&nbsp;w,             int&nbsp;h,             boolean&nbsp;forceRGB)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#PixelGrabber(java.awt.Image, int, int, int, int, int[], int, int)">PixelGrabber</A></B>(<A HREF="../../../java/awt/Image.html">Image</A>&nbsp;img,             int&nbsp;x,             int&nbsp;y,             int&nbsp;w,             int&nbsp;h,             int[]&nbsp;pix,             int&nbsp;off,             int&nbsp;scansize)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image into the given array.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#PixelGrabber(java.awt.image.ImageProducer, int, int, int, int, int[], int, int)">PixelGrabber</A></B>(<A HREF="../../../java/awt/image/ImageProducer.html">ImageProducer</A>&nbsp;ip,             int&nbsp;x,             int&nbsp;y,             int&nbsp;w,             int&nbsp;h,             int[]&nbsp;pix,             int&nbsp;off,             int&nbsp;scansize)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#abortGrabbing()">abortGrabbing</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Request the PixelGrabber to abort the image fetch.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#getColorModel()">getColorModel</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the ColorModel for the pixels stored in the array.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#getHeight()">getHeight</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the height of the pixel buffer (after adjusting for image height).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#getPixels()">getPixels</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the pixel buffer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#getStatus()">getStatus</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the status of the pixels.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#getWidth()">getWidth</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the width of the pixel buffer (after adjusting for image width).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#grabPixels()">grabPixels</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#grabPixels(long)">grabPixels</A></B>(long&nbsp;ms)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#imageComplete(int)">imageComplete</A></B>(int&nbsp;status)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The imageComplete 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>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#setColorModel(java.awt.image.ColorModel)">setColorModel</A></B>(<A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A>&nbsp;model)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The setColorModel 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>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#setDimensions(int, int)">setDimensions</A></B>(int&nbsp;width,              int&nbsp;height)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The setDimensions 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>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/PixelGrabber.html#setHints(int)">setHints</A></B>(int&nbsp;hints)</CODE>

⌨️ 快捷键说明

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