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

📄 sprite.html

📁 是MIDP 的API 查詢文件, 大家可以看一下裡面的index.html, 再用Package 或 Class 名字來查.
💻 HTML
📖 第 1 页 / 共 5 页
字号:
 <li>Any custom frame sequence will be discarded and the frame sequence     will revert to the default frame sequence for the new frame     set. </ul> <p> The reference point location is unchanged as a result of calling this  method, both in terms of its defined location within the Sprite and its position in the painter's coordinate system.  However, if the frame size is changed and the Sprite has been transformed, the position of  the Sprite's upper-left corner may change such that the reference  point remains stationary. <p> If the Sprite's frame size is changed by this method, the collision  rectangle is reset to its default value (i.e. it is set to the new  bounds of the untransformed Sprite). <p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>img</CODE> - the <code>Image</code> to use for <code>Sprite</code><DD><CODE>frameWidth</CODE> - the width in pixels of the individual raw frames<DD><CODE>frameHeight</CODE> - the height in pixels of the individual raw frames<DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>img</code> is <code>null</code><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>frameHeight</code> or  <code>frameWidth</code> is less than <code>1</code><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the image width is not an integer multiple of the <code>frameWidth</code><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the image height is not an integer  multiple of the <code>frameHeight</code></DL>
</DD>
</DL>
<HR>

<A NAME="defineCollisionRectangle(int, int, int, int)"><!-- --></A><H3>
defineCollisionRectangle</H3>
<PRE>
public void <B>defineCollisionRectangle</B>(int&nbsp;x,                                     int&nbsp;y,                                     int&nbsp;width,                                     int&nbsp;height)</PRE>
<DL>
<DD>Defines the Sprite's bounding rectangle that is used for collision  detection purposes.  This rectangle is specified relative to the  un-transformed Sprite's upper-left corner and defines the area that is checked for collision detection.  For pixel-level detection, only those pixels within the collision rectangle are checked.  By default, a Sprite's collision rectangle is located at 0,0 as has the same dimensions as the Sprite.  The collision rectangle may be  specified to be larger or smaller than the default rectangle; if made  larger, the pixels outside the bounds of the Sprite are considered to be transparent for pixel-level collision detection.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - the horizontal location of the collision rectangle relative to the untransformed Sprite's left edge<DD><CODE>y</CODE> - the vertical location of the collision rectangle relative to the untransformed Sprite's top edge<DD><CODE>width</CODE> - the width of the collision rectangle<DD><CODE>height</CODE> - the height of the collision rectangle<DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified <code>width</code> or <code>height</code> is less than <code>0</code></DL>
</DD>
</DL>
<HR>

<A NAME="setTransform(int)"><!-- --></A><H3>
setTransform</H3>
<PRE>
public void <B>setTransform</B>(int&nbsp;transform)</PRE>
<DL>
<DD>Sets the transform for this Sprite.  Transforms can be  applied to a Sprite to change its rendered appearance.  Transforms  are applied to the original Sprite image; they are not cumulative,  nor can they be combined.  By default, a Sprite's transform is  <A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_NONE"><CODE>TRANS_NONE</CODE></A>. <P> Since some transforms involve rotations of 90 or 270 degrees, their use may result in the overall width and height of the Sprite  being swapped.  As a result, the values returned by  <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getWidth()"><CODE>Layer.getWidth()</CODE></A> and <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getHeight()"><CODE>Layer.getHeight()</CODE></A> may change. <p> The collision rectangle is also modified by the transform so that it remains static relative to the pixel data of the Sprite.   Similarly, the defined reference pixel is unchanged by this method, but its visual location within the Sprite may change as a result. <P> This method repositions the Sprite so that the location of  the reference pixel in the painter's coordinate system does not change as a result of changing the transform.  Thus, the reference pixel  effectively becomes the centerpoint for the transform.  Consequently, the values returned by <A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#getRefPixelX()"><CODE>getRefPixelX()</CODE></A> and <A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#getRefPixelY()"><CODE>getRefPixelY()</CODE></A>  will be the same both before and after the transform is applied, but  the values returned by <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getX()"><CODE>getX()</CODE></A> and <A HREF="../../../../javax/microedition/lcdui/game/Layer.html#getY()"><CODE>getY()</CODE></A> may change.   <p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>transform</CODE> - the desired transform for this <code>Sprite</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the requested <code>transform</code> is invalid<DT><B>See Also: </B><DD><A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_NONE"><CODE>TRANS_NONE</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_ROT90"><CODE>TRANS_ROT90</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_ROT180"><CODE>TRANS_ROT180</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_ROT270"><CODE>TRANS_ROT270</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_MIRROR"><CODE>TRANS_MIRROR</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_MIRROR_ROT90"><CODE>TRANS_MIRROR_ROT90</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_MIRROR_ROT180"><CODE>TRANS_MIRROR_ROT180</CODE></A>, 
<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html#TRANS_MIRROR_ROT270"><CODE>TRANS_MIRROR_ROT270</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="collidesWith(javax.microedition.lcdui.game.Sprite, boolean)"><!-- --></A><H3>
collidesWith</H3>
<PRE>
public final boolean <B>collidesWith</B>(<A HREF="../../../../javax/microedition/lcdui/game/Sprite.html">Sprite</A>&nbsp;s,                                  boolean&nbsp;pixelLevel)</PRE>
<DL>
<DD>Checks for a collision between this Sprite and the specified Sprite. <P> If pixel-level detection is used, a collision is detected only if opaque pixels collide.  That is, an opaque pixel in the first Sprite would have to collide with an opaque  pixel in the second Sprite for a collision to be detected.  Only those pixels within the Sprites' respective collision rectangles are checked. <P> If pixel-level detection is not used, this method simply checks if the Sprites' collision rectangles intersect. <P> Any transforms applied to the Sprites are automatically accounted for. <P> Both Sprites must be visible in order for a collision to be detected. <P><DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the <code>Sprite</code> to test for collision with<DD><CODE>pixelLevel</CODE> - <code>true</code> to test for collision on a pixel-by-pixel basis, <code>false</code> to test using simple bounds checking.<DT><B>Returns:</B><DD><code>true</code> if the two Sprites have collided, otherwise <code>false</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if Sprite <code>s</code> is  <code>null</code></DL>
</DD>
</DL>
<HR>

