📄 image2d.html
字号:
public <B>Image2D</B>(int format, int width, int height, byte[] image, byte[] palette)</PRE>
<DL>
<DD><p>Constructs an immutable Image2D by copying palette indices from a byte array, and the palette entries from another byte array.</p> <p>Pixels in <code>image</code> are ordered from left to right and top to bottom. Each pixel is composed of one byte, representing a palette index.</p> <p>The palette consists of 256 entries, all with the same number of color components. The number and ordering of the color components is determined by the specified format; see the symbolic constants listed above. Note that a palette consisting of only alpha or luminance values is also allowed.</p> <p>The palette entries are copied in from the <code>palette</code> array, starting at index 0. If the array has N entries, N < 256, the remaining entries [N, 255] are left undefined. If the array has more than 256 entries, only the first 256 are copied in.</p>
<P>
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the internal pixel format of the new Image2D<DD><CODE>width</CODE> - width of the created image in pixels; must be positive<DD><CODE>height</CODE> - height of the created image in pixels; must be positive<DD><CODE>image</CODE> - pixel data as a byte array, one byte per pixel<DD><CODE>palette</CODE> - palette entries as a byte array<DT><B>Throws:</B><DD><CODE>java.lang.NullPointerException</CODE> - if <code>image</code> is null<DD><CODE>java.lang.NullPointerException</CODE> - if <code>palette</code> is null<DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>width <= 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>height <= 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>format</code> is not one of the symbolic constants listed above<DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>image.length < width*height</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>(palette.length < 256*C) && ((palette.length % C) != 0)</code>, where C is the number of color components (for instance, 3 for RGB)</DL>
<HR>
<A NAME="Image2D(int, int, int)"><!-- --></A><H3>
Image2D</H3>
<PRE>
public <B>Image2D</B>(int format, int width, int height)</PRE>
<DL>
<DD><p>Constructs an empty, mutable Image2D with the given dimensions. All pixels in the image are initialized to opaque white. The image contents can be set later by using the image as a rendering target in Graphics3D, or by using the <code>set</code> method. Note that only <code>RGB</code> and <code>RGBA</code> images can be used as rendering targets.</p>
<P>
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the internal pixel format of the new Image2D<DD><CODE>width</CODE> - width of the created image in pixels; must be positive<DD><CODE>height</CODE> - height of the created image in pixels; must be positive<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>width <= 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>height <= 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>format</code> is not one of the symbolic constants listed above</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="set(int, int, int, int, byte[])"><!-- --></A><H3>
set</H3>
<PRE>
public void <B>set</B>(int x, int y, int width, int height, byte[] image)</PRE>
<DL>
<DD><p>Updates a rectangular area of this Image2D by copying pixels from a byte array. This method is only available for mutable images.</p> <p>The area that is to be updated is specified in pixels, relative to the upper left corner of this Image2D. The area must lie completely within the bounds of the image.</p> <p>Pixels in <code>image</code> are ordered from left to right and top to bottom. The number of bytes per pixel and the order of components are determined by the specified internal format; see the symbolic constants listed above.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - the X coordinate of the area to update, relative to the top left corner<DD><CODE>y</CODE> - the Y coordinate of the area to update, relative to the top left corner<DD><CODE>width</CODE> - width of the area in the image to update, in pixels<DD><CODE>height</CODE> - height of the area in the image to update, in pixels<DD><CODE>image</CODE> - pixel data as a byte array<DT><B>Throws:</B><DD><CODE>java.lang.NullPointerException</CODE> - if <code>image</code> is null<DD><CODE>java.lang.IllegalStateException</CODE> - if this Image2D is immutable<DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>x < 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>y < 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>width <= 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>height <= 0</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>(x + width) > getWidth</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>(y + height) > getHeight</code><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>image.length < width * height * bpp</code>, where <code>bpp</code> is the number of bytes per pixel (depends on the internal format specified at construction)</DL>
</DD>
</DL>
<HR>
<A NAME="isMutable()"><!-- --></A><H3>
isMutable</H3>
<PRE>
public boolean <B>isMutable</B>()</PRE>
<DL>
<DD><p>Queries whether this Image2D is mutable. The contents of a mutable image can be changed after construction, while the contents of an immutable image can not.</p>
<P>
<DD><DL>
<DT><B>Returns:</B><DD><i>true</i> if this Image2D is mutable; <i>false</i> if it is immutable</DL>
</DD>
</DL>
<HR>
<A NAME="getFormat()"><!-- --></A><H3>
getFormat</H3>
<PRE>
public int <B>getFormat</B>()</PRE>
<DL>
<DD><p>Gets the internal format of this Image2D. Note that the format can not be changed after construction.</p>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the internal format of this Image2D; one of the symbolic constants listed above</DL>
</DD>
</DL>
<HR>
<A NAME="getWidth()"><!-- --></A><H3>
getWidth</H3>
<PRE>
public int <B>getWidth</B>()</PRE>
<DL>
<DD><p>Gets the width of this Image2D, in pixels. Note that the width and height can not be changed after construction.</p>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the width of this image</DL>
</DD>
</DL>
<HR>
<A NAME="getHeight()"><!-- --></A><H3>
getHeight</H3>
<PRE>
public int <B>getHeight</B>()</PRE>
<DL>
<DD><p>Gets the height of this Image2D, in pixels. Note that the width and height can not be changed after construction.</p>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the height of this image</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_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/Image2D.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>
<EM><B>Nov 19, 2003</B></EM></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/microedition/m3g/Group.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/m3g/IndexBuffer.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="Image2D.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <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>
<EM>Copyright © 2003 Nokia Corporation. See the <a href="../../../overview-summary.html#Copyright">Copyright Notice</a> for details.</EM>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -