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

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

?? bmploader.java

?? java寫的MP3播放器
?? JAVA
字號(hào):
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()
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看亚洲专区| 精品国产1区二区| 美女尤物国产一区| 日韩伦理av电影| 精品日韩在线观看| 欧美在线观看18| 成人app下载| 蜜桃av噜噜一区二区三区小说| 国产欧美日本一区二区三区| 欧美午夜精品免费| av午夜精品一区二区三区| 久久爱另类一区二区小说| 亚洲一区二区三区影院| 国产精品久久久久一区二区三区共| 69堂国产成人免费视频| 色婷婷av久久久久久久| 成人午夜激情在线| 精品一区二区免费在线观看| 天堂午夜影视日韩欧美一区二区| 国产精品成人免费精品自在线观看| 精品欧美一区二区久久| 欧美日韩亚洲高清一区二区| 91婷婷韩国欧美一区二区| 国产麻豆精品视频| 青草国产精品久久久久久| 亚洲一区二区三区四区不卡| 亚洲欧美日韩国产手机在线| 中文字幕 久热精品 视频在线| 久久网站热最新地址| 日韩一级完整毛片| 7777精品伊人久久久大香线蕉超级流畅 | 国产亚洲欧美一区在线观看| 7777精品伊人久久久大香线蕉完整版 | 国产精品久久午夜夜伦鲁鲁| 欧美激情一区二区三区蜜桃视频 | 亚洲天堂精品在线观看| 欧美激情在线观看视频免费| 久久久久久97三级| 精品免费国产二区三区| 欧美成人福利视频| 日韩精品中文字幕在线不卡尤物| 欧美伦理影视网| 欧美电影一区二区三区| 欧美猛男男办公室激情| 91.成人天堂一区| 欧美日韩www| 91精品麻豆日日躁夜夜躁| 欧美精品在线视频| 91精品国产美女浴室洗澡无遮挡| 欧美老年两性高潮| 欧美一级欧美三级| 日韩一区二区精品在线观看| 精品少妇一区二区三区日产乱码| 26uuu国产日韩综合| 国产午夜精品一区二区三区嫩草| 国产日韩亚洲欧美综合| 国产精品私人自拍| 中文字幕一区免费在线观看| 亚洲欧美日韩国产综合| 亚洲午夜电影在线观看| 日本伊人色综合网| 狠狠色狠狠色综合| 国产.欧美.日韩| 色视频成人在线观看免| 91精品国产综合久久精品图片| 日韩欧美视频一区| 久久蜜桃香蕉精品一区二区三区| 欧美激情一区二区三区蜜桃视频| 亚洲视频图片小说| 午夜精品一区二区三区三上悠亚| 毛片不卡一区二区| 成人性生交大片免费看中文网站| 一本久久a久久免费精品不卡| 欧美三级韩国三级日本一级| 日韩一卡二卡三卡| 国产精品国产三级国产有无不卡| 一区二区欧美在线观看| 日本免费新一区视频| 国产电影精品久久禁18| 欧洲精品中文字幕| 日韩三级电影网址| 中文字幕一区二区在线观看| 日本视频中文字幕一区二区三区| 国产精品正在播放| 欧美日韩在线免费视频| 久久九九久久九九| 亚洲国产精品一区二区www在线 | 欧美高清视频www夜色资源网| 日韩精品中午字幕| 亚洲精品国产成人久久av盗摄| 美女国产一区二区三区| 99久久久精品免费观看国产蜜| 在线电影国产精品| 国产精品第五页| 久久国产日韩欧美精品| 在线免费观看视频一区| 精品国产1区2区3区| 亚洲一区二区视频| 高清国产午夜精品久久久久久| 在线播放中文字幕一区| 国产精品久久午夜| 精品无人码麻豆乱码1区2区 | 奇米精品一区二区三区在线观看一| 国产精品77777竹菊影视小说| 欧美日韩一区二区三区在线看| 国产欧美日韩精品一区| 男男视频亚洲欧美| 在线看一区二区| 国产欧美一区二区精品性色超碰| 日韩成人免费在线| 欧美综合视频在线观看| 中文成人综合网| 久久丁香综合五月国产三级网站| 欧美三级日韩三级国产三级| 亚洲视频每日更新| 成人视屏免费看| 久久精品亚洲精品国产欧美| 奇米综合一区二区三区精品视频| 欧美调教femdomvk| 综合久久给合久久狠狠狠97色| 国产精品影视在线| 欧美精品一区二区三| 首页亚洲欧美制服丝腿| 欧美视频日韩视频在线观看| 中文字幕亚洲视频| 成人污污视频在线观看| 精品国产乱码久久久久久免费| 午夜久久久影院| 欧美日韩一本到| 亚洲国产欧美日韩另类综合 | 日韩高清欧美激情| 欧美日韩高清一区| 亚洲bt欧美bt精品777| 欧美亚日韩国产aⅴ精品中极品| 成人免费在线播放视频| 成人美女在线视频| 欧美国产97人人爽人人喊| 成人免费视频网站在线观看| 欧美国产日韩一二三区| 丁香另类激情小说| 国产三级欧美三级日产三级99| 国产精品综合二区| 国产三级一区二区| 成人精品gif动图一区| 国产精品女上位| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 1区2区3区精品视频| www.99精品| 亚洲男女一区二区三区| 色综合久久久久久久久| 亚洲一区二区三区四区在线免费观看 | 久久97超碰色| 亚洲精品一区在线观看| 国产成人精品午夜视频免费| 国产精品丝袜91| 色综合久久精品| 亚洲第一福利一区| 日韩一级在线观看| 国产剧情一区在线| 综合激情成人伊人| 欧美日韩国产免费一区二区| 五月激情综合色| 精品蜜桃在线看| 99麻豆久久久国产精品免费优播| 亚洲免费资源在线播放| 精品视频在线看| 激情图片小说一区| 中文字幕巨乱亚洲| 91国偷自产一区二区开放时间| 首页亚洲欧美制服丝腿| 久久午夜电影网| 91电影在线观看| 国内成人精品2018免费看| 日本一区二区在线不卡| 欧洲人成人精品| 国产一区二区三区av电影| 亚洲视频一二三| 日韩视频在线一区二区| 丁香婷婷综合色啪| 亚洲一区二区三区精品在线| 欧美sm美女调教| 色天天综合色天天久久| 狠狠色丁香久久婷婷综| 一区二区三区四区中文字幕| 日韩视频在线观看一区二区| 成人动漫一区二区在线| 日韩精品视频网站| 国产精品网曝门| 91精品在线一区二区| av电影在线观看完整版一区二区| 午夜久久电影网| 椎名由奈av一区二区三区| 日韩美一区二区三区| 色综合久久中文综合久久牛| 久久精品国产精品亚洲综合| 亚洲色图色小说| 久久蜜臀精品av| 欧美精品 国产精品| 91丨九色丨蝌蚪富婆spa| 久久国产精品99久久人人澡|