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

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

?? imageset.java

?? 大量j2me源代碼
?? JAVA
字號:
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Graphics;
import java.io.IOException;

/**
 * A container for sets of image frames; typically sprites. A single set
 * is made up of one or more states. Each state represents an animation sequence
 * including Image objects for the frames, animation timing and frame
 * dimensions. An example use of this class would be to animate a little dude.
 * If he had two states of existence, standing (which has short breathing
 * animation) and walking (which has a much longer animation). This would be
 * implemented by creating an ImageSet object and then adding two states, each
 * with their own Image array for all the animation frames (use the static
 * methods at the end of this class to load a clipped file image and then
 * extract the image frame array from it). You can then use a Sprite class
 * associated with this ImageSet to draw the character to the screen as well as
 * keep track of animation frames.
 * @author Martin J. Wells
 */
public class ImageSet
{
   private int totalStates;		// incremented by addState method only
   private Image[][] stateFrames;
   private int[] stateAnimTime, stateFrameWidth, stateFrameHeight;

   /**
    * Constructor for a new image. You will need to call addState to add the
    * various states (and their associated images and animation data) before
    * the object is really usable.
    * @param numStates The initial number of states (since ImageSet uses an
    * array internally (for speed) it costs a lot to expand the internal size
    * beyond this number -- typically you'll know the exact number of states
    * beforehand anyway. If not, the addState code will expand the array when
    * required.
    */
   public ImageSet(int numStates)
   {
      stateAnimTime = new int[numStates];
      stateFrameWidth = new int[numStates];
      stateFrameHeight = new int[numStates];
      stateFrames = new Image[numStates][];
   }

   /**
    * Adds a new state to the ImageSet including an array of images and the
    * number of milliseconds to animate the entire state (NOT each frame). If
    * this is not an animating set then just use 0 for the animtime. To animate
    * you will need to create a Sprite object linked to this ImageSet.
    * @param frames An array of javax.microedition.lcdui.Image objects.
    * @param animTime The number of milliseconds delay to animate ALL frames.
    */
   public final void addState(Image frames[], int animTime)
   {
      int state = totalStates++;

      if (state >= stateFrames.length)
      {
         // expand the number of states
         stateAnimTime = Tools.expandArray(stateAnimTime, 1);
         stateFrameWidth = Tools.expandArray(stateFrameWidth, 1);
         stateFrameHeight = Tools.expandArray(stateFrameHeight, 1);
         stateFrames = Tools.expandArray(stateFrames, 1);
      }

      stateAnimTime[state] = animTime;
      stateFrameWidth[state] = frames[0].getWidth();
      stateFrameHeight[state] = frames[0].getHeight();
      stateFrames[state] = frames;
   }

   /**
    * Gets the number of frames for a particular state in the ImageSet.
    * @param state The state you want to know about.
    * @return The number of frames in that state.
    */
   public final int getTotalFrames(int state)
   {
      return stateFrames[state].length;
   }

   /**
    * Gets the total amount time to animate all the frames of a given state.
    * Note this is not the delay per frame.
    * @param state The state you want to know about.
    * @return The animation delay (in milliseconds) corresponding to the given
    * state.
    */
   public final int getAnimTime(int state)
   {
      return stateAnimTime[state];
   }

   /**
    * Gets the amount of time to spend on each frame of a set to animate it.
    * This is just a convenience method that returns the animation time for
    * a state divided by the total number of frames.
    * @param state The state you want to know about.
    * @return The number of milliseconds delay for each frame of a given state.
    */
   public final int getAnimTimePerFrame(int state)
   {
      return stateAnimTime[state] / stateFrames[state].length;
   }

   /**
    * Draws a specific frame of this sprite onto a graphics context.
    * @param target The target graphics context to draw on.
    * @param state The state corresponding to the frame being drawn.
    * @param frame The number of the frame you want to draw.
    * @param targetX The x-position to draw the frame.
    * @param targetY The y-position to draw the frame.
    */
   public final void draw(Graphics target, int state, int frame, int targetX, int targetY)
   {
      if (stateFrames[state][frame] != null)
         target.drawImage(stateFrames[state][frame],
                          targetX, targetY, Tools.GRAPHICS_TOP_LEFT);
   }

   /**
    * Extract an Image corresponding to a particular state and frame.
    * @param state The state you're after.
    * @param frame The frame you're after.
    * @return The image corresponding to the given frame in the given state.
    */
   public final Image getFrame(int state, int frame)
   {
      return stateFrames[state][frame];
   }

   //
   // STATIC IMAGE TOOLS
   //

   /**
    * Static utility method to loap up a portion of an image from a file. Note
    * that the file must be in your JAR (or otherwise accessible) by the MID in
    * order to be loaded.
    * @param filename The name of the resource file to load.
    * @param originX The starting x position of the file image you want to load.
    * @param originY The starting y position of the file image you want to load.
    * @param width The width of the image you want to clip to.
    * @param height The height of the image you want to clip to.
    * @return A new Image object containing only the rectangle of originX,
    * originY, width and depth.
    */
   public final static Image loadClippedImage(String filename, int originX, int originY, int width,
                                              int height)
   {
      try
      {
         // load full image from file and create a mutable version
         Image fileImage = Image.createImage(filename);
         // use the getImageRegion method to extract out only the bit we want.
         return getImageRegion(fileImage, originX, originY, width, height);
      }

      catch (IOException ioe)
      {
         System.out.println("can't load file: " + filename);
         return null;
      }
   }

   /**
    * Static utility method to loap up a portion of an image from a file. Note
    * that the file must be in your JAR (or otherwise accessible) by the MID in
    * order to be loaded. The width and height of the portion is assumed to be
    * the size of the file image.
    * @param filename The name of the resource file to load.
    * @param originX The starting x position of the file image you want to load.
    * @param originY The starting y position of the file image you want to load.
    * @return A new Image object containing only the rectangle starting at
    * originX, originY.
    */
   public final static Image loadClippedImage(String filename, int originX, int originY)
   {
      try
      {
         // load full image from file and create a mutable version
         Image fileImage = Image.createImage(filename);

         // shortcut out of here so we can avoid creating another image if they
         // are just using this method to load an image normally (no clipping).
         if (originX == 0 && originY == 0) return fileImage;

         // use the getImageRegion method to extract out only the bit we want.
         return getImageRegion(fileImage, originX, originY, fileImage.getWidth(), fileImage.getHeight());
      }

      catch (IOException ioe)
      {
         System.out.println("can't load file: " + filename);
         return null;
      }
   }

   /**
    * Extracts a portion of an image using clipping.
    * @param source The source image.
    * @param x The starting x position of the clipping rectangle.
    * @param y The starting y position of the clipping rectangle.
    * @param width The width of the clipping rectangle.
    * @param height The height of the clipping rectangle.
    * @return A new Image object containing only the portion of the image
    * withing the x, y, width, height rectangle.
    */
   public final static Image getImageRegion(Image source, int x, int y, int width, int height)
   {
      // create a placeholder for our resulting image region
      Image result = Image.createImage(width, height);

      if (x + width > source.getWidth() || y + height > source.getHeight())
         System.out.println("Warning: attempting extract using (" +
                            x + "," + y + "," + width + "," + height + ") when image is " +
                            "(" + source.getWidth() + "," + source.getHeight() + ")");

      // draw the image, offset by the region starting position
      result.getGraphics().drawImage(source, -x, -y, Tools.GRAPHICS_TOP_LEFT);

      return result;
   }

