⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 image.html

📁 J2ME MIDP2.0 final specification
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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 Fri Sep 27 14:47:31 CDT 2002 --><TITLE>Mobile Information Device Profile 2.0: Class  Image</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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Image.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><strong>MIDP 2.0</strong></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../javax/microedition/lcdui/Graphics.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../javax/microedition/lcdui/ImageItem.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>  &nbsp;&nbsp;<A HREF="Image.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.microedition.lcdui</FONT><BR>Class  Image</H2><PRE>java.lang.Object  |  +--<B>javax.microedition.lcdui.Image</B></PRE><HR><DL><DT>public class <B>Image</B><DT>extends Object</DL><P>The <code>Image</code> class is used to hold graphical image data. <code>Image</code> objects exist independently of the display device. They exist only in off-screen memory and will not be painted on the display unless an explicit command is issued by the application (such as within the <code>paint()</code> method of a <code>Canvas</code>) or when an <code>Image</code> object is placed within a <code>Form</code> screen or an <code>Alert</code> screen and that screen is made current. <p>Images are either <em>mutable</em> or <em>immutable</em> depending upon how they are created. Immutable images are generally created by loading image data from resource bundles, from files, or from the network. They may not be modified once created. Mutable images are created as blank images containing only white pixels. The application may render on a mutable image by calling <A HREF="../../../javax/microedition/lcdui/Image.html#getGraphics()"><CODE>getGraphics()</CODE></A> on the <code>Image</code> to obtain a <code>Graphics</code> object expressly for this purpose.</p> <p><code>Images</code> may be placed within <code>Alert</code>, <code>Choice</code>, <code>Form</code>, or <code>ImageItem</code> objects. The high-level user interface implementation may need to update the display at any time, without notifying the application.  In order to provide predictable behavior, the high-level user interface objects provide snapshot semantics for the image.  That is, when a mutable image is placed within an <code>Alert</code>, <code>Choice</code>, <code>Form</code>, or <code>ImageItem</code> object, the effect is as if a snapshot is taken of its current contents.  This snapshot is then used for all subsequent painting of the high-level user interface component.  If the application modifies the contents of the image, the application must update the component containing the image (for example, by calling <code>ImageItem.setImage</code>) in order to make the modified contents visible.</p> <p>An immutable image may be created from a mutable image through the use of the <A HREF="../../../javax/microedition/lcdui/Image.html#createImage(javax.microedition.lcdui.Image)"><CODE>createImage</CODE></A> method. It is possible to create a mutable copy of an immutable image using a technique similar to the following: </p> <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1">    <pre><code>    Image source; // the image to be copied    source = Image.createImage(...);    Image copy = Image        .createImage(source.getWidth(), source.getHeight());    Graphics g = copy.getGraphics();    g.drawImage(source, 0, 0, TOP|LEFT);       </code></pre> </TD> </TR> </TABLE> <a name="alpha"></a> <h3>Alpha Processing</h3> <p>Every pixel within a mutable image is always fully opaque.  Immutable images may contain a combination of fully opaque pixels <code>(alpha = 2<sup><em>bitdepth</em></sup>&nbsp;-&nbsp;1)</code>, fully transparent pixels (<code>alpha&nbsp;=&nbsp;0</code>), and semitransparent pixels (<code>0&nbsp;&lt;&nbsp;alpha&nbsp;&lt;&nbsp; 2<sup><em>bitdepth</em></sup>&nbsp;-&nbsp;1</code>), where <em>bitdepth</em> is the number of bits per sample in the source data. <p>Implementations must support storage, processing, and rendering of fully opaque pixels and fully transparent pixels in immutable images.  When creating an image from source data (whether from a PNG file or from an array of ARGB data), a fully opaque pixel in the source data must always result in a fully opaque pixel in the new image, and a fully transparent pixel in the source data must always result in a fully transparent pixel in the new image. <p>The required treatment of semitransparent pixel data depends upon whether the implementation supports alpha blending at rendering time.  If the implementation supports alpha blending, a semitransparent pixel in the source data must result in a semitransparent pixel in the new image.  The resulting alpha value may be modified to accommodate the number of levels of semitransparency supported by the platform.  (See the <A HREF="../../../javax/microedition/lcdui/Display.html#numAlphaLevels()"><CODE>Display.numAlphaLevels()</CODE></A> method.)  If an implementation does not support alpha blending, any semitransparent pixels in the source data must be replaced with fully transparent pixels in the new image. <a name="PNG"></a> <h3>PNG Image Format</h3> <p>Implementations are required to support images stored in the PNG format, as specified by the <em>PNG (Portable Network Graphics) Specification, Version 1.0.</em> All conforming MIDP implementations are also conformant to the minimum set of requirements given by the <em>PNG Specification</em>. MIDP implementations also must conform to additional requirements given here with respect to handling of PNG images.  Note that the requirements listed here take precedence over any conflicting recommendations given in the <em>PNG Specification</em>.</p> <h4>Critical Chunks</h4> <p>All of the 'critical' chunks specified by PNG must be supported. The paragraphs below describe these critical chunks.</p> <p>The IHDR chunk.  MIDP devices must handle the following values in the IHDR chunk:</p> <ul> <li>All positive values of width and height are supported; however, a very large image may not be readable because of memory constraints. The dimensions of the resulting <code>Image</code> object must match the dimensions of the PNG image.  That is, the values returned by <A HREF="../../../javax/microedition/lcdui/Image.html#getWidth()"><CODE>getWidth()</CODE></A> and <A HREF="../../../javax/microedition/lcdui/Image.html#getHeight()"><CODE>getHeight()</CODE></A> and the rendered width and height must equal the width and height specified in the IHDR chunk.</li> <li>All color types are supported, although the appearance of the image will be dependent on the capabilities of the device's screen.  Color types that include alpha channel data are supported.</li> <li> For color types <code>4</code> &amp; <code>6</code> (grayscale with alpha and RGB with alpha, respectively) the alpha channel must be decoded. Any pixels with an alpha value of zero must be treated as transparent.  Any pixels with an alpha value of <code>255</code> (for images with <code>8</code> bits per sample) or <code>65535</code> (for images with <code>16</code> bits per sample) must be treated as opaque.  If rendering with alpha blending is supported, any pixels with intermediate alpha values must be carried through to the resulting image.  If alpha blending is not supported, any pixels with intermediate alpha values must be replaced with fully transparent pixels.</li> <li>All bit depth values for the given color type are supported.</li> <li>Compression method <code>0</code> (deflate) is the only supported compression method. This method utilizes the &quot;zlib&quot; compression scheme, which is also used for jar files; thus, the decompression (inflate) code may be shared between the jar decoding and PNG decoding implementations.  As noted in the PNG specification, the compressed data stream may comprised internally of both compressed and uncompressed (raw) data. </li> <li>The filter method represents a series of encoding schemes that may be used to optimize compression.  The PNG spec currently defines a single filter method (method <code>0</code>) that is an adaptive filtering scheme with five basic filter types.  Filtering is essential for optimal compression since it allows the deflate algorithm to exploit spatial similarities within the image.  Therefore, MIDP devices must support all five filter types defined by filter method <code>0</code>.</li> <li> MIDP devices are required to read PNG images that are encoded with either interlace method <code>0</code> (None) or interlace method <code>1</code> (Adam7).  Image loading in MIDP is synchronous and cannot be overlapped with image rendering, and so there is no advantage for an application to use interlace method <code>1</code>.  Support for decoding interlaced images is required for compatibility with PNG and for the convenience of developers who may already have interlaced images available.</li> </ul> <p>The PLTE chunk. Palette-based images must be supported.</p> <p>The IDAT chunk.  Image data may be encoded using any of the <code>5</code> filter types defined by filter method <code>0</code> (None, Sub, Up, Average, Paeth).</p> <p>The IEND chunk.  This chunk must be found in order for the image to be considered valid.</p> <h4>Ancillary Chunks</h4> <p>PNG defines several 'ancillary' chunks that may be present in a PNG image but are not critical for image decoding.</p> <p>The tRNS chunk.  All implementations must support the tRNS chunk. This chunk is used to implement transparency without providing alpha channel data for each pixel. For color types <code>0</code> and <code>2</code>, a particular gray or RGB value is defined to be a transparent pixel.  In this case, the implementation must treat pixels with this value as fully transparent. Pixel value comparison must be based on the actual pixel values using the original sample depth; that is, this comparison must be performed before the pixel values are resampled to reflect the display capabilities of the device. For color type <code>3</code> (indexed color), <code>8</code>-bit alpha values are potentially provided for each entry in the color palette.  In this case, the implementation must treat pixels with an alpha value of <code>0</code> as fully transparent, and it must treat pixels with an alpha value of <code>255</code> as fully opaque.  If rendering with alpha blending is supported, any pixels with intermediate alpha values must be carried through to the resulting image. If alpha blending is not supported, any pixels with intermediate alpha values must be replaced with fully transparent pixels.</p> <p>The implementation <em>may</em> (but is not required to) support any of the other ancillary chunks. The implementation <em>must</em> silently ignore any unsupported ancillary chunks that it encounters. The currently defined optional ancillary chunks are:</p> <PRE>    cHRM gAMA hIST iCCP iTXt pHYs    sBIT sPLT sRGB tEXt tIME zTXt </PRE> <h3>Reference</h3> <p><em>PNG (Portable Network Graphics) Specification, Version 1.0.</em> W3C Recommendation, October 1, 1996. http://www.w3.org/TR/REC-png.html. Also available as RFC 2083, http://www.ietf.org/rfc/rfc2083.txt.</p><P><DL><DT><B>Since: </B><DD>MIDP 1.0</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== 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>static&nbsp;<A HREF="../../../javax/microedition/lcdui/Image.html">Image</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Image.html#createImage(byte[], int, int)">createImage</A></B>(byte[]&nbsp;imageData,            int&nbsp;imageOffset,            int&nbsp;imageLength)</CODE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -