亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sprite.java

?? 這是j2me里MIDP2.0中game包的源代碼
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/* * @(#)Sprite.java	1.110 02/10/01 @(#) * * Copyright (c) 2002 Sun Microsystems, Inc.  All rights reserved. * PROPRIETARY/CONFIDENTIAL * Use is subject to license terms. */package javax.microedition.lcdui.game;import javax.microedition.lcdui.Image;import javax.microedition.lcdui.Graphics;/** * A Sprite is a basic visual element that can be rendered with one of * several frames stored in an Image; different frames can be shown to  * animate the Sprite.  Several transforms such as flipping and rotation * can also be applied to a Sprite to further vary its appearance.  As with * all Layer subclasses, a Sprite's location can be changed and it can also * be made visible or invisible. * <P> * <h3>Sprite Frames</h3> * The raw frames used to render a Sprite are provided in a single Image * object, which may be mutable or immutable.  If more than one frame is used, * the Image is broken up into a series of equally-sized frames of a specified * width and height.  As shown in the figure below, the same set of frames may * be stored in several different arrangements depending on what is the most  * convenient for the game developer.   * <br> * <center><img src="doc-files/frames.gif" width=777 height=402  * ALT="Sprite Frames"></center> * <br> * <p> * Each frame is assigned a unique index number.  The frame located in the * upper-left corner of the Image is assigned an index of 0.  The remaining  * frames are then numbered consecutively in row-major order (indices are  * assigned across the first row, then the second row, and so on).  The method * {@link #getRawFrameCount()} returns the total number of raw frames. * <P> * <h3>Frame Sequence</h3> * A Sprite's frame sequence defines an ordered list of frames to be displayed. * The default frame sequence mirrors the list of available frames, so  * there is a direct mapping between the sequence index and the corresponding * frame index.  This also means that the length of the default frame sequence * is equal to the number of raw frames.  For example, if a Sprite has 4  * frames, its default frame sequence is {0, 1, 2, 3}.   * <center><img src="doc-files/defaultSequence.gif" width=182 height=269  * ALT="Default Frame Sequence"></center> * <P> * The developer must manually switch the current frame in the frame sequence. * This may be accomplished by calling {@link #setFrame},  * {@link #prevFrame()}, or {@link #nextFrame()}.  Note that these methods  * always operate on the sequence index, they do not operate on frame indices; * however, if the default frame sequence is used, then the sequence indices * and the frame indices are interchangeable. * <P> * If desired, an arbitrary frame sequence may be defined for a Sprite.   * The frame sequence must contain at least one element, and each element must * reference a valid frame index.  By defining a new frame sequence, the  * developer can conveniently display the Sprite's frames in any order  * desired; frames may be repeated, omitted, shown in reverse order, etc. * <P> * For example, the diagram below shows how a special frame sequence might be * used to animate a mosquito.  The frame sequence is designed so that the  * mosquito flaps its wings three times and then pauses for a moment before  * the cycle is repeated. * <center><img src="doc-files/specialSequence.gif" width=346 height=510  * ALT="Special Frame Sequence"></center> * By calling {@link #nextFrame} each time the display is updated, the  * resulting animation would like this: * <br> * <center><img src="doc-files/sequenceDemo.gif" width=96 height=36></center> * <P> * <h3>Reference Pixel</h3> * Being a subclass of Layer, Sprite inherits various methods for setting and * retrieving its location such as {@link #setPosition setPosition(x,y)},  * {@link #getX getX()}, and {@link #getY getY()}.  These methods all define * position in terms of the upper-left corner of the Sprite's visual bounds; * however, in some cases, it is more convenient to define the Sprite's position * in terms of an arbitrary pixel within its frame, especially if transforms * are applied to the Sprite. * <P> * Therefore, Sprite includes the concept of a <em>reference pixel</em>.     * The reference pixel is defined by specifying its location in the * Sprite's untransformed frame using  * {@link #defineReferencePixel defineReferencePixel(x,y)}.   * By default, the reference pixel is defined to be the pixel at (0,0)  * in the frame.  If desired, the reference pixel may be defined outside  * of the frame's bounds.     * <p> * In this example, the reference pixel is defined to be the pixel that * the monkey appears to be hanging from: * <p> * <center><img src="doc-files/refpixel.gif" width=304 height=199 * ALT="Defining The Reference Pixel"></center> * <p> * {@link #getRefPixelX getRefPixelX()} and {@link #getRefPixelY getRefPixelY()} * can be used to query the location of the reference pixel in the painter's  * coordinate system.  The developer can also use  * {@link #setRefPixelPosition setRefPixelPosition(x,y)} to position the Sprite  * so that reference pixel appears at a specific location in the painter's * coordinate system.  These methods automatically account for any transforms * applied to the Sprite. * <p> * In this example, the reference pixel's position is set to a point at the end  * of a tree branch; the Sprite's location changes so that the reference pixel * appears at this point and the monkey appears to be hanging from the branch: * <p> * <center><img src="doc-files/setrefposition.gif" width=332 height=350 * ALT="Setting The Reference Pixel Position"></center> * <p> * <a name="transforms"></a> * <h3>Sprite Transforms</h3> * Various transforms can be applied to a Sprite.  The available transforms * include rotations in multiples of 90 degrees, and mirrored (about * the vertical axis) versions of each of the rotations.  A Sprite's transform  * is set by calling {@link #setTransform setTransform(transform)}. * <p> * <center><img src="doc-files/transforms.gif" width=355 height=575  * ALT="Transforms"></center> * <br> * When a transform is applied, the Sprite is automatically repositioned  * such that the  reference pixel appears stationary in the painter's  * coordinate system.  Thus, the reference pixel effectively becomes the * center of the transform operation.  Since the reference pixel does not * move, the values returned by {@link #getRefPixelX()} and  * {@link #getRefPixelY()} remain the same; however, the values returned by * {@link #getX getX()} and {@link #getY getY()} may change to reflect the  * movement of the Sprite's upper-left corner. * <p> * Referring to the monkey example once again, the position of the  * reference pixel remains at (48, 22) when a 90 degree rotation * is applied, thereby making it appear as if the monkey is swinging * from the branch: * <p> * <center><img src="doc-files/transcenter.gif" width=333 height=350 * ALT="Transform Center"></center> * <p> * <h3>Sprite Drawing</h3> * Sprites can be drawn at any time using the {@link #paint(Graphics)} method.   * The Sprite will be drawn on the Graphics object according to the current  * state information maintained by the Sprite (i.e. position, frame,  * visibility).  Erasing the Sprite is always the responsibility of code  * outside the Sprite class.<p> * <p> * Sprites can be implemented using whatever techniques a manufacturers  * wishes to use (e.g hardware acceleration may be used for all Sprites, for * certain sizes of Sprites, or not at all). * <p> * For some platforms, certain Sprite sizes may be more efficient than others; * manufacturers may choose to provide developers with information about * device-specific characteristics such as these. * <p> * @since MIDP 2.0  */public class Sprite extends Layer{    // ----- definitions for the various transformations possible -----    /**     * No transform is applied to the Sprite.       * This constant has a value of <code>0</code>.     */    public static final int TRANS_NONE = 0;        /**     * Causes the Sprite to appear rotated clockwise by 90 degrees.     * This constant has a value of <code>5</code>.     */    public static final int TRANS_ROT90 = 5;    /**     * Causes the Sprite to appear rotated clockwise by 180 degrees.     * This constant has a value of <code>3</code>.     */    public static final int TRANS_ROT180 = 3;    /**     * Causes the Sprite to appear rotated clockwise by 270 degrees.     * This constant has a value of <code>6</code>.     */    public static final int TRANS_ROT270 = 6;    /**     * Causes the Sprite to appear reflected about its vertical     * center.     * This constant has a value of <code>2</code>.     */    public static final int TRANS_MIRROR = 2;    /**     * Causes the Sprite to appear reflected about its vertical     * center and then rotated clockwise by 90 degrees.     * This constant has a value of <code>7</code>.     */    public static final int TRANS_MIRROR_ROT90 = 7;    /**     * Causes the Sprite to appear reflected about its vertical     * center and then rotated clockwise by 180 degrees.     * This constant has a value of <code>1</code>.     */    public static final int TRANS_MIRROR_ROT180 = 1;    /**     * Causes the Sprite to appear reflected about its vertical     * center and then rotated clockwise by 270 degrees.     * This constant has a value of <code>4</code>.     */    public static final int TRANS_MIRROR_ROT270 = 4;    // ----- Constructors -----    /**     * Creates a new non-animated Sprite using the provided Image.       * This constructor is functionally equivalent to calling     * <code>new Sprite(image, image.getWidth(), image.getHeight())</code>     * <p>     * By default, the Sprite is visible and its upper-left      * corner is positioned at (0,0) in the painter's coordinate system.     * <br>     * @param image the <code>Image</code> to use as the single frame     * for the </code>Sprite     * @throws NullPointerException if <code>img</code> is <code>null</code>     */    public Sprite(Image image) {        super(image.getWidth(), image.getHeight());	initializeFrames(image, image.getWidth(), image.getHeight(), false);	// initialize collision rectangle	initCollisionRectBounds();	// current transformation is TRANS_NONE	this.setTransformImpl(TRANS_NONE);    }    /**     * Creates a new animated Sprite using frames contained in      * the provided Image.  The frames must be equally sized, with the      * dimensions specified by <code>frameWidth</code> and      * <code>frameHeight</code>.  They may be laid out in the image      * horizontally, vertically, or as a grid.  The width of the source      * image must be an integer multiple of the frame width, and the height     * of the source image must be an integer multiple of the frame height.     * The  values returned by {@link Layer#getWidth} and      * {@link Layer#getHeight} will reflect the frame width and frame height     * subject to the Sprite's current transform.     * <p>     * Sprites have a default frame sequence corresponding to the raw frame     * numbers, starting with frame 0.  The frame sequence may be modified     * with {@link #setFrameSequence(int[])}.     * <p>     * By default, the Sprite is visible and its upper-left corner is      * positioned at (0,0) in the painter's coordinate system.     * <p>     * @param image the <code>Image</code> to use for <code>Sprite</code>     * @param frameWidth the <code>width</code>, in pixels, of the     * individual raw frames     * @param frameHeight the <code>height</code>, in pixels, of the     * individual raw frames     * @throws NullPointerException if <code>img</code> is <code>null</code>     * @throws IllegalArgumentException if <code>frameHeight</code> or     * <code>frameWidth</code> is less than <code>1</code>     * @throws IllegalArgumentException if the <code>image</code>     * width is not an integer multiple of the <code>frameWidth</code>     * @throws IllegalArgumentException if the <code>image</code>     * height is not an integer multiple of the <code>frameHeight</code>     */    public Sprite(Image image, int frameWidth, int frameHeight) {        super(frameWidth, frameHeight);        // if img is null img.getWidth() will throw NullPointerException        if ((frameWidth < 1 || frameHeight < 1) ||	    ((image.getWidth() % frameWidth) != 0) ||            ((image.getHeight() % frameHeight) != 0)) {             throw new IllegalArgumentException();	}	// construct the array of images that 	// we use as "frames" for the sprite.        // use default frame , sequence index = 0          initializeFrames(image, frameWidth, frameHeight, false);	// initialize collision rectangle	initCollisionRectBounds();	// current transformation is TRANS_NONE	this.setTransformImpl(TRANS_NONE);    }    /**     * Creates a new Sprite from another Sprite.  <p>     *     * All instance attributes (raw frames, position, frame sequence, current     * frame, reference point, collision rectangle, transform, and visibility)      * of the source Sprite are duplicated in the new Sprite.       *     * @param s the <code>Sprite</code> to create a copy of     * @throws NullPointerException if <code>s</code> is <code>null</code>     *     */    public Sprite(Sprite s) {	super(s != null ? s.getWidth() : 0,                     s != null ? s.getHeight() : 0);        if (s == null) {	    throw new NullPointerException();        }        this.sourceImage = Image.createImage(s.sourceImage);	this.numberFrames = s.numberFrames;	this.frameCoordsX = new int[this.numberFrames];	this.frameCoordsY = new int[this.numberFrames];        System.arraycopy(s.frameCoordsX, 0, 			 this.frameCoordsX, 0,			 s.getRawFrameCount());        System.arraycopy(s.frameCoordsY, 0, 			 this.frameCoordsY, 0,			 s.getRawFrameCount());        this.x = s.getX();        this.y = s.getY();	// these fields are set by defining a reference point	this.dRefX = s.dRefX;	this.dRefY = s.dRefY;	// these fields are set when defining a collision rectangle	this.collisionRectX = s.collisionRectX;	this.collisionRectY = s.collisionRectY;	this.collisionRectWidth = s.collisionRectWidth;	this.collisionRectHeight = s.collisionRectHeight;	// these fields are set when creating a Sprite from an Image	this.srcFrameWidth = s.srcFrameWidth;	this.srcFrameHeight = s.srcFrameHeight;	// the above fields are used in setTransform()	// which is why we set them first, then  call setTransformImpl() 	// to set up internally used data structures.	setTransformImpl(s.t_currentTransformation);        this.setVisible(s.isVisible()); 	this.frameSequence = new int[s.getFrameSequenceLength()];        this.setFrameSequence(s.frameSequence);        this.setFrame(s.getFrame());        this.setRefPixelPosition(s.getRefPixelX(), s.getRefPixelY());	    }    // ----- public methods -----    /**     * Defines the reference pixel for this Sprite.  The pixel is     * defined by its location relative to the upper-left corner of     * the Sprite's un-transformed frame, and it may lay outside of     * the frame's bounds.     * <p>     * When a transformation is applied, the reference pixel is     * defined relative to the Sprite's initial upper-left corner

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久国产字幕高潮| 国产精品国模大尺度视频| 欧美成人精精品一区二区频| 欧美精品一区二区精品网| 国产欧美精品在线观看| 亚洲女同女同女同女同女同69| 三级一区在线视频先锋 | 亚洲成人av一区二区三区| 日韩精品亚洲一区二区三区免费| 狠狠色狠狠色合久久伊人| 99国产精品久久久久久久久久久 | 亚洲国产日日夜夜| 紧缚奴在线一区二区三区| 99久久综合国产精品| 欧美一级欧美三级在线观看| 国产精品看片你懂得| 日本三级亚洲精品| av电影天堂一区二区在线| 欧美一级在线观看| 伊人夜夜躁av伊人久久| 狠狠色丁香九九婷婷综合五月| 在线亚洲免费视频| 国产三级三级三级精品8ⅰ区| 丝袜诱惑制服诱惑色一区在线观看 | 日韩成人伦理电影在线观看| 国产精品一区不卡| 欧美色偷偷大香| 亚洲欧洲精品天堂一级| 国内欧美视频一区二区| 9191久久久久久久久久久| 亚洲人成影院在线观看| 国产成人精品一区二区三区四区| 色综合久久久久综合体桃花网| 欧美日韩三级在线| 国产精品三级视频| 国产一区二区三区免费观看| 欧美丰满高潮xxxx喷水动漫| 亚洲欧洲韩国日本视频| 懂色av中文字幕一区二区三区| 欧美tickle裸体挠脚心vk| 天堂蜜桃91精品| 7777精品伊人久久久大香线蕉完整版 | eeuss影院一区二区三区 | 国产精品99久久久| 精品99999| 蜜桃av一区二区三区| 欧美精品色综合| 亚洲成a人v欧美综合天堂下载| 色美美综合视频| 国产精品黄色在线观看| aaa亚洲精品| 亚洲人成人一区二区在线观看 | 色8久久人人97超碰香蕉987| 国产精品免费av| 成人国产在线观看| 国产精品成人一区二区艾草 | 日韩女优电影在线观看| 蜜桃久久久久久久| 精品国产髙清在线看国产毛片| 久久国产婷婷国产香蕉| 欧美xxxx老人做受| 国产一区二区精品久久99| 久久免费的精品国产v∧| 国产精品亚洲成人| 国产精品人成在线观看免费 | 精品在线观看视频| 久久精品一区二区三区不卡| 高清成人免费视频| 国产精品欧美一区二区三区| 99精品在线免费| 午夜精品一区在线观看| 日韩女优毛片在线| 成人免费毛片高清视频| 一区二区三区在线视频观看| 欧美日本在线一区| 久久99精品国产麻豆婷婷洗澡| 久久久久久久电影| 91香蕉视频mp4| 日韩有码一区二区三区| 精品久久久久久亚洲综合网| 成人一区二区三区中文字幕| 伊人色综合久久天天人手人婷| 欧美一区二区在线免费播放 | 亚洲成人av电影在线| 欧美一二三四在线| 粉嫩绯色av一区二区在线观看| 亚洲三级在线免费观看| 制服丝袜中文字幕亚洲| 国产高清精品在线| 午夜一区二区三区视频| 久久久久久久久久久电影| 色噜噜狠狠成人中文综合| 日本麻豆一区二区三区视频| 国产精品久久久久久久久免费桃花| 欧美在线观看你懂的| 国模一区二区三区白浆| 亚洲国产视频a| 国产精品视频一区二区三区不卡| 欧美日韩一区中文字幕| 丰满放荡岳乱妇91ww| 丝袜美腿亚洲一区二区图片| 中文字幕欧美三区| 7777精品伊人久久久大香线蕉的| 成人一级视频在线观看| 蜜臀av性久久久久av蜜臀妖精| 日韩码欧中文字| 精品精品国产高清一毛片一天堂| 91丝袜高跟美女视频| 精品一区二区在线播放| 亚洲一区二区三区中文字幕 | 国产精品丝袜久久久久久app| 91精品欧美综合在线观看最新| 成人激情视频网站| 久久69国产一区二区蜜臀| 亚洲一区国产视频| 亚洲欧洲三级电影| 久久久久久黄色| 欧美成人艳星乳罩| 欧美日韩激情一区二区三区| a在线欧美一区| 国内精品国产成人国产三级粉色| 丝袜亚洲另类欧美综合| 亚洲精品国产视频| 国产精品久久久久国产精品日日| 精品福利二区三区| 日韩一区二区不卡| 欧美嫩在线观看| 欧美性三三影院| 在线免费不卡视频| 9人人澡人人爽人人精品| 国产精品88av| 国产成人欧美日韩在线电影| 极品销魂美女一区二区三区| 人人狠狠综合久久亚洲| 日日夜夜一区二区| 亚洲成人精品在线观看| 亚洲综合区在线| 亚洲午夜精品在线| 亚洲sss视频在线视频| 亚洲国产精品一区二区久久 | 精品成人一区二区| 精品剧情v国产在线观看在线| 欧美一区二区三区电影| 日韩三级.com| 日韩三级在线观看| 久久嫩草精品久久久久| 国产性色一区二区| 中文字幕国产一区二区| 国产精品美女久久久久久2018 | 91亚洲国产成人精品一区二三| 99re这里只有精品视频首页| 91丨porny丨中文| 欧美亚洲综合久久| 51精品视频一区二区三区| 在线不卡中文字幕| 日韩精品一区二区三区在线观看 | 一区二区视频免费在线观看| 亚洲精品免费播放| 亚洲福利视频一区| 日本一道高清亚洲日美韩| 卡一卡二国产精品| 成人av片在线观看| 欧美三级日韩三级| 欧美成人免费网站| 中文字幕一区在线| 亚洲福利视频导航| 国产自产v一区二区三区c| 丁香啪啪综合成人亚洲小说 | 日本韩国欧美一区二区三区| 欧美图区在线视频| 日韩精品在线一区二区| 国产精品久久国产精麻豆99网站| 亚洲欧美日韩国产手机在线 | 麻豆国产精品官网| 99视频一区二区| 欧美精三区欧美精三区| 久久亚洲二区三区| 一区二区三区精品视频| 久久99精品久久久久久动态图| 不卡电影一区二区三区| 欧美日韩国产一级| 欧美韩国日本一区| 强制捆绑调教一区二区| av在线一区二区三区| 日韩欧美一区二区三区在线| 亚洲人成在线观看一区二区| 美女视频网站久久| 91老师片黄在线观看| 精品1区2区在线观看| 亚洲综合在线电影| 高清免费成人av| 91精品国产综合久久蜜臀| 国产精品久久久久一区| 美日韩一区二区三区| 91污片在线观看| 国产三区在线成人av| 乱一区二区av| 欧美亚洲国产一区在线观看网站| 国产欧美精品在线观看| 久久99精品久久久|