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

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

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


}











?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品在线一区二区| 欧美日韩精品一区二区三区| 狠狠狠色丁香婷婷综合激情| 经典三级一区二区| 中文字幕一区三区| 久久久一区二区三区| 中文字幕在线不卡视频| 亚洲美女屁股眼交3| 亚洲在线视频一区| 蜜桃精品视频在线| 懂色一区二区三区免费观看| 91免费观看视频| 在线播放国产精品二区一二区四区| 欧美精品日韩精品| 国产欧美视频在线观看| 亚洲男帅同性gay1069| 五月婷婷综合激情| 不卡的看片网站| 91精品国产综合久久婷婷香蕉| 69堂成人精品免费视频| 精品美女一区二区三区| 一区二区三区日韩欧美| 韩国中文字幕2020精品| 欧美视频一区在线| 国产欧美精品在线观看| 免费精品视频最新在线| aa级大片欧美| 国产欧美一区二区精品婷婷| 裸体一区二区三区| 欧美精品123区| 亚洲日本va午夜在线影院| 国产乱码精品一区二区三区忘忧草 | 亚洲成人av电影| 一本一道综合狠狠老| 在线播放中文一区| 一区二区三区在线看| 91麻豆国产福利精品| 国产精品毛片久久久久久| 久久国产福利国产秒拍| 欧美夫妻性生活| 麻豆精品视频在线观看免费| 欧美精品亚洲二区| 午夜精品久久久久久久99樱桃| 99精品1区2区| 亚洲成人在线网站| 9191成人精品久久| 另类欧美日韩国产在线| 精品处破学生在线二十三| 国产精品综合久久| 亚洲国产精品成人综合| 成a人片国产精品| 香蕉影视欧美成人| 日韩视频在线永久播放| 国产乱子伦视频一区二区三区 | 亚洲欧洲成人自拍| 欧美三级视频在线观看| 久久69国产一区二区蜜臀 | 91麻豆精品在线观看| 亚洲第一主播视频| 亚洲国产激情av| 欧美日韩久久不卡| 9人人澡人人爽人人精品| 亚洲国产日韩综合久久精品| 欧美性大战久久| 日韩精品三区四区| 中文字幕精品在线不卡| 3751色影院一区二区三区| 成人综合在线视频| 麻豆中文一区二区| 一区二区三区在线不卡| 中文字幕国产一区| 精品蜜桃在线看| 91精品国产乱码久久蜜臀| 91麻豆高清视频| 成人三级伦理片| 国产iv一区二区三区| 久久精品免费看| 午夜精品久久久久久久久| 亚洲欧美欧美一区二区三区| 国产日韩精品一区二区三区 | 免费成人在线网站| 婷婷久久综合九色综合绿巨人| 亚洲区小说区图片区qvod| 国产视频一区不卡| 国产欧美日韩激情| 国产欧美一区二区三区鸳鸯浴| 久久久久久久综合| 久久久亚洲高清| 久久影院午夜片一区| 欧美sm极限捆绑bd| 久久久久免费观看| 欧美激情一区二区在线| 欧美极品aⅴ影院| 亚洲人成影院在线观看| 一区二区三区鲁丝不卡| 天堂在线亚洲视频| 国产老妇另类xxxxx| 福利电影一区二区| 亚洲综合视频在线| 奇米精品一区二区三区四区| 免费成人小视频| 成人黄色a**站在线观看| 日本电影亚洲天堂一区| 日韩欧美国产不卡| 国产欧美日韩精品在线| 亚洲国产精品久久久久秋霞影院| 日本不卡视频在线| av电影天堂一区二区在线观看| 717成人午夜免费福利电影| 国产日韩欧美制服另类| 首页国产丝袜综合| 成人污视频在线观看| 欧美一区二区三区在| 亚洲欧美区自拍先锋| 国产一区在线观看麻豆| 欧美一区二区三区在| 一区二区免费视频| 菠萝蜜视频在线观看一区| 精品国产3级a| 免费观看一级特黄欧美大片| 色噜噜狠狠色综合中国| 国产精品三级久久久久三级| 国产剧情在线观看一区二区| 欧美日韩高清一区二区不卡| 国产精品久久久久久久蜜臀| 韩国三级在线一区| 欧美激情在线看| 波多野结衣中文一区| 国产欧美日韩久久| 成人三级在线视频| 最新日韩在线视频| 欧美主播一区二区三区美女| 国产精品乱码久久久久久| 不卡高清视频专区| 中文字幕一区二区三区色视频| 成人激情av网| 五月婷婷激情综合| 成人高清视频在线| 久久久www成人免费无遮挡大片| 激情都市一区二区| 91麻豆精品国产自产在线观看一区| 成人福利视频在线看| 国产免费久久精品| 大陆成人av片| 亚洲激情av在线| 欧美在线观看18| 香蕉av福利精品导航| 91精品国产乱码| 青青青伊人色综合久久| 精品国产乱码久久久久久牛牛| 石原莉奈在线亚洲二区| 在线不卡中文字幕播放| 美女网站在线免费欧美精品| 久久欧美一区二区| 成人午夜精品在线| 亚洲欧美日韩在线| 欧美精品乱码久久久久久按摩| 久久99日本精品| 自拍偷自拍亚洲精品播放| 欧美日本在线看| 国内精品视频一区二区三区八戒| 国产精品欧美经典| 欧美喷潮久久久xxxxx| 美女久久久精品| 国产日韩欧美高清| 欧美一区二区三区在线观看视频| 成人黄色免费短视频| 午夜影院在线观看欧美| 国产精品国产a| 亚洲精品一区二区精华| 在线观看一区二区视频| 国产福利一区二区三区视频| 亚洲制服丝袜一区| 国产农村妇女毛片精品久久麻豆| 欧美美女激情18p| 在线观看亚洲精品| 国产成人精品免费看| 久草在线在线精品观看| 亚洲国产成人av网| 蜜臀av一级做a爰片久久| 中文字幕高清不卡| 精品粉嫩超白一线天av| 色婷婷精品久久二区二区蜜臀av| 日本不卡视频一二三区| 国产一区二区在线电影| 成人av动漫在线| 91精品办公室少妇高潮对白| 久久久久久久久久久久久久久99 | 色综合网色综合| 一级日本不卡的影视| 久久久99精品免费观看| 91在线免费播放| 免费成人在线视频观看| 亚洲丝袜另类动漫二区| 精品日韩在线观看| 精品日韩欧美在线| 日韩欧美高清一区| 欧美日韩一区二区欧美激情| 天堂在线一区二区| 一区二区视频免费在线观看|