📄 samplemodel.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:14 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class SampleModel</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/SampleModel.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/RGBImageFilter.html"><B>PREV CLASS</B></A> <A HREF="../../../java/awt/image/ShortLookupTable.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="SampleModel.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">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: <A HREF="#field_detail">FIELD</A> | <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 SampleModel</H2><PRE><A HREF="../../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.awt.image.SampleModel</B></PRE><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../java/awt/image/ComponentSampleModel.html">ComponentSampleModel</A>, <A HREF="../../../java/awt/image/MultiPixelPackedSampleModel.html">MultiPixelPackedSampleModel</A>, <A HREF="../../../java/awt/image/SinglePixelPackedSampleModel.html">SinglePixelPackedSampleModel</A></DD></DL><HR><DL><DT>public abstract class <B>SampleModel</B><DT>extends <A HREF="../../../java/lang/Object.html">Object</A></DL><P>This abstract class defines an interface for extracting samples of pixels in an image. All image data is expressed as a collection of pixels. Each pixel consists of a number of samples. A sample is a datum for one band of an image and a band consists of all samples of a particular type in an image. For example, a pixel might contain three samples representing its red, green and blue components. There are three bands in the image containing this pixel. One band consists of all the red samples from all pixels in the image. The second band consists of all the green samples and the remaining band consists of all of the blue samples. The pixel can be stored in various formats. For example, all samples from a particular band can be stored contiguously or all samples from a single pixel can be stored contiguously. In the Java 2D(tm) API, all built-in image processing and display operators process samples which represent unsigned integral values. <p> A collection of pixels is represented as a Raster, which consists of a DataBuffer and a SampleModel. The SampleModel allows access to samples in the DataBuffer and may provide low-level information that a programmer can use to directly manipulate samples and pixels in the DataBuffer. <p> This class is generally a fall back method for dealing with images. More efficient code will cast the SampleModel to the appropriate subclass and extract the information needed to directly manipulate pixels in the DataBuffer.<P><DL><DT><B>See Also: </B><DD><A HREF="../../../java/awt/image/DataBuffer.html"><CODE>DataBuffer</CODE></A>, <A HREF="../../../java/awt/image/Raster.html"><CODE>Raster</CODE></A>, <A HREF="../../../java/awt/image/ComponentSampleModel.html"><CODE>ComponentSampleModel</CODE></A>, <A HREF="../../../java/awt/image/PixelInterleavedSampleModel.html"><CODE>PixelInterleavedSampleModel</CODE></A>, <A HREF="../../../java/awt/image/BandedSampleModel.html"><CODE>BandedSampleModel</CODE></A>, <A HREF="../../../java/awt/image/MultiPixelPackedSampleModel.html"><CODE>MultiPixelPackedSampleModel</CODE></A>, <A HREF="../../../java/awt/image/SinglePixelPackedSampleModel.html"><CODE>SinglePixelPackedSampleModel</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#dataType">dataType</A></B></CODE><BR> Data type of the DataBuffer storing the pixel data.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#height">height</A></B></CODE><BR> Height in pixels of the region of image data that this SampleModel describes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#numBands">numBands</A></B></CODE><BR> Number of bands of the image data that this SampleModel describes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#width">width</A></B></CODE><BR> Width in pixels of the region of image data that this SampleModel describes.</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/SampleModel.html#SampleModel(int, int, int, int)">SampleModel</A></B>(int dataType, int w, int h, int numBands)</CODE><BR> Constructs a SampleModel with 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>abstract <A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#createCompatibleSampleModel(int, int)">createCompatibleSampleModel</A></B>(int w, int h)</CODE><BR> Creates a SampleModel which describes data in this SampleModel's format, but with a different width and height.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#createDataBuffer()">createDataBuffer</A></B>()</CODE><BR> Creates a DataBuffer that corresponds to this SampleModel.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/awt/image/SampleModel.html">SampleModel</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#createSubsetSampleModel(int[])">createSubsetSampleModel</A></B>(int[] bands)</CODE><BR> Creates a new SampleModel with a subset of the bands of this SampleModel.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#getDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)">getDataElements</A></B>(int x, int y, int w, int h, <A HREF="../../../java/lang/Object.html">Object</A> obj, <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A> data)</CODE><BR> Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)">getDataElements</A></B>(int x, int y, <A HREF="../../../java/lang/Object.html">Object</A> obj, <A HREF="../../../java/awt/image/DataBuffer.html">DataBuffer</A> data)</CODE><BR> Returns data for a single pixel in a primitive array of type TransferType.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#getDataType()">getDataType</A></B>()</CODE><BR> Returns the data type of the DataBuffer storing the pixel data.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/image/SampleModel.html#getHeight()">getHeight</A></B>()</CODE><BR> Returns the height in pixels.</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 + -