bufferedimage.html
来自「API資料大全」· HTML 代码 · 共 1,331 行 · 第 1/5 页
HTML
1,331 行
<HR><A NAME="getAlphaRaster()"><!-- --></A><H3>getAlphaRaster</H3><PRE>public <A HREF="../../../java/awt/image/WritableRaster.html">WritableRaster</A> <B>getAlphaRaster</B>()</PRE><DL><DD>Returns a <code>WritableRaster</code> representing the alpha channel for <code>BufferedImage</code> objects with <code>ColorModel</code> objects that support a separate spatial alpha channel, such as <code>ComponentColorModel</code> and <code>DirectColorModel</code>. Returns <code>null</code> if there is no alpha channel associated with the <code>ColorModel</code> in this image. This method assumes that for all <code>ColorModel</code> objects other than <code>IndexColorModel</code>, if the <code>ColorModel</code> supports alpha, there is a separate alpha channel which is stored as the last band of image data. If the image uses an <code>IndexColorModel</code> that has alpha in the lookup table, this method returns <code>null</code> since there is no spatially discrete alpha channel. This method creates a new <code>WritableRaster</code>, but shares the data array.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a <code>WritableRaster</code> or <code>null</code> if this <code>BufferedImage</code> has no alpha channel associated with its <code>ColorModel</code>.</DL></DD></DL><HR><A NAME="getRGB(int, int)"><!-- --></A><H3>getRGB</H3><PRE>public int <B>getRGB</B>(int x, int y)</PRE><DL><DD>Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace. Color conversion takes place if this default model does not match the image <code>ColorModel</code>. There are only 8-bits of precision for each color component in the returned data when using this method.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x, y</CODE> - the coordinates of the pixel from which to get the pixel in the default RGB color model and sRGB color space<DT><B>Returns:</B><DD>an integer pixel in the default RGB color model and default sRGB colorspace.</DL></DD></DL><HR><A NAME="getRGB(int, int, int, int, int[], int, int)"><!-- --></A><H3>getRGB</H3><PRE>public int[] <B>getRGB</B>(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)</PRE><DL><DD>Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, from a portion of the image data. Color conversion takes place if the default model does not match the image <code>ColorModel</code>. There are only 8-bits of precision for each color component in the returned data when using this method. With a specified coordinate (x, y) in the image, the ARGB pixel can be accessed in this way: <pre> pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)]; </pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>startX, </CODE> - startY the starting coordinates<DD><CODE>w</CODE> - width of region<DD><CODE>h</CODE> - height of region<DD><CODE>rgbArray</CODE> - if not <code>null</code>, the rgb pixels are written here<DD><CODE>offset</CODE> - offset into the <code>rgbArray</code><DD><CODE>scansize</CODE> - scanline stride for the <code>rgbArray</code><DT><B>Returns:</B><DD>array of RGB pixels.<DT><B>Throws:</B><DD><CODE><code>IllegalArgumentException</code></CODE> - if an unknown datatype is specified</DL></DD></DL><HR><A NAME="setRGB(int, int, int)"><!-- --></A><H3>setRGB</H3><PRE>public void <B>setRGB</B>(int x, int y, int rgb)</PRE><DL><DD>Sets a pixel in this <code>BufferedImage</code> to the specified RGB value. The pixel is assumed to be in the default RGB color model, TYPE_INT_ARGB, and default sRGB color space. For images with an <code>IndexColorModel</code>, the index with the nearest color is chosen.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x, y</CODE> - the coordinates of the pixel to set<DD><CODE>rgb</CODE> - the RGB value</DL></DD></DL><HR><A NAME="setRGB(int, int, int, int, int[], int, int)"><!-- --></A><H3>setRGB</H3><PRE>public void <B>setRGB</B>(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)</PRE><DL><DD>Sets an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, into a portion of the image data. Color conversion takes place if the default model does not match the image <code>ColorModel</code>. There are only 8-bits of precision for each color component in the returned data when using this method. With a specified coordinate (x, y) in the this image, the ARGB pixel can be accessed in this way: <pre> pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)]; </pre> WARNING: No dithering takes place.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>startX, startY</CODE> - the starting coordinates<DD><CODE>w</CODE> - width of the region<DD><CODE>h</CODE> - height of the region<DD><CODE>rgbArray</CODE> - the rgb pixels<DD><CODE>offset</CODE> - offset into the <code>rgbArray</code><DD><CODE>scansize</CODE> - scanline stride for the <code>rgbArray</code></DL></DD></DL><HR><A NAME="getWidth()"><!-- --></A><H3>getWidth</H3><PRE>public int <B>getWidth</B>()</PRE><DL><DD>Returns the width of the <code>BufferedImage</code>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../java/awt/image/RenderedImage.html#getWidth()">getWidth</A></CODE> in interface <CODE><A HREF="../../../java/awt/image/RenderedImage.html">RenderedImage</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the width of this <code>BufferedImage</code>.</DL></DD></DL><HR><A NAME="getHeight()"><!-- --></A><H3>getHeight</H3><PRE>public int <B>getHeight</B>()</PRE><DL><DD>Returns the height of the <code>BufferedImage</code>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../java/awt/image/RenderedImage.html#getHeight()">getHeight</A></CODE> in interface <CODE><A HREF="../../../java/awt/image/RenderedImage.html">RenderedImage</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the height of this <code>BufferedImage</code>.</DL></DD></DL><HR><A NAME="getWidth(java.awt.image.ImageObserver)"><!-- --></A><H3>getWidth</H3><PRE>public int <B>getWidth</B>(<A HREF="../../../java/awt/image/ImageObserver.html">ImageObserver</A> observer)</PRE><DL><DD>Returns the actual width of the image. If the width is not known yet then the <A HREF="../../../java/awt/image/ImageObserver.html"><CODE>ImageObserver</CODE></A> is notified later and <code>-1</code> is returned.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/Image.html#getWidth(java.awt.image.ImageObserver)">getWidth</A></CODE> in class <CODE><A HREF="../../../java/awt/Image.html">Image</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>observer</CODE> - the <code>ImageObserver</code> that receives information about the image<DT><B>Returns:</B><DD>the width of the image or <code>-1</code> if the width is not yet known.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/Image.html#getHeight(java.awt.image.ImageObserver)"><CODE>Image.getHeight(ImageObserver)</CODE></A>, <A HREF="../../../java/awt/image/ImageObserver.html"><CODE>ImageObserver</CODE></A></DL></DD></DL><HR><A NAME="getHeight(java.awt.image.ImageObserver)"><!-- --></A><H3>getHeight</H3><PRE>public int <B>getHeight</B>(<A HREF="../../../java/awt/image/ImageObserver.html">ImageObserver</A> observer)</PRE><DL><DD>Returns the actual height of the image. If the height is not known yet then the <code>ImageObserver</code> is notified later and <code>-1</code> is returned.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/Image.html#getHeight(java.awt.image.ImageObserver)">getHeight</A></CODE> in class <CODE><A HREF="../../../java/awt/Image.html">Image</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>observer</CODE> - the <code>ImageObserver</code> that receives information about the image<DT><B>Returns:</B><DD>the height of the image or <code>-1</code> if the height is not yet known.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/Image.html#getWidth(java.awt.image.ImageObserver)"><CODE>Image.getWidth(ImageObserver)</CODE></A>, <A HREF="../../../java/awt/image/ImageObserver.html"><CODE>ImageObserver</CODE></A></DL></DD></DL><HR><A NAME="getSource()"><!-- --></A><H3>getSource</H3><PRE>public <A HREF="../../../java/awt/image/ImageProducer.html">ImageProducer</A> <B>getSource</B>()</PRE><DL><DD>Returns the object that produces the pixels for the image.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/Image.html#getSource()">getSource</A></CODE> in class <CODE><A HREF="../../../java/awt/Image.html">Image</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <A HREF="../../../java/awt/image/ImageProducer.html"><CODE>ImageProducer</CODE></A> that is used to produce the pixels for this image.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ImageProducer.html"><CODE>ImageProducer</CODE></A></DL></DD></DL><HR><A NAME="getProperty(java.lang.String, java.awt.image.ImageObserver)"><!-- --></A><H3>getProperty</H3><PRE>public <A HREF="../../../java/lang/Object.html">Object</A> <B>getProperty</B>(<A HREF="../../../java/lang/String.html">String</A> name, <A HREF="../../../java/awt/image/ImageObserver.html">ImageObserver</A> observer)</PRE><DL><DD>Returns a property of the image by name. Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the <code>UndefinedProperty</code> field. If the properties for this image are not yet known, then this method returns <code>null</code> and the <code>ImageObserver</code> object is notified later. The property name "comment" should be used to store an optional comment that can be presented to the user as a description of the image, its source, or its author.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/Image.html#getProperty(java.lang.String, java.awt.image.ImageObserver)">getProperty</A></CODE> in class <CODE><A HREF="../../../java/awt/Image.html">Image</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the property name<DD><CODE>observer</CODE> - the <code>ImageObserver</code> that receives notification regarding image information<DT><B>Returns:</B><DD>an <A HREF="../../../java/lang/Object.html"><CODE>Object</CODE></A> that is the property referred to by the specified <code>name</code> or <code>null</code> if the properties of this image are not yet known.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ImageObserver.html"><CODE>ImageObserver</CODE></A>, <A HREF="../../../java/awt/Image.html#UndefinedProperty"><CODE>Image.UndefinedProperty</CODE></A></DL></DD></DL><HR><A NAME="getProperty(java.lang.String)"><!-- --></A><H3>getProperty</H3><PRE>public <A HREF="../../../java/lang/Object.html">Object</A> <B>getProperty</B>(<A HREF="../../../java/lang/String.html">String</A> name)</PRE><DL><DD>Returns a property of the image by name.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../../java/awt/image/RenderedImage.html#getProperty(java.lang.String)">getProperty</A></CODE> in interface <CODE><A HREF="../../../java/awt/image/RenderedImage.html">RenderedImage</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the property name<DT><B>Returns:</B><DD>an <code>Object</code> that is the property referred to by the specified <code>name</code>.</DL></DD></DL><HR><A NAME="
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?