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

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

?? imageset.java

?? 大量j2me源代碼
?? JAVA
字號:
/**
 * 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.
 * <p>
 * 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.
 * <p>
 * @see Sprite
 */

//#ifdef nokia
//# import com.nokia.mid.ui.DirectGraphics;
//# import com.nokia.mid.ui.DirectUtils;
//#endif
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Graphics;
import java.io.IOException;

public class ImageSet
{
   private int totalStates;		// incremented by addState method only

   private Image[][] stateFrames;
   private int[] stateAnimTime, stateFrameWidth, stateFrameHeight;

   public ImageSet(int numStates)
   {
      stateAnimTime = new int[numStates];
      stateFrameWidth = new int[numStates];
      stateFrameHeight = new int[numStates];
      stateFrames = new Image[numStates][];
   }

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

   public final int getTotalFrames(int state)
   {
      return stateFrames[state].length;
   }

   public final int getAnimTime(int state)
   {
      return stateAnimTime[state];
   }

   public final int getAnimTimePerFrame(int state)
   {
      return stateAnimTime[state] / stateFrames[state].length;
   }

   /**
    * Draw a specific frame of this sprite onto a graphics object
    */
   public final void draw(Graphics target, int state, int frame, int targetX, int targetY)
   {
      //#ifdef debug
      if (state >= totalStates)
         System.out.println("oops, bad state " + state);

      if (frame >= stateFrames[state].length)
         System.out.println("oops, bad frame " + frame + " in draw(" +
                            frame + ", " + state + ")");
      //#endif
      if (stateFrames[state][frame] != null)
         target.drawImage(stateFrames[state][frame],
                          targetX, targetY, Tools.GRAPHICS_TOP_LEFT);
   }

   /**
    * get a specific frame
    */
   public final Image getFrame(int state, int frame)
   {
      //#ifdef debug
      if (state >= totalStates)
         System.out.println("oops, bad state " + state);

      if (frame >= stateFrames[state].length)
         System.out.println("oops, bad frame " + state + ", " + frame + " in getFrame()");
      //#endif

      return stateFrames[state][frame];
   }

   /**
    * Get all frames as a single image
    * @param framesWide
    * @return an image with all frames; used to debug image files
    */
/*	public Image getAllFrames(int framesWide)
	{
		int numLines = (totalFrames / framesWide);
		if (numLines == 0) numLines = 1;

		Image result = Image.createImage(frameWidth * framesWide, frameHeight * numLines);
		Graphics g = result.getGraphics();

		int i = 0;
		for (int fy = 0; fy < numLines; fy++)
		{
			for (int fx = 0; fx < framesWide; fx++)
			{
				draw(g, i, 0 + (frameWidth * fx), fy * frameHeight);
				if (i < totalFrames - 1)
					i++;
			}
		}
		return result;
	}
*/

   //
   // STATIC IMAGE TOOLS
   //

   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);
         return getImageRegion(fileImage, originX, originY, width, height);
      }

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

   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 (originX == 0 && originY == 0) return fileImage;

         return getImageRegion(fileImage, originX, originY, fileImage.getWidth(), fileImage.getHeight());
      }

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

   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 = null;

      //#ifdef nokia
      //# result = DirectUtils.createImage(width, height, 0x00000000);
      //#else
      result = Image.createImage(width, height);
      //#endif

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

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


	////////////////////////////////////////////////////////////////////////////
	//
	//	NOKIA DEVICE SPECIFIC
	//
	////////////////////////////////////////////////////////////////////////////

	//#ifdef nokia
//# 
	//# /**
	 //# * Generates the axis reflections of an array of images; for example, for
	 //# * 1 image we return the vertical reflection, for 2 we return the vertical
	 //# * and horizontal reflections, for more we return the appropriate angles
	 //# * reflected. You should never pass in a source image not representing a
    //# * direction within the 0 to 90 degrees (anything else is just a reflection
    //# * of one of these). Images are always returned in clockwise order, ie. give
    //# * me degrees 0, 45 and 90 and you'll get back images for 0, 45, 90, 135,
    //# * 180, 225, 270, 315, 360.
	 //# *
	 //# * @param source array of source images
	 //# * @return clockwise array of images (including those from the source) using axis reflection
	 //# */
	//# public final static Image[] getAxisReflections(Image[] source)
	//# {
		//# int n = source.length;
		//# if (n == 0) return null;
//# 
		//# // figure the size of the result
		//# int total = (n - 1) * 4;
		//# // special case for simple reflections
		//# if (n < 3) total = n * 2;