<A NAME="collidesWith(javax.microedition.lcdui.game.TiledLayer, boolean)"><!-- --></A><H3>
collidesWith</H3>
<PRE>
public final boolean <B>collidesWith</B>(<A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.html">TiledLayer</A>&nbsp;t,                                  boolean&nbsp;pixelLevel)</PRE>
<DL>
<DD>Checks for a collision between this Sprite and the specified TiledLayer.  If pixel-level detection is used, a collision is detected only if opaque pixels collide.  That is, an opaque pixel in the Sprite would have to collide with an opaque pixel in TiledLayer for a collision to be detected.  Only those pixels within the Sprite's collision rectangle are checked. <P> If pixel-level detection is not used, this method simply checks if the Sprite's collision rectangle intersects with a non-empty cell in the TiledLayer. <P> Any transform applied to the Sprite is automatically accounted for. <P> The Sprite and the TiledLayer must both be visible in order for a collision to be detected. <P><DD><DL>
<DT><B>Parameters:</B><DD><CODE>t</CODE> - the <code>TiledLayer</code> to test for collision with<DD><CODE>pixelLevel</CODE> - <code>true</code> to test for collision on a pixel-by-pixel basis, <code>false</code> to test using simple bounds checking against non-empty cells.<DT><B>Returns:</B><DD><code>true</code> if this <code>Sprite</code> has collided with the <code>TiledLayer</code>, otherwise <code>false</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>t</code> is <code>null</code></DL>
</DD>
</DL>
<HR>

<A NAME="collidesWith(javax.microedition.lcdui.Image, int, int, boolean)"><!-- --></A><H3>
collidesWith</H3>
<PRE>
public final boolean <B>collidesWith</B>(<A HREF="../../../../javax/microedition/lcdui/Image.html">Image</A>&nbsp;image,                                  int&nbsp;x,                                  int&nbsp;y,                                  boolean&nbsp;pixelLevel)</PRE>
<DL>
<DD>Checks for a collision between this Sprite and the specified Image with its upper left corner at the specified location.  If pixel-level detection is used, a collision is detected only if opaque pixels collide.  That is, an opaque pixel in the Sprite would have to collide with an opaque  pixel in Image for a collision to be detected.  Only those pixels within the Sprite's collision rectangle are checked. <P> If pixel-level detection is not used, this method simply checks if the Sprite's collision rectangle intersects with the Image's bounds. <P> Any transform applied to the Sprite is automatically accounted for. <P> The Sprite must be visible in order for a collision to be detected. <P><DD><DL>
<DT><B>Parameters:</B><DD><CODE>image</CODE> - the <code>Image</code> to test for collision<DD><CODE>x</CODE> - the horizontal location of the <code>Image</code>'s upper left corner<DD><CODE>y</CODE> - the vertical location of the <code>Image</code>'s upper left corner<DD><CODE>pixelLevel</CODE> - <code>true</code> to test for collision on a pixel-by-pixel basis, <code>false</code> to test using simple bounds checking<DT><B>Returns:</B><DD><code>true</code> if this <code>Sprite</code> has collided with the <code>Image</code>, otherwise <code>false</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>image</code> is <code>null</code></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=2 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>&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/Sprite.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>MID Profile</strong></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../javax/microedition/lcdui/game/LayerManager.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../javax/microedition/lcdui/game/TiledLayer.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="Sprite.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;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<font size="-1"><a href="mailto:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems,  Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font>
</BODY>
</HTML>

⌨️ 快捷键说明

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