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

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

?? bmploader.java

?? 這是java編的一個MP3的解碼器。有需要的朋友可以看看。
?? JAVA
字號:
package javazoom.Util;

/**
 * This class implements a BMP Loader.
 *
 *-----------------------------------------------------------------------
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *----------------------------------------------------------------------
 */

import java.awt.*;
import java.awt.image.*;
import java.io.*;

/**
 * A decoder for Windows bitmap (.BMP) files.
 * Compression not supported.
 */
public class BMPLoader
{
	private InputStream is;
	private int curPos = 0;

	private int bitmapOffset;		// starting position of image data

	private int width;				// image width in pixels
	private int height;				// image height in pixels
	private short bitsPerPixel;		// 1, 4, 8, or 24 (no color map)
	private int compression;		// 0 (none), 1 (8-bit RLE), or 2 (4-bit RLE)
	private int actualSizeOfBitmap;
	private int scanLineSize;
	private int actualColorsUsed;

	private byte r[], g[], b[];		// color palette
	private int noOfEntries;

	private byte[] byteData;		// Unpacked data
	private int[] intData;			// Unpacked data

	public BMPLoader()
	{
	}

    public Image getBMPImage(InputStream stream) throws Exception
    {
		read(stream);
		return Toolkit.getDefaultToolkit().createImage(getImageSource());
	}

	private int readInt() throws IOException {
		int b1 = is.read();
		int b2 = is.read();
		int b3 = is.read();
		int b4 = is.read();
		curPos += 4;
		return ((b4 << 24) + (b3 << 16) + (b2 << 8) + (b1 << 0));
	}


	private short readShort() throws IOException {
		int b1 = is.read();
		int b2 = is.read();
		curPos += 4;
		return (short)((b2 << 8) + b1);
	}


	void getFileHeader()  throws IOException, Exception {
		// Actual contents (14 bytes):
		short fileType = 0x4d42;// always "BM"
		int fileSize;			// size of file in bytes
		short reserved1 = 0;	// always 0
		short reserved2 = 0;	// always 0

		fileType = readShort();
		if (fileType != 0x4d42)
			throw new Exception("Not a BMP file");	// wrong file type
		fileSize = readInt();
		reserved1 = readShort();
		reserved2 = readShort();
		bitmapOffset = readInt();
	}

	void getBitmapHeader() throws IOException {

		// Actual contents (40 bytes):
		int size;				// size of this header in bytes
		short planes;			// no. of color planes: always 1
		int sizeOfBitmap;		// size of bitmap in bytes (may be 0: if so, calculate)
		int horzResolution;		// horizontal resolution, pixels/meter (may be 0)
		int vertResolution;		// vertical resolution, pixels/meter (may be 0)
		int colorsUsed;			// no. of colors in palette (if 0, calculate)
		int colorsImportant;	// no. of important colors (appear first in palette) (0 means all are important)
		boolean topDown;
		int noOfPixels;

		size = readInt();
		width = readInt();
		height = readInt();
		planes = readShort();
		bitsPerPixel = readShort();
		compression = readInt();
		sizeOfBitmap = readInt();
		horzResolution = readInt();
		vertResolution = readInt();
		colorsUsed = readInt();
		colorsImportant = readInt();

		topDown = (height < 0);
		noOfPixels = width * height;

		// Scan line is padded with zeroes to be a multiple of four bytes
		scanLineSize = ((width * bitsPerPixel + 31) / 32) * 4;

		if (sizeOfBitmap != 0)
			actualSizeOfBitmap = sizeOfBitmap;
		else
			// a value of 0 doesn't mean zero - it means we have to calculate it
			actualSizeOfBitmap = scanLineSize * height;

		if (colorsUsed != 0)
			actualColorsUsed = colorsUsed;
		else
			// a value of 0 means we determine this based on the bits per pixel
			if (bitsPerPixel < 16)
				actualColorsUsed = 1 << bitsPerPixel;
			else
				actualColorsUsed = 0;	// no palette
	}


	void getPalette() throws IOException {
		noOfEntries = actualColorsUsed;
		//IJ.write("noOfEntries: " + noOfEntries);
		if (noOfEntries>0) {
			r = new byte[noOfEntries];
			g = new byte[noOfEntries];
			b = new byte[noOfEntries];

			int reserved;
			for (int i = 0; i < noOfEntries; i++) {
				b[i] = (byte)is.read();
				g[i] = (byte)is.read();
				r[i] = (byte)is.read();
				reserved = is.read();
				curPos += 4;
			}
		}
	}

	void unpack(byte[] rawData, int rawOffset, int[] intData, int intOffset, int w) {
		int j = intOffset;
		int k = rawOffset;
		int mask = 0xff;
		for (int i = 0; i < w; i++) {
			int b0 = (((int)(rawData[k++])) & mask);
			int b1 = (((int)(rawData[k++])) & mask) << 8;
			int b2 = (((int)(rawData[k++])) & mask) << 16;
			intData[j] = 0xff000000 | b0 | b1 | b2;
			j++;
		}
	}


