📄 packedcolormodel.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:11 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class PackedColorModel</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/PackedColorModel.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/MultiPixelPackedSampleModel.html"><B>PREV CLASS</B></A> <A HREF="../../../java/awt/image/PixelGrabber.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="PackedColorModel.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 PackedColorModel</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.PackedColorModel</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../java/awt/Transparency.html">Transparency</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../java/awt/image/DirectColorModel.html">DirectColorModel</A></DD></DL><HR><DL><DT>public abstract class <B>PackedColorModel</B><DT>extends <A HREF="../../../java/awt/image/ColorModel.html">ColorModel</A></DL><P>The <code>PackedColorModel</code> class is an abstract <A HREF="../../../java/awt/image/ColorModel.html"><CODE>ColorModel</CODE></A> class that works with pixel values which represent color and alpha information as separate samples and which pack all samples for a single pixel into a single int, short, or byte quantity. This class can be used with an arbitrary <A HREF="../../../java/awt/color/ColorSpace.html"><CODE>ColorSpace</CODE></A>. The number of color samples in the pixel values must be the same as the number of color components in the <code>ColorSpace</code>. There can be a single alpha sample. The array length is always 1 for those methods that use a primitive array pixel representation of type <code>transferType</code>. The transfer types supported are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, and DataBuffer.TYPE_INT. Color and alpha samples are stored in the single element of the array in bits indicated by bit masks. Each bit mask must be contiguous and masks must not overlap. The same masks apply to the single int pixel representation used by other methods. The correspondence of masks and color/alpha samples is as follows: <ul> <li> Masks are identified by indices running from 0 through <A HREF="../../../java/awt/image/ColorModel.html#getNumComponents()"><CODE>getNumComponents</CODE></A> - 1. <li> The first <A HREF="../../../java/awt/image/ColorModel.html#getNumColorComponents()"><CODE>getNumColorComponents</CODE></A> indices refer to color samples. <li> If an alpha sample is present, it corresponds the last index. <li> The order of the color indices is specified by the <code>ColorSpace</code>. Typically, this reflects the name of the color space type (for example, TYPE_RGB), index 0 corresponds to red, index 1 to green, and index 2 to blue. </ul> <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. A <code>PackedColorModel</code> is typically used with image data that uses masks to define packed samples. For example, a <code>PackedColorModel</code> can be used in conjunction with a <A HREF="../../../java/awt/image/SinglePixelPackedSampleModel.html"><CODE>SinglePixelPackedSampleModel</CODE></A> to construct a <A HREF="../../../java/awt/image/BufferedImage.html"><CODE>BufferedImage</CODE></A>. Normally the masks used by the <A HREF="../../../java/awt/image/SampleModel.html"><CODE>SampleModel</CODE></A> and the <code>ColorModel</code> would be the same. However, if they are different, the color interpretation of pixel data is done according to the masks of the <code>ColorModel</code>. <p> A single <code>int</code> pixel representation is valid for all objects of this class since it is always possible to represent pixel values used with this class in a single <code>int</code>. Therefore, methods that use this representation do not throw an <code>IllegalArgumentException</code> due to an invalid pixel value. <p> A subclass of <code>PackedColorModel</code> is <A HREF="../../../java/awt/image/DirectColorModel.html"><CODE>DirectColorModel</CODE></A>, which is similar to an X11 TrueColor visual.<P><DL><DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/DirectColorModel.html"><CODE>DirectColorModel</CODE></A>, <A HREF="../../../java/awt/image/SinglePixelPackedSampleModel.html"><CODE>SinglePixelPackedSampleModel</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/PackedColorModel.html#PackedColorModel(java.awt.color.ColorSpace, int, int[], int, boolean, int, int)">PackedColorModel</A></B>(<A HREF="../../../java/awt/color/ColorSpace.html">ColorSpace</A> space, int bits, int[] colorMaskArray, int alphaMask, boolean isAlphaPremultiplied, int trans, int transferType)</CODE><BR> Constructs a <code>PackedColorModel</code> from a color mask array, which specifies which bits in an <code>int</code> pixel representation contain each of the color samples, and an alpha mask.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../java/awt/image/PackedColorModel.html#PackedColorModel(java.awt.color.ColorSpace, int, int, int, int, int, boolean, int, int)">PackedColorModel</A></B>(<A HREF="../../../java/awt/color/ColorSpace.html">ColorSpace</A> space, int bits, int rmask, int gmask,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -