亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲三级电影全部在线观看高清| 日本va欧美va瓶| 色狠狠一区二区三区香蕉| 欧美xxxxxxxx| 日韩精品专区在线影院观看 | 亚洲精品亚洲人成人网在线播放| 麻豆成人久久精品二区三区红| 国产成人av电影在线播放| 日韩午夜精品视频| 一个色在线综合| 日韩免费成人网| 欧美熟乱第一页| 日本色综合中文字幕| 3d动漫精品啪啪一区二区竹菊| 亚洲色图制服丝袜| 成人免费视频国产在线观看| 精品久久人人做人人爰| 亚洲自拍与偷拍| 国产不卡视频在线观看| 69久久99精品久久久久婷婷 | 亚洲免费成人av| 日韩精品欧美精品| 色哟哟精品一区| 日本一区二区在线不卡| 精久久久久久久久久久| 欧美精品丝袜中出| 奇米影视一区二区三区| 91小视频在线| 国产精品久久99| 在线电影院国产精品| 亚洲国产欧美另类丝袜| 国产一区二区0| 国产精品美女久久久久久久久| 亚洲电影视频在线| 国产精品九色蝌蚪自拍| 精品国产欧美一区二区| eeuss国产一区二区三区| 亚洲国产电影在线观看| 2022国产精品视频| 日韩欧美激情在线| 欧美精品精品一区| 9191精品国产综合久久久久久| 欧美日韩国产精选| 欧美少妇bbb| 欧美日韩国产影片| 91精品国产欧美一区二区18| 欧美精品电影在线播放| 91麻豆精品国产无毒不卡在线观看 | 亚洲综合在线五月| 亚洲综合在线视频| 日本中文在线一区| 激情六月婷婷久久| 国产成人av电影在线播放| 成人丝袜高跟foot| 91污片在线观看| 在线观看免费成人| 欧美剧情片在线观看| 欧美一区二区三区视频| 精品福利av导航| 国产欧美日韩不卡免费| 亚洲视频综合在线| 五月天丁香久久| 精品一区二区免费在线观看| 国产91精品久久久久久久网曝门| www.一区二区| 欧美色视频在线观看| 日韩一区二区高清| 精品国产一区二区三区不卡| 国产精品乱人伦中文| 亚洲国产sm捆绑调教视频| 日本特黄久久久高潮| 国产福利91精品| 91久久精品一区二区| 日韩三级高清在线| 国产精品免费视频观看| 亚洲v中文字幕| 激情另类小说区图片区视频区| 高清不卡一二三区| 欧美丝袜第三区| 久久久不卡网国产精品二区| 亚洲一区二区在线免费观看视频 | 麻豆视频观看网址久久| 丁香婷婷综合五月| 欧美福利电影网| 日本一二三四高清不卡| 亚洲aⅴ怡春院| 不卡av在线免费观看| 欧美日韩mp4| 国产精品网站导航| 日韩成人一区二区| 成人av资源站| 日韩亚洲欧美在线观看| 亚洲欧美日韩电影| 精品亚洲国产成人av制服丝袜| 色婷婷久久99综合精品jk白丝| 欧美va亚洲va| 亚洲一区在线播放| 成人小视频免费观看| 欧美一区二区日韩| 亚洲精品国产视频| 国产精品自产自拍| 在线综合视频播放| 夜夜精品视频一区二区| 风流少妇一区二区| 日韩免费在线观看| 污片在线观看一区二区| 色哟哟一区二区在线观看| 国产欧美一区二区精品仙草咪| 日韩电影在线免费观看| 在线观看av一区二区| 中文无字幕一区二区三区| 美女网站在线免费欧美精品| 欧美在线短视频| 1024亚洲合集| 国产真实乱子伦精品视频| 欧美高清视频www夜色资源网| 亚洲丝袜精品丝袜在线| 不卡区在线中文字幕| 久久亚洲精品小早川怜子| 奇米影视在线99精品| 欧美人妖巨大在线| 一二三四区精品视频| 日本韩国精品在线| 亚洲日本在线看| 91小宝寻花一区二区三区| 国产精品伦理一区二区| 盗摄精品av一区二区三区| 2021中文字幕一区亚洲| 久久精品国产99国产| 91精品欧美福利在线观看| 天天综合色天天综合| 欧美日本一区二区| 日韩成人午夜电影| 56国语精品自产拍在线观看| 日日夜夜精品视频天天综合网| 欧美日韩高清不卡| 视频一区国产视频| 91精品国产aⅴ一区二区| 首页国产丝袜综合| 日韩午夜中文字幕| 国产乱码精品一区二区三| 久久久不卡网国产精品二区| 国产91精品精华液一区二区三区| 中文字幕免费观看一区| 99这里只有久久精品视频| 亚洲欧美成aⅴ人在线观看| 欧美在线一区二区| 日韩黄色一级片| 欧美videofree性高清杂交| 国产在线一区观看| 中文字幕一区二区三区蜜月| 色综合久久久久| 日韩专区一卡二卡| 日韩精品专区在线影院重磅| 国产91精品久久久久久久网曝门| 综合久久久久综合| 欧美日韩视频在线第一区| 日本va欧美va瓶| 日本一区二区三级电影在线观看| www.色综合.com| 亚洲国产三级在线| 欧美mv和日韩mv的网站| 大胆亚洲人体视频| 一区二区三区中文字幕电影| 这里只有精品视频在线观看| 国产麻豆日韩欧美久久| 亚洲视频中文字幕| 日韩欧美中文字幕精品| 懂色av一区二区三区免费观看| 亚洲乱码国产乱码精品精可以看 | 欧美性猛交xxxx黑人交| 老司机精品视频一区二区三区| 26uuu欧美日本| 色婷婷精品大在线视频| 久久精品国产亚洲一区二区三区| 国产精品全国免费观看高清 | 国产精品久久久久7777按摩| 欧美日韩一区二区三区视频| 国产呦精品一区二区三区网站| 国产精品大尺度| 91精品婷婷国产综合久久| 大胆欧美人体老妇| 日韩国产欧美三级| 中文字幕一区二区三| 欧美一卡2卡三卡4卡5免费| 成人午夜视频免费看| 石原莉奈在线亚洲二区| 国产精品美女一区二区| 日韩三级av在线播放| 色哟哟在线观看一区二区三区| 韩国视频一区二区| 亚洲超丰满肉感bbw| 中文字幕不卡在线观看| 91精品国产高清一区二区三区蜜臀| 成人av在线资源| 另类小说图片综合网| 一卡二卡三卡日韩欧美| 国产精品欧美精品| 精品国产乱码久久久久久免费| 欧美在线你懂得|