📄 componentcolormodel.html
字号:
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 <CODE>pixel</CODE> value is specified by an array of data elements of type <CODE>transferType</CODE> passed in as an object reference. The returned value is a non pre-multiplied value. 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). Since <code>ComponentColorModel</code> can be subclassed, subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported <code>transferType</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/ColorModel.html#getBlue(java.lang.Object)">getBlue</A></CODE> in class <CODE><A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - The pixel from which you want to get the blue color component, specified by an array of data elements of type <CODE>transferType</CODE>.<DT><B>Returns:</B><DD>The blue color component for the specified pixel, as an int.<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 the transfer type of this <CODE>ComponentColorModel</CODE> is not one of the supported transfer types: <CODE>DataBuffer.TYPE_BYTE</CODE>, <CODE>DataBuffer.TYPE_USHORT</CODE>, or <CODE>DataBuffer.TYPE_INT</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 <CODE>transferType</CODE> passed in as an object reference. Since <code>ComponentColorModel</code> can be subclassed, subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported <code>transferType</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/ColorModel.html#getAlpha(java.lang.Object)">getAlpha</A></CODE> in class <CODE><A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - The pixel from which you want to get the alpha component, specified by an array of data elements of type <CODE>transferType</CODE>.<DT><B>Returns:</B><DD>The alpha component for the specified pixel, as an int.<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 the transfer type of this <CODE>ComponentColorModel</CODE> is not one of the supported transfer types: <CODE>DataBuffer.TYPE_BYTE</CODE>, <CODE>DataBuffer.TYPE_USHORT</CODE>, or <CODE>DataBuffer.TYPE_INT</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 <CODE>transferType</CODE> passed in as an object reference. The returned value is in a non pre-multiplied format. If the alpha is premultiplied, this method divides it out of the color components (if the alpha value is 0, the color values will be 0). Since <code>ComponentColorModel</code> can be subclassed, subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported <code>transferType</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/ColorModel.html#getRGB(java.lang.Object)">getRGB</A></CODE> in class <CODE><A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>inData</CODE> - The pixel from which you want to get the color/alpha components, specified by an array of data elements of type <CODE>transferType</CODE>.<DT><B>Returns:</B><DD>The color/alpha components for the specified pixel, as an int.<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 the transfer type of this <CODE>ComponentColorModel</CODE> is not one of the supported transfer types: <CODE>DataBuffer.TYPE_BYTE</CODE>, <CODE>DataBuffer.TYPE_USHORT</CODE>, or <CODE>DataBuffer.TYPE_INT</CODE>.<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="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 <CODE>setDataElements</CODE> method of a <CODE>WritableRaster</CODE> object. If the <CODE>pixel</CODE> parameter is null, a new array is allocated. Since <code>ComponentColorModel</code> can be subclassed, subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported <code>transferType</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/ColorModel.html#getDataElements(int, java.lang.Object)">getDataElements</A></CODE> in class <CODE><A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>rgb</CODE> - <DD><CODE>pixel</CODE> - The integer representation of the pixel.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - If <CODE>pixel</CODE> is not null and 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 the transfer type of this <CODE>ComponentColorModel</CODE> is not one of the supported transfer types: <CODE>DataBuffer.TYPE_BYTE</CODE>, <CODE>DataBuffer.TYPE_USHORT</CODE>, or <CODE>DataBuffer.TYPE_INT</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>. Color/alpha components are stored in the <CODE>components</CODE> array starting at <CODE>offset</CODE> (even if the array is allocated by this method).<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/ColorModel.html#getComponents(int, int[], int)">getComponents</A></CODE> in class <CODE><A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pixel</CODE> - The pixel value specified as an integer.<DD><CODE>components</CODE> - An integer array in which to store the unnormalized color/alpha components. If the <CODE>components</CODE> array is null, a new array is allocated.<DD><CODE>offset</CODE> - An offset into the <CODE>components</CODE> array.<DT><B>Returns:</B><DD>The components array.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - If there is more than one component in this <CODE>ColorModel</CODE>.<DD><CODE><A HREF="../../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - If the <CODE>components</CODE> array is not null and is not large enough to hold all the color and alpha components (starting at offset).</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 <CODE>transferType</CODE> passed in as an object reference. Color/alpha components are stored in the <CODE>components</CODE> array starting at <CODE>offset</CODE> (even if the array is allocated by this method). Since <code>ComponentColorModel</code> can be subclassed, subclasses inherit the implementation of this method and if they don't override it then this method might throw an exception if they use an unsupported <code>transferType</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/ColorModel.html#getComponents(java.lang.Object, int[], int)">getComponents</A></CODE> in class <CODE><A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pixel</CODE> - A pixel value specified by an array of data elements of type <CODE>transferType</CODE>.<DD><CODE>components</CODE> - An integer array in which to store the unnormalized color/alpha components. If the <CODE>components</CODE> array is null, a new array is allocated.<DD><CODE>offset</CODE> - An offset into the <CODE>components</CODE> array.<DT><B>Returns:</B><DD>The <CODE>components</CODE> array.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - in some cases iff the transfer type of this <CODE>ComponentColorModel</CODE> is not one of the supported transfer types: <CODE>DataBuffer.TYPE_BYTE</CODE>, <CODE>DataBuffer.TYPE_USHORT</CODE>, or <CODE>DataBuffer.TYPE_INT</CODE>.<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/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - If the <CODE>components</CODE> array is not null and is not large enough to hold all the color and alpha components (starting at offset), or if <CODE>pixel</CODE> is not large enough to hold a pixel value for this ColorModel.</DL></DD></DL><HR><A NAME="getDataElement(int[], int)"><!-- --></A><H3>getDataElement</H3><PRE>public int <B>getDataElement</B>(int[] components, int offset)</PRE><DL><DD>Returns a pixel value represented as an int in this <CODE>ColorModel</CODE>, given an array of unnormalized color/alpha components.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../java/awt/image/ColorModel.html#getDataElement(int[], int)">getDataElement</A></CODE> in class <CODE><A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>components</CODE> - An array of unnormalized color/alpha components.<DD><CODE>offset</CODE> - An offset into the <CODE>components</CODE> array.<DT><B>Returns:</B><DD>A pixel value represented as an int.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - If there is more than one component in this <CODE>ColorModel</CODE>.</DL></DD></DL><HR><A NAME="getDataElements(int[], int, java.lang.Object)"><!-- --></A><H3>getDataElements</H3><PRE>public <A HREF="../../../java/lang/Object.html">Object</A> <B>getDataElements</B>(int[] components, int offset, <A HREF="../../../java/lang/Object.html">Object</A> obj)</PRE><DL><DD>Returns a data element array representation of a pixel in this <CODE>ColorModel</CODE>, given an array of unnormalized color/alpha
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -