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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 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;
   }


}











?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
九九精品一区二区| 国内精品免费在线观看| 亚洲国产美国国产综合一区二区| 国产精品电影一区二区| 日韩一区二区三区免费观看| 毛片不卡一区二区| 中文字幕成人av| 亚洲国产欧美在线| 精品国产一区二区三区忘忧草 | 综合精品久久久| 国产欧美日韩精品在线| 精品国产91亚洲一区二区三区婷婷| 久久午夜国产精品| 成人永久aaa| 2021国产精品久久精品 | 免费人成在线不卡| 国产米奇在线777精品观看| 五月天一区二区三区| 欧美一区中文字幕| 麻豆高清免费国产一区| 91精品久久久久久久久99蜜臂| 日韩 欧美一区二区三区| 自拍av一区二区三区| 国产日韩亚洲欧美综合| 国产精品女人毛片| 性做久久久久久免费观看| 日本一不卡视频| 成人一区二区在线观看| 国产日产欧美一区二区三区| 国产欧美一区二区精品婷婷 | 91天堂素人约啪| 欧美三区在线观看| 老司机精品视频线观看86| 国产日韩欧美综合一区| 欧美性高清videossexo| 激情综合色播五月| 一区二区在线免费| 久久久久久久久久久久久久久99| 成人av动漫在线| 久久av资源站| 亚洲午夜成aⅴ人片| 国产日韩在线不卡| 日韩欧美在线影院| 色婷婷av一区二区三区gif| 麻豆精品精品国产自在97香蕉 | 国产精品色在线观看| 欧美日韩国产影片| 北岛玲一区二区三区四区| 日本vs亚洲vs韩国一区三区| 亚洲色欲色欲www| 精品国产乱码久久| 欧美高清视频www夜色资源网| 国产不卡视频一区二区三区| 日本中文在线一区| 亚洲影院在线观看| 国产精品国产馆在线真实露脸 | 黑人精品欧美一区二区蜜桃| 亚洲综合在线观看视频| 国产精品免费人成网站| 精品国产三级a在线观看| 欧美少妇bbb| 91精品福利视频| 99久久精品国产网站| 国产成人精品www牛牛影视| 久久精品99国产精品日本| 午夜精品福利一区二区三区av| 《视频一区视频二区| 欧美国产日本韩| 欧美精品一区二区三区高清aⅴ | 天使萌一区二区三区免费观看| 亚洲人成精品久久久久| 国产精品乱人伦| 中文字幕欧美日本乱码一线二线| 久久综合五月天婷婷伊人| 日韩精品一区二区三区四区| 欧美一区二区三区四区高清| 欧美三级日本三级少妇99| 91黄视频在线| 在线观看中文字幕不卡| 欧美性xxxxxxxx| 欧美日韩国产天堂| 欧美电影影音先锋| 日韩一级片在线播放| 欧美肥妇free| 欧美一区二区高清| 精品国产免费人成电影在线观看四季| 日韩午夜激情电影| 26uuu欧美| 国产日韩欧美激情| 亚洲天堂久久久久久久| 一区二区三区中文字幕电影| 亚洲午夜av在线| 麻豆成人91精品二区三区| 久久国产综合精品| 狠狠色丁香婷婷综合| 丁香激情综合国产| 成人app在线| 欧美性受xxxx黑人xyx性爽| 欧美一二三四区在线| 精品国产免费一区二区三区四区| 久久精品一区二区三区不卡 | 欧美一区二区视频免费观看| 日韩亚洲欧美综合| 久久久亚洲精品一区二区三区| 中文字幕成人网| 亚洲高清一区二区三区| 精东粉嫩av免费一区二区三区| 国产麻豆精品在线观看| 色综合网站在线| 91麻豆精品国产综合久久久久久| 久久久久久亚洲综合影院红桃| 中文字幕乱码亚洲精品一区| 亚洲欧美国产毛片在线| 青青草国产精品97视觉盛宴| 国产尤物一区二区在线| 91久久线看在观草草青青| 日韩免费看网站| 国产精品久久久久一区二区三区| 亚洲国产精品综合小说图片区| 久久国产生活片100| 色94色欧美sute亚洲线路一久| 欧美一级xxx| 亚洲免费电影在线| 国产又粗又猛又爽又黄91精品| 91女神在线视频| 精品嫩草影院久久| 一区二区三区四区不卡在线| 精东粉嫩av免费一区二区三区| 91视频免费观看| 久久众筹精品私拍模特| 亚洲福利视频导航| 大胆欧美人体老妇| 91精品国产aⅴ一区二区| 中文字幕亚洲电影| 国产一区二区不卡在线| 欧美伊人久久大香线蕉综合69 | 成人综合激情网| 91精品国产高清一区二区三区蜜臀| 久久精品人人做| 亚洲国产aⅴ天堂久久| 懂色av中文一区二区三区| 欧美精品乱码久久久久久按摩 | 久久久噜噜噜久久中文字幕色伊伊| 亚洲欧美日韩在线| 精品一区二区三区不卡| 欧美在线观看一区| 亚洲色图视频免费播放| 国产一区二区三区免费在线观看 | 亚洲第一福利一区| 99国产精品久| 久久精品欧美日韩| 麻豆国产精品777777在线| 欧美亚洲图片小说| 亚洲激情图片一区| 成人h动漫精品| 日本一区二区成人在线| 老司机免费视频一区二区 | 人人狠狠综合久久亚洲| 色婷婷综合久久久中文一区二区| 中文字幕av一区二区三区| 免费高清在线视频一区·| 欧美午夜精品电影| 亚洲综合在线第一页| 91国模大尺度私拍在线视频| 欧美国产日本视频| 国产精一品亚洲二区在线视频| 日韩欧美在线网站| 美女视频黄a大片欧美| 宅男噜噜噜66一区二区66| 一区二区三区中文字幕在线观看| 99热在这里有精品免费| 国产精品大尺度| 97精品超碰一区二区三区| 久久久国产精品午夜一区ai换脸| 国产精品综合二区| 久久久精品tv| 91在线免费看| 一区二区三区成人| 欧美日韩成人在线| 日本少妇一区二区| 26uuu欧美| 99在线精品视频| 亚洲精品高清在线| 在线91免费看| 免费观看在线综合色| 国产偷v国产偷v亚洲高清| hitomi一区二区三区精品| 亚洲欧美日韩小说| 9191精品国产综合久久久久久| 奇米精品一区二区三区在线观看| 精品国产乱子伦一区| 国产精品99久久久久久久女警 | 精品视频在线免费| 免费看日韩a级影片| 国产欧美视频一区二区| 91女人视频在线观看| 免费的国产精品| 中文字幕一区二区三区av| 欧美区在线观看| 国产精品小仙女|