   /**
    * Gets an array of images by breaking a larger image into smaller frames.
    * @param sourceImage The image to extract the frames from.
    * @param sourceX The starting x position in the source image to use.
    * @param sourceY The starting y position in the source image to use.
    * @param framesWide The number of frames across the source image to extract.
    * @param framesHigh The number of frames down the source image to extract.
    * @param frameWidth The width of each of those frames.
    * @param frameHeight The height of each of those frames.
    * @return An array containing an image for each frame.
    */
   public final static Image[] extractFrames(Image sourceImage, int sourceX,
                                             int sourceY,
                                             int framesWide, int framesHigh,
                                             int frameWidth, int frameHeight)
   {
      // extract all the frames from the source image
      Image[] frames = new Image[framesWide * framesHigh];
      int frameCount = 0;

      for (int fy = 0; fy < framesHigh; fy++)
         for (int fx = 0; fx < framesWide; fx++)
            frames[frameCount++] =
                    getImageRegion(sourceImage, sourceX + (fx * frameWidth),
                                   sourceY + (fy * frameHeight),
                                   frameWidth, frameHeight);
      return frames;
   }


}











?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人精品一区二区三区四区| 欧美成人a∨高清免费观看| 在线观看av一区| 在线成人高清不卡| 日韩欧美一二三四区| 国产日本欧洲亚洲| 亚洲一区av在线| 激情综合一区二区三区| av午夜一区麻豆| 欧美日韩国产免费一区二区 | 亚洲成人动漫一区| 精品一二三四在线| 91久久精品一区二区二区| 欧美一级夜夜爽| 国产精品国产自产拍高清av| 亚洲第一激情av| 国产在线精品一区在线观看麻豆| 欧美影片第一页| 久久婷婷国产综合精品青草| 亚洲精品伦理在线| 国内精品写真在线观看| 色屁屁一区二区| 精品88久久久久88久久久| 亚洲色欲色欲www在线观看| 蜜桃视频在线观看一区二区| av成人免费在线观看| 欧美一区在线视频| 玉足女爽爽91| 国产91丝袜在线播放| 在线成人午夜影院| 亚洲精品成a人| 成人性生交大合| 精品欧美久久久| 亚洲a一区二区| fc2成人免费人成在线观看播放| 日韩精品一区国产麻豆| 亚洲图片有声小说| 99视频在线观看一区三区| 亚洲欧美日韩在线| 精品一区二区三区在线观看 | 日本v片在线高清不卡在线观看| a美女胸又www黄视频久久| 精品久久久久久久久久久久久久久久久 | 激情五月婷婷综合| 欧美丝袜丝交足nylons| 国产精品国产自产拍高清av王其| 激情深爱一区二区| 久久99国产精品久久99果冻传媒| 成人app软件下载大全免费| 日韩欧美在线不卡| 亚洲一区av在线| 91蜜桃视频在线| 国产欧美日韩在线| 久久爱另类一区二区小说| 欧美一区二区三区喷汁尤物| 亚洲一区二区三区四区中文字幕| 波多野结衣精品在线| 精品久久久久久综合日本欧美| 丝袜美腿亚洲综合| 欧美日韩精品专区| 亚洲一二三四区| 欧美在线一区二区| 一区二区在线看| 色综合久久久久网| ...xxx性欧美| 色综合一个色综合亚洲| 成人欧美一区二区三区小说| 99热国产精品| 亚洲色图视频网站| 91女人视频在线观看| 中文字幕视频一区二区三区久| k8久久久一区二区三区| 综合久久久久久| 91香蕉视频污在线| 亚洲免费色视频| 欧洲精品一区二区三区在线观看| 亚洲精品乱码久久久久久久久| 91久久一区二区| 亚洲三级在线看| 一本大道av一区二区在线播放| 亚洲日本电影在线| 欧美性xxxxxxxx| 日韩综合在线视频| 日韩视频一区二区在线观看| 日本不卡一二三| 久久无码av三级| 波多野结衣亚洲| 亚洲夂夂婷婷色拍ww47| 欧美另类变人与禽xxxxx| 丝袜美腿成人在线| 精品国产伦理网| 国产91精品入口| 综合久久国产九一剧情麻豆| 欧美午夜宅男影院| 青草av.久久免费一区| 精品久久久久久最新网址| 国产不卡在线一区| 一区二区三区中文字幕精品精品| 欧美日韩专区在线| 久久精品国产澳门| 中文字幕免费不卡在线| 色播五月激情综合网| 三级欧美在线一区| 久久久久国产精品麻豆ai换脸| av午夜精品一区二区三区| 亚洲综合色成人| 精品少妇一区二区三区在线视频| 国产成人8x视频一区二区| 一区二区久久久| 欧美videofree性高清杂交| 国产91丝袜在线播放0| 一区二区三区美女视频| 日韩欧美卡一卡二| av电影天堂一区二区在线 | 欧美最猛性xxxxx直播| 亚洲妇女屁股眼交7| 精品国产1区2区3区| av电影天堂一区二区在线| 日韩黄色免费电影| 国产精品久久夜| 9191国产精品| 成人精品视频一区| 首页亚洲欧美制服丝腿| 国产欧美一区二区三区在线看蜜臀 | 欧美一区二区三区视频在线| 国产99久久久久久免费看农村| 一个色综合网站| 久久日韩粉嫩一区二区三区| 欧美午夜精品久久久久久超碰| 久久 天天综合| 亚洲最新在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 日本韩国精品一区二区在线观看| 久久丁香综合五月国产三级网站| 亚洲天堂a在线| 精品动漫一区二区三区在线观看| 一本色道久久综合狠狠躁的推荐| 国产一区在线看| 日日骚欧美日韩| 美女网站色91| 亚洲乱码一区二区三区在线观看| 日韩欧美成人激情| 欧美日韩一区成人| eeuss国产一区二区三区| 久久成人精品无人区| 亚洲线精品一区二区三区八戒| 中文字幕+乱码+中文字幕一区| 日韩免费看网站| 欧美日韩在线三级| www.爱久久.com| 国产高清精品久久久久| 蜜臀精品久久久久久蜜臀| 亚洲一卡二卡三卡四卡无卡久久 | 色婷婷综合激情| 国产成人午夜高潮毛片| 精品一区二区日韩| 蜜桃视频在线观看一区| 亚洲成人av免费| 一个色综合网站| 亚洲精品ww久久久久久p站| 国产精品毛片久久久久久| 国产视频在线观看一区二区三区| 日韩久久免费av| 欧美高清视频不卡网| 欧美在线一二三四区| 91蜜桃免费观看视频| 不卡视频在线看| 成人丝袜18视频在线观看| 国产精品综合网| 国产一区二区成人久久免费影院 | 欧美国产97人人爽人人喊| 精品国产精品网麻豆系列| 日韩欧美一区二区久久婷婷| 制服丝袜成人动漫| 欧美精品三级在线观看| 欧美日韩国产区一| 欧美精品成人一区二区三区四区| 欧美影院一区二区| 欧美在线免费观看视频| 欧美视频在线观看一区二区| 最新国产成人在线观看| 欧美电影免费观看高清完整版在线观看 | 日本一区二区不卡视频| 久久久久久97三级| 国产日韩v精品一区二区| 国产午夜亚洲精品午夜鲁丝片| 久久久精品人体av艺术| 亚洲国产经典视频| 中文字幕一区二区三区四区| 亚洲欧美日韩精品久久久久| 一区二区三区欧美亚洲| 亚洲一卡二卡三卡四卡无卡久久 | 日韩一级免费观看| 日韩精品一区二区三区视频播放| 亚洲精品一区在线观看| 国产三级精品三级在线专区| 中文字幕日本乱码精品影院| 亚洲综合激情另类小说区| 五月天中文字幕一区二区| 青青青伊人色综合久久|