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

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

?? customfont.java

?? j2me下的方塊游戲 直接放到wtk下即可運行
?? JAVA
字號:
package CustomFont;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class CustomFont {
	private int style;

	private int size;

	private int baseline;

	private int height;

	private int width;

	private Image image;

	/**
	 * 返回一個自定義字體的對象
	 */
	public static CustomFont getFont(String inName, int inStyle, int inSize) {
		Image i;
		String filename = inName;
		try {
			i = Image.createImage(filename);
		} catch (Throwable t) {
			t.printStackTrace();
			throw new IllegalArgumentException("Could not locate font: "
					+ filename + " : " + t);
		}

		return new CustomFont(i, inSize, inStyle);
	}

	private CustomFont(Image inImage, int inStyle, int inSize) {
		image = inImage;
		style = inStyle;
		size = inSize;

		try {
			height = image.getHeight();
			width = image.getWidth() / 128;
			baseline = calculateBaseline();
		} catch (Throwable t) {
			t.printStackTrace();
			throw new IllegalArgumentException("Specified font is invalid: "
					+ t);
		}
	}

	private int calculateBaseline() {
		// get baseline: defaults to last row
		int result = height;
		int imageWidth = image.getWidth();
		int max = 0;
		int total;
		int[] row = new int[imageWidth];
		int background;

		//確定背景顏色,假設(0,0)坐標的象素為背景顏色
		image.getRGB(row, 0, 1, 0, 0, 1, 1);
		background = row[0];

		// 按每行搜索象素
		for (int y = height / 2; y < height; y++) {
			total = 0;
			image.getRGB(row, 0, imageWidth, 0, y, imageWidth, 1);
			for (int x = 0; x < imageWidth; x++) {
				if (row[x] != background)
					total++;
			}
			if (total > max) {
				max = total;
				result = y;
			}
		}

		return result;
	}

	public int charsWidth(char[] ch, int offset, int length) {
		// 確定字符間距離
		return length * width;
	}

	public int charWidth(char ch) {
		return width;
	}

	public int getBaselinePosition() {
		return baseline;
	}

	public int getHeight() {
		return height;
	}

	public int stringWidth(String str) {
		return charsWidth(str.toCharArray(), 0, str.length());
	}

	public int substringWidth(String str, int offset, int len) {
		return charsWidth(str.toCharArray(), offset, len);
	}

	public int getSize() {
		return size;
	}

	public int getStyle() {
		return style;
	}

	public boolean isBold() {
		return ((style & Font.STYLE_BOLD) != 0);
	}

	public boolean isItalic() {
		return ((style & Font.STYLE_ITALIC) != 0);
	}

	public boolean isPlain() {
		return (style == 0);
	}

	public boolean isUnderlined() {
		return ((style & Font.STYLE_UNDERLINED) != 0);
	}

	/**
	 * 畫單個字符
	 */
	public void drawChar(Graphics g, char character, int x, int y, int anchor) {
		int clipX = g.getClipX();
		int clipY = g.getClipY();
		int clipW = g.getClipWidth();
		int clipH = g.getClipHeight();

		drawCharInternal(g, character, x, y, anchor);

		g.setClip(clipX, clipY, clipW, clipH);
	}

	/**
	 * 畫字符數組
	 */
	public void drawChars(Graphics g, char[] data, int offset, int length,
			int x, int y, int anchor) {
		if ((anchor & Graphics.RIGHT) != 0) {
			x -= charsWidth(data, offset, length);
		} else if ((anchor & Graphics.HCENTER) != 0) {
			x -= (charsWidth(data, offset, length) / 2);
		}

		if ((anchor & Graphics.BOTTOM) != 0) {
			y -= height;
		} else if ((anchor & Graphics.VCENTER) != 0) {
			y -= height / 2;
		}

		int clipX = g.getClipX();
		int clipY = g.getClipY();
		int clipW = g.getClipWidth();
		int clipH = g.getClipHeight();

		char c;
		for (int i = 0; i < length; i++) {
			c = data[offset + i];
			drawCharInternal(g, c, x, y, Graphics.TOP | Graphics.LEFT);
			x += width;
		}

		g.setClip(clipX, clipY, clipW, clipH);
	}

	/**
	 * 繪制時間圖片的字符,不用考慮內存等各種因素
	 */
	private void drawCharInternal(Graphics g, char character, int x, int y,
			int anchor) {
		if ((style & Font.STYLE_ITALIC) != 0) {
			// draw italicized: top half is shifted right
			g.setClip(x + 1, y, width, height / 2);
			g.drawImage(image, x - width * character + 1, y, anchor);
			g.setClip(x, y + height / 2, width, height / 2);
			g.drawImage(image, x - width * character, y, anchor);

			if ((style & Font.STYLE_BOLD) != 0) {
				g.setClip(x, y, width, height / 2);
				g.drawImage(image, x - width * character + 2, y, anchor);
				g.setClip(x, y + height / 2, width, height / 2);
				g.drawImage(image, x - width * character + 1, y, anchor);
			}
		} else {
			// draw normally
			g.setClip(x, y, width, height);
			g.drawImage(image, x - width * character, y, anchor);

			if ((style & Font.STYLE_BOLD) != 0) {
				g.drawImage(image, x - width * character + 1, y, anchor);
			}
		}

		if ((style & Font.STYLE_UNDERLINED) != 0) {
			g.drawLine(x, y + baseline + 2, x + width, y + baseline + 2);
		}
	}

	/**
	 * 繪制字符串.
	 */
	public void drawString(Graphics g, String str, int x, int y, int anchor) {
		drawChars(g, str.toCharArray(), 0, str.length(), x, y, anchor);
	}

	/**
	 * 繪制子字符串
	 */
	public void drawSubstring(Graphics g, String str, int offset, int len,
			int x, int y, int anchor) {
		drawChars(g, str.toCharArray(), offset, len, x, y, anchor);
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品福利视频网站| 国产激情一区二区三区桃花岛亚洲| 久久精品久久精品| 日本美女一区二区三区| 麻豆成人综合网| 成人免费毛片片v| 日韩精品最新网址| 亚洲一区二区三区四区在线免费观看 | 久久久久久久久久久电影| 亚洲激情中文1区| 国产成人av电影在线观看| 欧美成人三级在线| 欧美激情在线一区二区| 久久精品国产亚洲5555| 99re在线精品| 国产欧美综合在线| 精品中文av资源站在线观看| 欧美日韩国产天堂| 国产精品国产精品国产专区不片| 国产一区二区在线看| 亚洲国产成人一区二区三区| 日本视频一区二区三区| 91在线你懂得| 亚洲色欲色欲www| 97久久精品人人澡人人爽| 国产亚洲成年网址在线观看| 国产精品99久久不卡二区| 精品国产亚洲一区二区三区在线观看| 亚洲一区二区三区四区在线观看| 欧美日韩不卡一区| 日本91福利区| 日韩精品一区二| 奇米亚洲午夜久久精品| 欧美一级艳片视频免费观看| 国产高清不卡一区二区| 中文字幕一区二区三区精华液| 91小视频在线| 精品一区二区三区在线观看| 国产精品毛片久久久久久久| 欧洲色大大久久| 亚洲综合丝袜美腿| 日韩一区二区影院| 国产精品影视网| 亚洲综合色区另类av| 日韩精品在线一区| 在线亚洲人成电影网站色www| 婷婷丁香久久五月婷婷| 国产精品国产精品国产专区不片| 欧美日本不卡视频| 99这里只有久久精品视频| 日韩av电影免费观看高清完整版 | 亚洲自拍偷拍九九九| 欧美精品一区二区三区四区| 色综合久久综合网欧美综合网 | 日韩精品欧美精品| 日韩一区欧美一区| 欧美国产禁国产网站cc| 欧美日韩视频在线第一区| 成人精品一区二区三区四区 | 狠狠狠色丁香婷婷综合激情| 综合在线观看色| 亚洲超碰97人人做人人爱| 欧美人体做爰大胆视频| 色999日韩国产欧美一区二区| 风间由美一区二区三区在线观看| 免费欧美在线视频| 日本大胆欧美人术艺术动态| 亚洲妇女屁股眼交7| 精品捆绑美女sm三区| 91在线观看下载| 一本色道久久加勒比精品| 99久久亚洲一区二区三区青草| 岛国精品一区二区| 国产ts人妖一区二区| 处破女av一区二区| 色婷婷综合中文久久一本| 91成人看片片| 欧美成人性战久久| 精品国产伦一区二区三区观看方式 | 激情国产一区二区| 久久国产精品99久久久久久老狼 | 欧美视频日韩视频| 日本久久一区二区| 555www色欧美视频| 日韩免费福利电影在线观看| 久久久久久麻豆| 亚洲色图制服丝袜| 奇米色777欧美一区二区| 国产不卡免费视频| 欧美午夜片在线观看| 精品国产凹凸成av人导航| 亚洲欧美自拍偷拍色图| 久久激五月天综合精品| 欧美bbbbb| 欧美三级三级三级| 欧美极品少妇xxxxⅹ高跟鞋| 亚洲在线观看免费视频| 成人av免费在线观看| 久久精品欧美一区二区三区麻豆| 日韩和的一区二区| 欧美精品乱码久久久久久按摩| 一区二区三区四区精品在线视频 | 成人欧美一区二区三区小说| 一区精品在线播放| 国产精品三级av| 久久福利资源站| 91啪亚洲精品| 26uuu精品一区二区| 亚洲精品你懂的| 国产成人精品影视| 欧美日韩视频一区二区| 欧美日韩久久一区二区| 国产精品欧美综合在线| 成人性生交大片免费看在线播放| 北条麻妃国产九九精品视频| 国产.精品.日韩.另类.中文.在线.播放| 成人av网站在线观看| www国产亚洲精品久久麻豆| 偷拍一区二区三区| 精品视频资源站| 亚洲国产一区视频| 久久久久亚洲综合| 美国毛片一区二区| 日韩一区二区三区视频| 日本不卡1234视频| 欧美一级在线观看| 欧美一级免费观看| 麻豆精品国产91久久久久久| 欧美一级在线观看| 亚洲欧洲精品成人久久奇米网| 成人av在线一区二区| 国产精品免费看片| 99精品黄色片免费大全| 亚洲自拍偷拍麻豆| 国产乱码精品一区二区三| 欧美一区二区在线看| 国产露脸91国语对白| 色婷婷久久久久swag精品| 亚洲777理论| 久久人人爽爽爽人久久久| 国产又黄又大久久| 午夜视频在线观看一区二区三区| 色婷婷激情综合| 激情综合亚洲精品| 欧美国产乱子伦 | 国产精品1区二区.| 中文字幕一区二区三区在线播放| 欧美日本在线播放| 国产真实乱对白精彩久久| 亚洲欧美日韩国产另类专区 | 一区二区三区91| 国产aⅴ综合色| 精品1区2区在线观看| 99r国产精品| 一区在线观看视频| 欧美一区二区三区婷婷月色| 亚洲一区二区三区视频在线播放| 国产偷国产偷精品高清尤物| 在线观看欧美日本| 精品一区二区三区视频在线观看| 亚洲精品成a人| 欧美一区二区视频在线观看2020| av电影在线观看不卡| 国内精品国产成人国产三级粉色| 一区二区三区在线高清| 99国产精品国产精品久久| 婷婷激情综合网| 亚洲一区在线视频观看| 亚洲欧洲www| 亚洲综合偷拍欧美一区色| 亚洲婷婷综合久久一本伊一区| 欧美激情综合五月色丁香小说| 色老头久久综合| 欧美日韩在线三级| 99国产精品久久久| 天堂va蜜桃一区二区三区| 国产精品久久夜| 亚洲欧美日韩久久精品| 精品福利二区三区| 精品国精品自拍自在线| 在线综合+亚洲+欧美中文字幕| 91精品国产黑色紧身裤美女| 91精品国产免费| 久久久亚洲精品石原莉奈| 中文字幕成人网| 一区二区三区电影在线播| 亚洲高清免费观看高清完整版在线观看| 欧美久久一二三四区| 欧美影视一区二区三区| 欧美性生活大片视频| 欧美mv日韩mv国产网站app| 久久婷婷综合激情| 欧美成人video| www精品美女久久久tv| 精品国产网站在线观看| 国产女同互慰高潮91漫画| 日韩视频一区在线观看| 欧美激情综合网| 制服丝袜中文字幕亚洲| 欧美电视剧免费观看|