	void unpack(byte[] rawData, int rawOffset, int bpp,
		byte[] byteData, int byteOffset, int w) throws Exception {
		int j = byteOffset;
		int k = rawOffset;
		byte mask;
		int pixPerByte;

		switch (bpp) {
		case 1:	mask = (byte)0x01; pixPerByte = 8; break;
		case 4:	mask = (byte)0x0f; pixPerByte = 2; break;
		case 8:	mask = (byte)0xff; pixPerByte = 1; break;
		default:
			throw new Exception("Unsupported bits-per-pixel value");
		}

		for (int i = 0;;) {
			int shift = 8 - bpp;
			for (int ii = 0; ii < pixPerByte; ii++) {
				byte br = rawData[k];
				br >>= shift;
				byteData[j] = (byte)(br & mask);
				//System.out.println("Setting byteData[" + j + "]=" + Test.byteToHex(byteData[j]));
				j++;
				i++;
				if (i == w) return;
				shift -= bpp;
			}
			k++;
		}
	}


	void getPixelData() throws IOException, Exception {
		byte[] rawData;			// the raw unpacked data

		// Skip to the start of the bitmap data (if we are not already there)
		long skip = bitmapOffset - curPos;
		if (skip > 0) {
			is.skip(skip);
			curPos += skip;
		}

		int len = scanLineSize;
		if (bitsPerPixel > 8)
			intData = new int[width * height];
		else
			byteData = new byte[width * height];
		rawData = new byte[actualSizeOfBitmap];
		int rawOffset = 0;
		int offset = (height - 1) * width;
		for (int i = height - 1; i >= 0; i--) {
			int n = is.read(rawData, rawOffset, len);
			if (n < len) throw new Exception("Scan line ended prematurely after "
				+ n + " bytes");
			if (bitsPerPixel > 8) {
				// Unpack and create one int per pixel
				unpack(rawData, rawOffset, intData, offset, width);
			}
			else {
				// Unpack and create one byte per pixel
				unpack(rawData, rawOffset, bitsPerPixel,
					byteData, offset, width);
			}
			rawOffset += len;
			offset -= width;
		}
	}


	public void read(InputStream is) throws IOException, Exception {
		this.is = is;
		getFileHeader();
		getBitmapHeader();
		if (compression!=0)
			throw new Exception(" BMP Compression not supported");
		getPalette();
		getPixelData();
	}


