📄 componentcolormodel.html
字号:
<!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:02 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class ComponentColorModel</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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ComponentColorModel.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../java/awt/image/ColorModel.html"><B>PREV CLASS</B></A> <A HREF="../../../java/awt/image/ComponentSampleModel.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> <A HREF="ComponentColorModel.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#fields_inherited_from_class_java.awt.image.ColorModel">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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 ComponentColorModel</H2><PRE><A HREF="../../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../../java/awt/image/ColorModel.html">java.awt.image.ColorModel</A> | +--<B>java.awt.image.ComponentColorModel</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../java/awt/Transparency.html">Transparency</A></DD></DL><HR><DL><DT>public class <B>ComponentColorModel</B><DT>extends <A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></DL><P>A <CODE>ColorModel</CODE> class that works with pixel values that represent color and alpha information as separate samples and that store each sample in a separate data element. This class can be used with an arbitrary <CODE>ColorSpace</CODE>. The number of color samples in the pixel values must be same as the number of color components in the <CODE>ColorSpace</CODE>. There may be a single alpha sample. <p> For those methods that use a primitive array pixel representation of type <CODE>transferType</CODE>, the array length is the same as the number of color and alpha samples. Color samples are stored first in the array followed by the alpha sample, if present. The order of the color samples is specified by the <CODE>ColorSpace</CODE>. Typically, this order reflects the name of the color space type. For example, for <CODE>TYPE_RGB</CODE>, index 0 corresponds to red, index 1 to green, and index 2 to blue. The transfer types supported are <CODE>DataBuffer.TYPE_BYTE</CODE>, <CODE>DataBuffer.TYPE_USHORT</CODE>, and <CODE>DataBuffer.TYPE_INT</CODE>. <p> The translation from pixel values to color/alpha components for display or processing purposes is a one-to-one correspondence of samples to components. The number of bits in a color or alpha sample of a pixel value might not be the same as the number of bits for the corresponding color or alpha component passed to the <CODE>ComponentColorModel</CODE> constructor. This class assumes that the least significant n bits of a sample value hold the component value, where n is the number of significant bits for the component passed to the constructor. It also assumes that any higher-order bits in a sample value are zero. <p> Methods that use a single int pixel representation throw an <CODE>IllegalArgumentException</CODE>, unless the number of components for the <CODE>ComponentColorModel</CODE> is one--in other words, a single color component and no alpha. <p> A <CODE>ComponentColorModel</CODE> can be used in conjunction with a <CODE>ComponentSampleModel</CODE>, a <CODE>BandedSampleModel</CODE>, or a <CODE>PixelInterleavedSampleModel</CODE> to construct a <CODE>BufferedImage</CODE>.<P><DL><DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/ColorModel.html"><CODE>ColorModel</CODE></A>, <A HREF="../../../java/awt/color/ColorSpace.html"><CODE>ColorSpace</CODE></A>, <A HREF="../../../java/awt/image/ComponentSampleModel.html"><CODE>ComponentSampleModel</CODE></A>, <A HREF="../../../java/awt/image/BandedSampleModel.html"><CODE>BandedSampleModel</CODE></A>, <A HREF="../../../java/awt/image/PixelInterleavedSampleModel.html"><CODE>PixelInterleavedSampleModel</CODE></A>, <A HREF="../../../java/awt/image/BufferedImage.html"><CODE>BufferedImage</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="fields_inherited_from_class_java.awt.image.ColorModel"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class java.awt.image.<A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/awt/image/ColorModel.html#pixel_bits">pixel_bits</A>, <A HREF="../../../java/awt/image/ColorModel.html#transferType">transferType</A></CODE></TD></TR></TABLE> <A NAME="fields_inherited_from_class_java.awt.Transparency"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface java.awt.<A HREF="../../../java/awt/Transparency.html">Transparency</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/awt/Transparency.html#BITMASK">BITMASK</A>, <A HREF="../../../java/awt/Transparency.html#OPAQUE">OPAQUE</A>, <A HREF="../../../java/awt/Transparency.html#TRANSLUCENT">TRANSLUCENT</A></CODE></TD></TR></TABLE> <!-- ======== 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/ComponentColorModel.html#ComponentColorModel(java.awt.color.ColorSpace, int[], boolean, boolean, int, int)">ComponentColorModel</A></B>(<A HREF="../../../java/awt/color/ColorSpace.html">ColorSpace</A> colorSpace, int[] bits, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)</CODE><BR> Constructs a <CODE>ComponentColorModel</CODE> from the specified parameters.</TD></TR></TABLE> <!-- ========== 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> <A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/ComponentColorModel.html#coerceData(java.awt.image.WritableRaster, boolean)">coerceData</A></B>(<A HREF="../../../java/awt/image/WritableRaster.html">WritableRaster</A> raster, boolean isAlphaPremultiplied)</CODE><BR> Forces the raster data to match the state specified in the <CODE>isAlphaPremultiplied</CODE> variable, assuming the data is currently correctly described by this <CODE>ColorModel</CODE>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/ComponentColorModel.html#createCompatibleSampleModel(int, int)">createCompatibleSampleModel</A></B>(int w, int h)</CODE><BR> Creates a <CODE>SampleModel</CODE> with the specified width and height, that has a data layout compatible with this <CODE>ColorModel</CODE>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../java/awt/image/WritableRaster.html">WritableRaster</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/ComponentColorModel.html#createCompatibleWritableRaster(int, int)">createCompatibleWritableRaster</A></B>(int w, int h)</CODE><BR> Creates a <CODE>WritableRaster</CODE> with the specified width and height, that has a data layout (<CODE>SampleModel</CODE>) compatible with this <CODE>ColorModel</CODE>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -