colormodel.html
来自「API資料大全」· HTML 代码 · 共 1,326 行 · 第 1/5 页
HTML
1,326 行
<code>DataBuffer.TYPE_USHORT</code>, or <code>DataBuffer.TYPE_INT</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - an array of pixel values<DT><B>Returns:</B><DD>the value of the red component of the specified pixel.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <code>inData</code> is not a primitive array of type <code>transferType</code><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code><DD><CODE><A HREF="../../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if this <code>tranferType</code> is not supported by this <code>ColorModel</code></DL></DD></DL><HR><A NAME="getGreen(java.lang.Object)"><!-- --></A><H3>getGreen</H3><PRE>public int <B>getGreen</B>(<A HREF="../../../java/lang/Object.html">Object</A> inData)</PRE><DL><DD>Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A color conversion is done if necessary. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. The returned value will be a non pre-multiplied value. For example, if the alpha is premultiplied, this method divides it out before returning the value. If the alpha value is 0, the green value is 0. If <code>inData</code> is not a primitive array of type transferType, a <code>ClassCastException</code> is thrown. An <code>ArrayIndexOutOfBoundsException</code> is thrown if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code>. If this <code>transferType</code> is not supported, a <code>UnsupportedOperationException</code> will be thrown. Since <code>ColorModel</code> is an abstract class, any instance must be an instance of a subclass. Subclasses inherit the implementation of this method and if they don't override it, this method throws an exception if the subclass uses a <code>transferType</code> other than <code>DataBuffer.TYPE_BYTE</code>, <code>DataBuffer.TYPE_USHORT</code>, or <code>DataBuffer.TYPE_INT</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - an array of pixel values<DT><B>Returns:</B><DD>the value of the green component of the specified pixel.<DT><B>Throws:</B><DD><CODE><code>ClassCastException</code></CODE> - if <code>inData</code> is not a primitive array of type <code>transferType</code><DD><CODE><code>ArrayIndexOutOfBoundsException</code></CODE> - if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code><DD><CODE><code>UnsupportedOperationException</code></CODE> - if this <code>tranferType</code> is not supported by this <code>ColorModel</code></DL></DD></DL><HR><A NAME="getBlue(java.lang.Object)"><!-- --></A><H3>getBlue</H3><PRE>public int <B>getBlue</B>(<A HREF="../../../java/lang/Object.html">Object</A> inData)</PRE><DL><DD>Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A color conversion is done if necessary. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. The returned value is a non pre-multiplied value. For example, if the alpha is premultiplied, this method divides it out before returning the value. If the alpha value is 0, the blue value will be 0. If <code>inData</code> is not a primitive array of type transferType, a <code>ClassCastException</code> is thrown. An <code>ArrayIndexOutOfBoundsException</code> is thrown if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code>. If this <code>transferType</code> is not supported, a <code>UnsupportedOperationException</code> will be thrown. Since <code>ColorModel</code> is an abstract class, any instance must be an instance of a subclass. Subclasses inherit the implementation of this method and if they don't override it, this method throws an exception if the subclass uses a <code>transferType</code> other than <code>DataBuffer.TYPE_BYTE</code>, <code>DataBuffer.TYPE_USHORT</code>, or <code>DataBuffer.TYPE_INT</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - an array of pixel values<DT><B>Returns:</B><DD>the value of the blue component of the specified pixel.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <code>inData</code> is not a primitive array of type <code>transferType</code><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code><DD><CODE><A HREF="../../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if this <code>tranferType</code> is not supported by this <code>ColorModel</code></DL></DD></DL><HR><A NAME="getAlpha(java.lang.Object)"><!-- --></A><H3>getAlpha</H3><PRE>public int <B>getAlpha</B>(<A HREF="../../../java/lang/Object.html">Object</A> inData)</PRE><DL><DD>Returns the alpha component for the specified pixel, scaled from 0 to 255. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. If inData is not a primitive array of type transferType, a <code>ClassCastException</code> is thrown. An <code>ArrayIndexOutOfBoundsException</code> is thrown if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code>. If this <code>transferType</code> is not supported, a <code>UnsupportedOperationException</code> will be thrown. Since <code>ColorModel</code> is an abstract class, any instance must be an instance of a subclass. Subclasses inherit the implementation of this method and if they don't override it, this method throws an exception if the subclass uses a <code>transferType</code> other than <code>DataBuffer.TYPE_BYTE</code>, <code>DataBuffer.TYPE_USHORT</code>, or <code>DataBuffer.TYPE_INT</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - the specified pixel<DT><B>Returns:</B><DD>the alpha component of the specified pixel, scaled from 0 to 255.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <code>inData</code> is not a primitive array of type <code>transferType</code><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code><DD><CODE><A HREF="../../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if this <code>tranferType</code> is not supported by this <code>ColorModel</code></DL></DD></DL><HR><A NAME="getRGB(java.lang.Object)"><!-- --></A><H3>getRGB</H3><PRE>public int <B>getRGB</B>(<A HREF="../../../java/lang/Object.html">Object</A> inData)</PRE><DL><DD>Returns the color/alpha components for the specified pixel in the default RGB color model format. A color conversion is done if necessary. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. If inData is not a primitive array of type transferType, a <code>ClassCastException</code> is thrown. An <code>ArrayIndexOutOfBoundsException</code> is thrown if <code>inData</code> is not large enough to hold a pixel value for this <code>ColorModel</code>. The returned value will be in a non pre-multiplied format, i.e. if the alpha is premultiplied, this method will divide it out of the color components (if the alpha value is 0, the color values will be 0).<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - the specified pixel<DT><B>Returns:</B><DD>the color and alpha components of the specified pixel.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ColorModel.html#getRGBdefault()"><CODE>getRGBdefault()</CODE></A></DL></DD></DL><HR><A NAME="getDataElements(int, java.lang.Object)"><!-- --></A><H3>getDataElements</H3><PRE>public <A HREF="../../../java/lang/Object.html">Object</A> <B>getDataElements</B>(int rgb, <A HREF="../../../java/lang/Object.html">Object</A> pixel)</PRE><DL><DD>Returns a data element array representation of a pixel in this <code>ColorModel</code>, given an integer pixel representation in the default RGB color model. This array can then be passed to the <A HREF="../../../java/awt/image/WritableRaster.html#setDataElements(int, int, java.lang.Object)"><CODE>WritableRaster.setDataElements(int, int, java.lang.Object)</CODE></A> method of a <A HREF="../../../java/awt/image/WritableRaster.html"><CODE>WritableRaster</CODE></A> object. If the pixel variable is <code>null</code>, a new array will be allocated. If <code>pixel</code> is not <code>null</code>, it must be a primitive array of type <code>transferType</code>; otherwise, a <code>ClassCastException</code> is thrown. An <code>ArrayIndexOutOfBoundsException</code> is thrown if <code>pixel</code> is not large enough to hold a pixel value for this <code>ColorModel</code>. The pixel array is returned. If this <code>transferType</code> is not supported, a <code>UnsupportedOperationException</code> will be thrown. Since <code>ColorModel</code> is an abstract class, any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws an <code>UnsupportedOperationException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>rgb</CODE> - the integer pixel representation in the default RGB color model<DD><CODE>pixel</CODE> - the specified pixel<DT><B>Returns:</B><DD>an array representation of the specified pixel in this <code>ColorModel</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <code>pixel</code> is not a primitive array of type <code>transferType</code><DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <code>pixel</code> is not large enough to hold a pixel value for this <code>ColorModel</code><DD><CODE><A HREF="../../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if this method is not supported by this <code>ColorModel</code><DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/WritableRaster.html#setDataElements(int, int, java.lang.Object)"><CODE>WritableRaster.setDataElements(int, int, java.lang.Object)</CODE></A>, <A HREF="../../../java/awt/image/SampleModel.html#setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)"><CODE>SampleModel.setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)</CODE></A></DL></DD></DL><HR><A NAME="getComponents(int, int[], int)"><!-- --></A><H3>getComponents</H3><PRE>public int[] <B>getComponents</B>(int pixel, int[] components, int offset)</PRE><DL><DD>Returns an array of unnormalized color/alpha components given a pixel in this <code>ColorModel</code>. The pixel value is specified as an <code>int</code>. An <code>IllegalArgumentException</code> will be thrown if pixel values for this <code>ColorModel</code> are not conveniently representable as a single <code>int</code>. For example, this method can be used to retrieve the components for a specific pixel value in a <code>DirectColorModel</code>. If the components array is <code>null</code>, a new array will be allocated. The components array will be returned. Color/alpha components are stored in the components array starting at <code>offset</code> (even if the array is allocated by this method). An <code>ArrayIndexOutOfBoundsException</code> is thrown if the components array is not <code>null</code> and is not large enough to hold all the color and alpha components (starting at offset). Since <code>ColorModel</code> is an abstract class, any instance is an instance of a subclass. Subclasses must override this method since the implementation in this abstract class throws an <code>UnsupportedOperationException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pixel</CODE> - the specified pixel<DD><CODE>components</CODE> - the array to receive the color and alpha components of the specified pixel<DD><CODE>offset</CODE> - the offset into the <code>components</code> array at which to start storing the color and alpha components<DT><B>Returns:</B><DD>an array containing the color and alpha components of the specified pixel starting at the specified offset.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if this method is not supported by this <code>ColorModel</code></DL></DD></DL><HR><A NAME="getComponents(java.lang.Object, int[], int)"><!-- --></A><H3>getComponents</H3><PRE>public int[] <B>getComponents</B>(<A HREF="../../../java/lang/Object.html">Object</A> pixel, int[] components, int offset)</PRE><DL><DD>Returns an array of unnormalized color/alpha components given a pixel in this <code>ColorModel</code>. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. If <code>pixel</code> is not a primitive array of type transferType, a <code>ClassCastException</code> is thrown. An <code>ArrayIndexOutOfBoundsException</code> is thrown if <code>pixel</code> is not large enough to hold a pixel value for this <code>ColorModel</code>. This method can be used to retrieve the components for a specific pixel value in any <code>ColorModel</code>. If the components array is <code>null</code>, a new array will be allocated. The components array will be returned. Color/alpha components are stored in the <code>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?