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

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

?? pngfileformat.java

?? 源碼為Eclipse開源開發(fā)平臺桌面開發(fā)工具SWT的源代碼,
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html *  * Contributors: *     IBM Corporation - initial API and implementation *******************************************************************************/package org.eclipse.swt.internal.image;import java.io.*;import org.eclipse.swt.*;import org.eclipse.swt.graphics.*;final class PNGFileFormat extends FileFormat {	static final int SIGNATURE_LENGTH = 8;	PngDecodingDataStream decodingStream;	PngIhdrChunk headerChunk;	PngPlteChunk paletteChunk;	PngTrnsChunk trnsChunk;	ImageData imageData;	byte[] data;	byte[] alphaPalette;/** * Skip over signature data. This has already been * verified in isPNGFile().  */void readSignature() throws IOException {	byte[] signature = new byte[SIGNATURE_LENGTH];	inputStream.read(signature);}/** * Load the PNG image from the byte stream. */ImageData[] loadFromByteStream() {	try {		readSignature();		PngChunkReader chunkReader = new PngChunkReader(inputStream);		headerChunk = chunkReader.getIhdrChunk();		int imageSize = getAlignedBytesPerRow() * headerChunk.getHeight();		data = new byte[imageSize];				imageData = ImageData.internal_new(			headerChunk.getWidth(),			headerChunk.getHeight(),			headerChunk.getSwtBitsPerPixel(),			new PaletteData(0, 0, 0),			4,			data,			0,			null,			null,			-1,			-1,			SWT.IMAGE_PNG,			0,			0,			0,			0);							if (headerChunk.usesDirectColor()) {			imageData.palette = headerChunk.getPaletteData();		}				// Read and process chunks until the IEND chunk is encountered.		while (chunkReader.hasMoreChunks()) {			readNextChunk(chunkReader);		}								return new ImageData[] {imageData};	} catch (IOException e) {		SWT.error(SWT.ERROR_INVALID_IMAGE);		return null;	}}/** * Read and handle the next chunk of data from the  * PNG file. */void readNextChunk(PngChunkReader chunkReader) {	PngChunk chunk = chunkReader.readNextChunk();	switch (chunk.getChunkType()) {		case PngChunk.CHUNK_IEND:			break;		case PngChunk.CHUNK_PLTE:			if (!headerChunk.usesDirectColor()) {				paletteChunk = (PngPlteChunk) chunk;				imageData.palette = paletteChunk.getPaletteData();									}						break;		case PngChunk.CHUNK_tRNS:			PngTrnsChunk trnsChunk = (PngTrnsChunk) chunk;			if (trnsChunk.getTransparencyType(headerChunk) == 				PngTrnsChunk.TRANSPARENCY_TYPE_PIXEL) 			{				imageData.transparentPixel = 					trnsChunk.getSwtTransparentPixel(headerChunk);			} else {				alphaPalette = trnsChunk.getAlphaValues(headerChunk, paletteChunk);				int transparentCount = 0, transparentPixel = -1;				for (int i = 0; i < alphaPalette.length; i++) {					if ((alphaPalette[i] & 0xFF) != 255) {						transparentCount++;						transparentPixel = i;					}				}				if (transparentCount == 0) {					alphaPalette = null;				} else if (transparentCount == 1 && alphaPalette[transparentPixel] == 0) {					alphaPalette = null;					imageData.transparentPixel = transparentPixel;				}			}			break;		case PngChunk.CHUNK_IDAT:			if (chunkReader.readPixelData()) {				// All IDAT chunks in an image file must be				// sequential. If the pixel data has already				// been read and another IDAT block is encountered,				// then this is an invalid image.				SWT.error(SWT.ERROR_INVALID_IMAGE);			} else {				// Read in the pixel data for the image. This should				// go through all the image's IDAT chunks. 					PngIdatChunk dataChunk = (PngIdatChunk) chunk;				readPixelData(dataChunk, chunkReader);							}			break;		default:			if (chunk.isCritical()) {				// All critical chunks must be supported.				SWT.error(SWT.ERROR_NOT_IMPLEMENTED);			}	}}void unloadIntoByteStream(ImageData p1) {	SWT.error(SWT.ERROR_NOT_IMPLEMENTED);}boolean isFileFormat(LEDataInputStream stream) {	try {		byte[] signature = new byte[SIGNATURE_LENGTH];		stream.read(signature);		stream.unread(signature);		if ((signature[0] & 0xFF) != 137) return false; //137		if ((signature[1] & 0xFF) != 80) return false; //P		if ((signature[2] & 0xFF) != 78) return false; //N		if ((signature[3] & 0xFF) != 71) return false; //G		if ((signature[4] & 0xFF) != 13) return false; //<RETURN>		if ((signature[5] & 0xFF) != 10) return false; //<LINEFEED>		if ((signature[6] & 0xFF) != 26) return false; //<CTRL/Z>		if ((signature[7] & 0xFF) != 10) return false; //<LINEFEED>				return true;	} catch (Exception e) {		return false;	}}/** * SWT does not support 16-bit depths. If this image uses * 16-bit depths, convert the data to an 8-bit depth. */byte[] validateBitDepth(byte[] data) {	if (headerChunk.getBitDepth() > 8) {		byte[] result = new byte[data.length / 2];		compress16BitDepthTo8BitDepth(data, 0, result, 0, result.length);		return result;	} else {		return data;	}}/** * SWT does not support greyscale as a color type. For * plain grayscale, we create a palette. For Grayscale * with Alpha, however, we need to convert the pixels * to use RGB values. * Note: This method assumes that the bit depth of the * data has already been restricted to 8 or less. */void setPixelData(byte[] data, ImageData imageData) {	switch (headerChunk.getColorType()) {		case PngIhdrChunk.COLOR_TYPE_GRAYSCALE_WITH_ALPHA:		{			int width = imageData.width;			int height = imageData.height;			int destBytesPerLine = imageData.bytesPerLine;			/*			* If the image uses 16-bit depth, it is converted			* to an 8-bit depth image.			*/			int srcBytesPerLine = getAlignedBytesPerRow();			if (headerChunk.getBitDepth() > 8) srcBytesPerLine /= 2;			byte[] rgbData = new byte[destBytesPerLine * height];			byte[] alphaData = new byte[width * height];			for (int y = 0; y < height; y++) {				int srcIndex = srcBytesPerLine * y;				int destIndex = destBytesPerLine * y;				int destAlphaIndex = width * y;				for (int x = 0; x < width; x++) {					byte grey = data[srcIndex];					byte alpha = data[srcIndex + 1];					rgbData[destIndex + 0] = grey;					rgbData[destIndex + 1] = grey;					rgbData[destIndex + 2] = grey;					alphaData[destAlphaIndex] = alpha;					srcIndex += 2;					destIndex += 3;					destAlphaIndex++;				}			}			imageData.data = rgbData;			imageData.alphaData = alphaData;			break;		}		case PngIhdrChunk.COLOR_TYPE_RGB_WITH_ALPHA:		{			int width = imageData.width;			int height = imageData.height;			int destBytesPerLine = imageData.bytesPerLine;			int srcBytesPerLine = getAlignedBytesPerRow();			/*			* If the image uses 16-bit depth, it is converted			* to an 8-bit depth image.			*/			if (headerChunk.getBitDepth() > 8) srcBytesPerLine /= 2;			byte[] rgbData = new byte[destBytesPerLine * height];			byte[] alphaData = new byte[width * height];			for (int y = 0; y < height; y++) {				int srcIndex = srcBytesPerLine * y;				int destIndex = destBytesPerLine * y;				int destAlphaIndex = width * y;				for (int x = 0; x < width; x++) {					rgbData[destIndex + 0] = data[srcIndex + 0];					rgbData[destIndex + 1] = data[srcIndex + 1];					rgbData[destIndex + 2] = data[srcIndex + 2];					alphaData[destAlphaIndex] = data[srcIndex + 3];					srcIndex += 4;					destIndex += 3;					destAlphaIndex++;				}			}			imageData.data = rgbData;			imageData.alphaData = alphaData;			break;		}				case PngIhdrChunk.COLOR_TYPE_RGB:			imageData.data = data;			break;		case PngIhdrChunk.COLOR_TYPE_PALETTE:			imageData.data = data;			if (alphaPalette != null) {				int size = imageData.width * imageData.height;				byte[] alphaData = new byte[size];				byte[] pixelData = new byte[size];				imageData.getPixels(0, 0, size, pixelData, 0);				for (int i = 0; i < pixelData.length; i++) {					alphaData[i] = alphaPalette[pixelData[i] & 0xFF];				}				imageData.alphaData = alphaData;			}			break;		default:			imageData.data = data;			break;	}}/** * PNG supports some color types and bit depths that are  * unsupported by SWT. If the image uses an unsupported * color type (either of the gray scale types) or bit * depth (16), convert the data to an SWT-supported * format. Then assign the data into the ImageData given. */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品亚洲人成人网 | 亚洲精品国产一区二区精华液| 一区二区三区四区蜜桃 | 成人免费黄色在线| 91精品国产91综合久久蜜臀| 亚洲精品欧美在线| 国产成人精品免费在线| 日韩你懂的在线观看| 亚洲国产另类av| 成人妖精视频yjsp地址| 26uuu成人网一区二区三区| 日本不卡高清视频| 欧美日韩免费观看一区二区三区| 中文字幕中文字幕一区二区| 国产一区二区视频在线| 欧美大片一区二区三区| 人人狠狠综合久久亚洲| 欧美另类高清zo欧美| 亚洲美女精品一区| 99麻豆久久久国产精品免费| 国产欧美一区二区精品性色超碰| 狠狠网亚洲精品| 日韩欧美一区中文| 天天色综合天天| 制服丝袜亚洲色图| 天天操天天干天天综合网| 欧美日韩高清一区二区| 水蜜桃久久夜色精品一区的特点| 一本久久综合亚洲鲁鲁五月天 | 久久久久成人黄色影片| 久久精品国产网站| 日韩欧美区一区二| 国产在线精品一区在线观看麻豆| 精品播放一区二区| 国产精品69久久久久水密桃 | 欧美一区二区人人喊爽| 日韩av网站免费在线| 欧美刺激脚交jootjob| 国内精品伊人久久久久影院对白| 国产精品久久99| 91视频你懂的| 亚洲高清免费视频| 欧美一区二区福利在线| 激情文学综合插| 国产精品天干天干在线综合| 99re这里只有精品视频首页| 亚洲精品伦理在线| 欧美精品 日韩| 捆绑变态av一区二区三区| 久久久亚洲高清| 91免费版在线看| 亚洲aaa精品| 精品少妇一区二区三区在线播放| 国产一区二区电影| 亚洲裸体在线观看| 欧美一区二区网站| 国产精品18久久久久久久久| 国产精品久久久久久久久免费丝袜| 色呦呦国产精品| 久久精品国产99| 亚洲麻豆国产自偷在线| 日韩一区二区三区观看| 国产成人自拍网| 亚洲成a人v欧美综合天堂下载 | 国产精品成人午夜| 欧美久久一区二区| 国产成人8x视频一区二区| 亚洲成人综合视频| 亚洲成人一二三| 久久综合狠狠综合久久激情 | 成人一区在线观看| 午夜精彩视频在线观看不卡| 国产女主播视频一区二区| 欧美亚一区二区| 国产成人99久久亚洲综合精品| 亚洲第一狼人社区| 欧美国产精品专区| 欧美一级一级性生活免费录像| 99re8在线精品视频免费播放| 久久er精品视频| 亚洲综合一二区| 中文字幕在线观看不卡| 精品国产一区二区亚洲人成毛片| 欧美在线你懂的| 91在线视频观看| 国产一区福利在线| 热久久免费视频| 五月天亚洲婷婷| 亚洲天堂a在线| 国产日韩欧美综合在线| 日韩一区二区电影在线| 欧美日韩国产成人在线免费| 99re成人精品视频| 成人视屏免费看| 国产精品白丝jk白祙喷水网站| 日本aⅴ精品一区二区三区| 亚洲综合图片区| 亚洲视频香蕉人妖| 国产精品嫩草99a| 国产日韩欧美激情| 久久综合色婷婷| 欧美成人一级视频| 日韩免费观看2025年上映的电影 | 欧美午夜电影在线播放| 99re热这里只有精品视频| 国产精品12区| 国产成人精品亚洲日本在线桃色| 激情综合色丁香一区二区| 蜜桃视频一区二区三区| 青青草一区二区三区| 偷偷要91色婷婷| 日本伊人色综合网| 奇米亚洲午夜久久精品| 老司机精品视频一区二区三区| 美女一区二区久久| 久久99这里只有精品| 激情综合色播五月| 国产xxx精品视频大全| 成人午夜免费av| 99久久综合国产精品| 色妹子一区二区| 欧美视频中文字幕| 91精品国产综合久久精品| 国产精品美女久久久久高潮| 国产日产精品一区| 中文字幕一区不卡| 亚洲一卡二卡三卡四卡无卡久久 | 亚洲欧洲日韩av| 亚洲精品亚洲人成人网| 天天综合色天天综合色h| 久久精品国产77777蜜臀| 国产高清亚洲一区| 99久久国产综合精品女不卡| 在线免费观看日本欧美| 欧美精品一级二级三级| 26uuu亚洲婷婷狠狠天堂| 国产亚洲精久久久久久| 亚洲欧美视频在线观看视频| 日韩**一区毛片| 成人午夜电影久久影院| 欧美日韩免费视频| 久久久久久**毛片大全| 依依成人精品视频| 美国欧美日韩国产在线播放| 成人一级片网址| 欧美精品aⅴ在线视频| 欧美国产日本韩| 人人精品人人爱| 99久久精品99国产精品 | 亚洲丝袜制服诱惑| 午夜久久久久久久久久一区二区| 国产精品888| 欧美情侣在线播放| 综合中文字幕亚洲| 秋霞电影网一区二区| caoporm超碰国产精品| 欧美久久久久久久久| 成人欧美一区二区三区白人| 免费xxxx性欧美18vr| 一本大道久久a久久精二百| 久久久久国产精品麻豆| 婷婷丁香久久五月婷婷| www.久久精品| 亚洲精品在线观看网站| 亚洲成av人影院| 一本久久精品一区二区| 久久久久国产精品厨房| 奇米精品一区二区三区在线观看| 色婷婷精品久久二区二区蜜臂av | 精品国产免费人成电影在线观看四季 | 99久久精品国产一区| 精品精品欲导航| 亚洲成人自拍偷拍| 91麻豆免费观看| 中文字幕亚洲一区二区av在线| 精品中文字幕一区二区小辣椒| 欧美日韩国产高清一区二区| 亚洲男帅同性gay1069| 国产乱国产乱300精品| 欧美一区二区精品| 日韩精品电影在线| 欧美日韩精品高清| 夜夜揉揉日日人人青青一国产精品| 成人听书哪个软件好| 久久久久国产精品麻豆| 国产毛片精品视频| 久久久五月婷婷| 国产福利91精品一区二区三区| 日韩免费观看高清完整版| 日韩精品午夜视频| 欧美日产在线观看| 五月婷婷色综合| 91精品国产一区二区人妖| 五月综合激情网| 91精品国产91久久久久久一区二区| 亚洲第一av色| 欧美一区二区三区白人| 久久精品国产一区二区三区免费看| 欧美一区二区三区人| 国产自产视频一区二区三区|