	public MemoryImageSource getImageSource() {
		ColorModel cm;
		MemoryImageSource mis;

		if (noOfEntries > 0) {
			// There is a color palette; create an IndexColorModel
			cm = new IndexColorModel(bitsPerPixel,
					noOfEntries, r, g, b);
		} else {
			// There is no palette; use the default RGB color model
			cm = ColorModel.getRGBdefault();
		}

		// Create MemoryImageSource

		if (bitsPerPixel > 8) {
			// use one int per pixel
			mis = new MemoryImageSource(width,
				height, cm, intData, 0, width);
		} else {
			// use one byte per pixel
			mis = new MemoryImageSource(width,
				height, cm, byteData, 0, width);
		}

		return mis;	 // this can be used by Component.createImage()
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜私人影院| 久久久精品国产免费观看同学| 在线观看视频一区二区| 欧美日产国产精品| 亚洲精品在线三区| 中文字幕在线不卡国产视频| 尤物在线观看一区| 久久91精品国产91久久小草| 高清国产午夜精品久久久久久| 91日韩在线专区| 欧美一二三区精品| 国产精品天天摸av网| 午夜精品久久久久久久| 欧美a级理论片| 国产福利一区二区| 91久久精品午夜一区二区| 欧美区视频在线观看| 欧美激情在线一区二区| 天天综合色天天| 国产99久久久国产精品| 欧美日韩在线观看一区二区 | 欧美视频精品在线| 精品少妇一区二区三区日产乱码 | 免费美女久久99| 99久久婷婷国产| www国产成人| 日韩专区中文字幕一区二区| 成人97人人超碰人人99| 国产色综合一区| 亚洲第一在线综合网站| 成人深夜在线观看| 精品美女一区二区| 亚洲一区二区偷拍精品| 国产.欧美.日韩| www国产亚洲精品久久麻豆| 亚洲成在人线在线播放| 99久久久久久| 日本一区二区三区国色天香| 热久久国产精品| 欧美亚洲一区二区在线观看| 中文字幕电影一区| 国产大陆亚洲精品国产| 日韩欧美中文字幕公布| 香蕉久久夜色精品国产使用方法| 99热精品一区二区| 久久精品欧美一区二区三区麻豆| 青青草国产成人99久久| 欧美日韩精品二区第二页| 一区二区三区四区在线免费观看| 国产精品一区二区久激情瑜伽| 91精品免费在线观看| 一区二区三区在线观看网站| 波多野结衣中文字幕一区| 国产欧美一区二区精品婷婷 | 日韩久久久精品| 亚洲成人免费在线观看| 在线观看av一区二区| 亚洲品质自拍视频| 色中色一区二区| 亚洲精品大片www| 欧美色图天堂网| 亚洲最大成人综合| 欧美亚洲国产一卡| 午夜一区二区三区视频| 欧美高清激情brazzers| 美腿丝袜一区二区三区| 精品少妇一区二区三区视频免付费| 免费看欧美女人艹b| 日韩欧美国产不卡| 国产伦精品一区二区三区免费迷| 精品国产第一区二区三区观看体验 | 欧美日韩精品免费观看视频 | 国产亚洲欧美中文| 国产乱子轮精品视频| 国产精品全国免费观看高清 | 成人高清视频在线观看| 国产精品理论片在线观看| 成人毛片在线观看| 亚洲色图欧美偷拍| 91麻豆精品国产综合久久久久久| 久久国产生活片100| 久久久精品2019中文字幕之3| 国产一区二区三区四区五区入口| 丝袜亚洲另类欧美综合| 日韩精品一区二区三区四区| 国产成人在线色| 亚洲精品成人精品456| 91精品在线观看入口| 国产99精品在线观看| 亚洲一区二区精品久久av| 日韩午夜在线观看视频| 国产成人精品三级麻豆| 亚洲成人av一区二区三区| 久久精品亚洲麻豆av一区二区| 91香蕉视频污在线| 久久不见久久见中文字幕免费| 中文字幕亚洲不卡| 精品国产免费人成在线观看| 高清beeg欧美| 蜜臀av性久久久久蜜臀aⅴ| 1000部国产精品成人观看| 69av一区二区三区| 国产不卡在线播放| 午夜电影网亚洲视频| 国产精品色一区二区三区| 欧美日本在线观看| 91麻豆国产自产在线观看| 九九视频精品免费| 亚洲欧美另类久久久精品2019| 精品国产精品网麻豆系列| 欧美伦理视频网站| 色视频一区二区| 成人黄色一级视频| 精品一区二区三区免费| 婷婷成人综合网| 亚洲免费伊人电影| 国产精品色婷婷| 欧美一级生活片| 久久精品亚洲一区二区三区浴池| 777久久久精品| 欧美日韩国产一级| 99精品偷自拍| 成人黄页毛片网站| 国产成+人+日韩+欧美+亚洲| 久久aⅴ国产欧美74aaa| 日韩成人免费看| 亚洲精品国产无天堂网2021| 久久久久久久久久久电影| 日韩精品在线一区| 日韩一区二区免费在线观看| 欧美日韩国产首页| 欧美性猛交xxxxxx富婆| 99国产精品国产精品久久| 成人性视频网站| 成人福利在线看| 激情文学综合丁香| 精品一区免费av| 国产呦萝稀缺另类资源| 黄网站免费久久| 国产一区二区按摩在线观看| 久久国产夜色精品鲁鲁99| 免费人成网站在线观看欧美高清| 五月激情综合网| 免费高清在线视频一区·| 五月婷婷综合在线| 蜜臀a∨国产成人精品| 日本美女一区二区三区| 六月丁香婷婷色狠狠久久| 丁香五精品蜜臀久久久久99网站 | 一区二区三区四区在线播放| 亚洲成人免费观看| 国产成人在线看| 欧美日韩在线播放三区| 久久伊99综合婷婷久久伊| 亚洲精品一卡二卡| 久久电影网电视剧免费观看| 9i看片成人免费高清| 日韩一区二区电影| 亚洲欧洲日本在线| 麻豆91精品视频| 日本韩国欧美一区二区三区| 欧美电影免费观看高清完整版在 | 99久久精品国产一区| 337p亚洲精品色噜噜噜| 久久精品视频一区| 亚洲自拍偷拍av| 国产乱码精品一品二品| 欧美揉bbbbb揉bbbbb| 国产精品色噜噜| 久久精品二区亚洲w码| 久久综合久久久久88| 亚洲一区二区精品久久av| 成人三级伦理片| 精品福利在线导航| 亚洲一级二级三级在线免费观看| 国产成人高清在线| 日韩一级免费一区| 亚洲一区二区欧美激情| av电影在线不卡| 久久精品男人的天堂| 日韩精品亚洲专区| 欧美视频一区二区三区| 亚洲欧洲成人自拍| 成人性色生活片| 欧美va亚洲va香蕉在线| 亚洲二区在线观看| 色综合av在线| 亚洲天堂网中文字| www.在线成人| 欧美国产日韩一二三区| 精品一区二区三区免费| 日韩一区二区三区电影在线观看| 亚洲一卡二卡三卡四卡| 日本韩国欧美三级| 一区二区三区精密机械公司| 91热门视频在线观看| 亚洲久草在线视频| 91精品办公室少妇高潮对白| 亚洲天堂成人在线观看| 972aa.com艺术欧美|