//# 
		//# Image[] result = new Image[total];
//# 
		//# // copy the original images to the result
		//# for (int i = 0; i < n; i++)
			//# result[i] = source[i];
//# 
		//# // mirror the vertical (0 to 180)
		//# result[total / 2] = getReflectedImage(source[0], true, false);
//# 
		//# // mirror the horizontal (90 to 270)
		//# if (n > 1)
		//# {
			//# // you can think of total/4 as 90 degrees and total/2 as 180
			//# // keep in mind we're starting at 0 for array access
			//# result[total / 2 + (total / 4)] = getReflectedImage(source[n - 1], false, true);
		//# }
//# 
		//# // mirror everything between 0 and 90 to the three other quadrants
		//# if (n > 2)
		//# {
			//# // now this gets a little messy; we need to mirror everything
			//# // in between 0 and 90 to the other quadrants. Since N > 2 we know we
			//# // have at least 1 image we need to reflect. First let's figure out how
			//# // many there are in the first quadrant, minus the two axis we already
			//# // took care of.
			//# int f = (n - 2);
//# 
			//# // now we mirror these to their opposing sides for the other 3
			//# // quadrants
			//# for (int i = 1; i <= f; i++)
			//# {
				//# result[total / 2 - i] = getReflectedImage(source[i], true, false);
				//# result[total / 2 + i] = getReflectedImage(source[i], true, true);
				//# result[total - i] = getReflectedImage(source[i], false, true);
			//# }
		//# }
		//# return result;
	//# }
//# 
	//# /**
	 //# * Return an image reflected veritcally, horizontally or both
	 //# * @param source the original image to reflect
	 //# * @param flipHorizontal carry out a horizontal flip
	 //# * @param flipVertical carry out a vertical flip
	 //# * @return the reflected image
	 //# */
	//# public final static Image getReflectedImage(Image source, boolean flipHorizontal, boolean flipVertical)
	//# {
		//# Image result = DirectUtils.createImage(source.getWidth(), source.getHeight(), 0x00000000);
		//# DirectGraphics rdg = DirectUtils.getDirectGraphics(result.getGraphics());
//# 
		//# int flipType = 0;
		//# if (flipHorizontal) flipType |= DirectGraphics.FLIP_HORIZONTAL;
		//# if (flipVertical) flipType |= DirectGraphics.FLIP_VERTICAL;
//# 
		//# rdg.drawImage(source, 0, 0, Tools.GRAPHICS_TOP_LEFT, flipType);
		//# return result;
	//# }
	//#endif


}











?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品中文字幕在线不卡尤物| 视频在线在亚洲| 91亚洲精品一区二区乱码| 亚洲日本一区二区| 欧美少妇xxx| 国产在线一区观看| 国产精品高潮呻吟| 97久久超碰国产精品| 久久精品视频在线看| 黄色成人免费在线| 精品成人免费观看| 国产自产2019最新不卡| 91麻豆精品国产91| 国产凹凸在线观看一区二区| 日韩一区二区三区高清免费看看| 首页国产丝袜综合| 欧美精品在线视频| 国产一区二区看久久| 亚洲色图色小说| 91视频在线观看免费| 亚洲免费在线看| 欧美精品一区二区三区蜜桃视频| 国内精品久久久久影院色| 日韩一级片网站| 免费人成在线不卡| 久久久亚洲高清| 成人午夜碰碰视频| 亚洲日本va在线观看| 色婷婷久久综合| 视频一区视频二区在线观看| 8v天堂国产在线一区二区| 婷婷开心激情综合| 日韩欧美国产精品| 成人精品一区二区三区四区 | 国产一区二区h| 欧美精品一区二区三区蜜臀| 国产成a人无v码亚洲福利| 国产精品欧美一区二区三区| 91在线精品秘密一区二区| 亚洲图片有声小说| 精品久久久久久久一区二区蜜臀| 国产成人精品免费一区二区| **性色生活片久久毛片| 91精品国产综合久久久久久久久久| 国产一区999| 一区二区三区日韩在线观看| 日韩精品一区二区三区三区免费| k8久久久一区二区三区 | 色视频成人在线观看免| 国产suv精品一区二区883| 日韩欧美的一区| 日本不卡在线视频| 欧美激情在线一区二区| 欧美欧美午夜aⅴ在线观看| 国产精品夜夜嗨| 日韩精品国产精品| 国产精品成人免费| 久久五月婷婷丁香社区| 欧美午夜影院一区| 成人国产精品免费网站| 蜜桃一区二区三区在线| 亚洲国产精品久久艾草纯爱| 成人欧美一区二区三区视频网页| 欧美成人a∨高清免费观看| 欧美日韩的一区二区| 在线精品观看国产| 一本到高清视频免费精品| 国产在线精品一区二区夜色| 免费日本视频一区| 奇米色一区二区| 丝袜美腿成人在线| 午夜亚洲国产au精品一区二区| 一区二区三区成人| 亚洲国产乱码最新视频| 一区二区三区欧美久久| 亚洲精品免费在线观看| 亚洲黄色尤物视频| 亚州成人在线电影| 日本视频一区二区三区| 国产一本一道久久香蕉| 成人网男人的天堂| 91色.com| 91国产精品成人| 懂色av一区二区三区免费看| 久88久久88久久久| 久久99精品一区二区三区三区| 亚洲午夜电影在线| 玖玖九九国产精品| 麻豆成人av在线| 激情欧美一区二区三区在线观看| 日韩精品每日更新| 蜜桃av一区二区三区| 另类小说色综合网站| 精品亚洲porn| 国产成人一区二区精品非洲| 粉嫩av一区二区三区| av在线播放一区二区三区| 91丨porny丨首页| 91丨九色丨黑人外教| 欧美一区二区视频在线观看2020| 欧美精品久久99久久在免费线| 欧美丰满少妇xxxbbb| 欧美一区二区三区小说| 精品国产在天天线2019| 国产精品色噜噜| 国产日本亚洲高清| 亚洲第一福利视频在线| 美女视频一区二区| 成人动漫在线一区| 欧美日韩国产在线观看| 国产亚洲制服色| 日韩av网站在线观看| 成人三级在线视频| 在线播放国产精品二区一二区四区| 欧美精品一区二区三区在线播放| 精品成人a区在线观看| 国产欧美一区二区在线观看| 国产欧美一区在线| 麻豆久久一区二区| 色欧美乱欧美15图片| 精品久久久三级丝袜| 亚洲第一在线综合网站| 国产成人在线色| 51精品视频一区二区三区| 亚洲人成网站色在线观看 | 国产乱码精品一区二区三区五月婷 | 亚洲va在线va天堂| 91原创在线视频| 久久日一线二线三线suv| 视频在线在亚洲| 日本精品一区二区三区高清| 国产日韩三级在线| 国产精品影音先锋| 久久网站热最新地址| 免费视频一区二区| 91精品免费在线观看| 亚洲五码中文字幕| 日本伦理一区二区| 亚洲欧美另类久久久精品| 国产精品一区免费视频| 日韩精品一区二区在线| 欧美aaaaaa午夜精品| 欧美性xxxxxxxx| 日本特黄久久久高潮| 欧美日本一区二区三区四区| 亚洲男女一区二区三区| thepron国产精品| 久久婷婷色综合| 日本大胆欧美人术艺术动态| 欧美福利一区二区| 日韩精品一区第一页| 欧美一级片在线观看| 国产一区二区三区四区五区美女| 国产日产欧美一区二区视频| 成人免费高清在线观看| 国产精品入口麻豆原神| 色婷婷精品久久二区二区蜜臀av| 又紧又大又爽精品一区二区| 在线视频你懂得一区| 美女爽到高潮91| 国产欧美中文在线| 韩国女主播一区| 国产精品久久午夜| 欧美在线观看禁18| 蜜臂av日日欢夜夜爽一区| 久久久99久久精品欧美| 97久久精品人人爽人人爽蜜臀| 亚洲成a人v欧美综合天堂下载| 日韩欧美中文字幕精品| 91免费视频大全| 免费不卡在线观看| 综合网在线视频| 日韩精品一区二区三区四区| 91免费看视频| 成人综合婷婷国产精品久久免费| 亚洲国产精品一区二区尤物区| 精品国产不卡一区二区三区| 色婷婷综合久久久中文一区二区| 日本中文在线一区| 自拍偷拍国产精品| 91麻豆精品国产自产在线| av在线不卡电影| 国产米奇在线777精品观看| 亚洲国产日韩综合久久精品| 欧美国产成人在线| 精品国产sm最大网站| 欧美一区二区精美| 国产精品性做久久久久久| 日韩中文欧美在线| 中文av一区二区| 国产校园另类小说区| 久久综合精品国产一区二区三区| 91麻豆精品国产| 欧美午夜免费电影| 色婷婷综合久久久久中文一区二区 | 日产精品久久久久久久性色| 三级影片在线观看欧美日韩一区二区| 亚洲女人小视频在线观看| ...av二区三区久久精品| 国产日本一区二区|