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

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

?? pngfileformat.java

?? 源碼為Eclipse開源開發平臺桌面開發工具SWT的源代碼,
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
void setImageDataValues(byte[] data, ImageData imageData) {	byte[] result = validateBitDepth(data);	setPixelData(result, imageData);}/** * Read the image data from the data stream. This must handle * decoding the data, filtering, and interlacing. */void readPixelData(PngIdatChunk chunk, PngChunkReader chunkReader) {	decodingStream = new PngDecodingDataStream(chunk, chunkReader);	int interlaceMethod = headerChunk.getInterlaceMethod();	if (interlaceMethod == PngIhdrChunk.INTERLACE_METHOD_NONE) {		readNonInterlacedImage();	} else {		readInterlacedImage();	}	decodingStream.assertImageDataAtEnd();	decodingStream.checkAdler();}/** * Answer the number of bytes in a word-aligned row of pixel data. */int getAlignedBytesPerRow() {	return ((getBytesPerRow(headerChunk.getWidth()) + 3) / 4) * 4;}/** * Answer the number of bytes in each row of the image * data. Each PNG row is byte-aligned, so images with bit * depths less than a byte may have unused bits at the * end of each row. The value of these bits is undefined. */int getBytesPerRow() {	return getBytesPerRow(headerChunk.getWidth());}/** * Answer the number of bytes needed to represent a pixel. * This value depends on the image's color type and bit * depth.  * Note that this method rounds up if an image's pixel size * isn't byte-aligned. */int getBytesPerPixel() {	int bitsPerPixel = headerChunk.getBitsPerPixel();	return (bitsPerPixel + 7) / 8;	}/** * Answer the number of bytes in a row of the given pixel * width. Each row is byte-aligned, so images with bit * depths less than a byte may have unused bits at the * end of each row. The value of these bits is undefined. */int getBytesPerRow(int rowWidthInPixels) {	int bitsPerPixel = headerChunk.getBitsPerPixel();	int bitsPerRow = bitsPerPixel * rowWidthInPixels;	int bitsPerByte = 8;	return (bitsPerRow + (bitsPerByte - 1)) / bitsPerByte;}/** * 1. Read one of the seven frames of interlaced data. * 2. Update the imageData. * 3. Notify the image loader's listeners of the frame load. */void readInterlaceFrame(	int rowInterval,	int columnInterval,	int startRow,	int startColumn,	int frameCount) {	int width = headerChunk.getWidth();	int alignedBytesPerRow = getAlignedBytesPerRow();	int height = headerChunk.getHeight();	if (startRow >= height || startColumn >= width) return;		int pixelsPerRow = (width - startColumn + columnInterval - 1) / columnInterval;	int bytesPerRow = getBytesPerRow(pixelsPerRow);	byte[] row1 = new byte[bytesPerRow];	byte[] row2 = new byte[bytesPerRow];	byte[] currentRow = row1;		byte[] lastRow = row2;		for (int row = startRow; row < height; row += rowInterval) {		byte filterType = decodingStream.getNextDecodedByte();		for (int col = 0; col < bytesPerRow; col++) {			currentRow[col] = decodingStream.getNextDecodedByte();		}		filterRow(currentRow, lastRow, filterType);		if (headerChunk.getBitDepth() >= 8) {			int bytesPerPixel = getBytesPerPixel();			int dataOffset = (row * alignedBytesPerRow) + (startColumn * bytesPerPixel);			for (int rowOffset = 0; rowOffset < currentRow.length; rowOffset += bytesPerPixel) {				for (int byteOffset = 0; byteOffset < bytesPerPixel; byteOffset++) {					data[dataOffset + byteOffset] = currentRow[rowOffset + byteOffset];				}				dataOffset += (columnInterval * bytesPerPixel);			}		} else {			int bitsPerPixel = headerChunk.getBitDepth();			int pixelsPerByte = 8 / bitsPerPixel;			int column = startColumn;			int rowBase = row * alignedBytesPerRow;			int valueMask = 0;			for (int i = 0; i < bitsPerPixel; i++) {				valueMask <<= 1;				valueMask |= 1;			}			int maxShift = 8 - bitsPerPixel;			for (int byteOffset = 0; byteOffset < currentRow.length; byteOffset++) {				for (int bitOffset = maxShift; bitOffset >= 0; bitOffset -= bitsPerPixel) {					if (column < width) {						int dataOffset = rowBase + (column * bitsPerPixel / 8);													int value = (currentRow[byteOffset] >> bitOffset) & valueMask;						int dataShift = maxShift - (bitsPerPixel * (column % pixelsPerByte));						data[dataOffset] |= value << dataShift;					}					column += columnInterval;				}			}		}		currentRow = (currentRow == row1) ? row2 : row1;		lastRow = (lastRow == row1) ? row2 : row1;	}	setImageDataValues(data, imageData);	fireInterlacedFrameEvent(frameCount);}/** * Read the pixel data for an interlaced image from the * data stream. */void readInterlacedImage() {	readInterlaceFrame(8, 8, 0, 0, 0);	readInterlaceFrame(8, 8, 0, 4, 1);		readInterlaceFrame(8, 4, 4, 0, 2);		readInterlaceFrame(4, 4, 0, 2, 3);	readInterlaceFrame(4, 2, 2, 0, 4);	readInterlaceFrame(2, 2, 0, 1, 5);		readInterlaceFrame(2, 1, 1, 0, 6);}/** * Fire an event to let listeners know that an interlaced * frame has been loaded. * finalFrame should be true if the image has finished * loading, false if there are more frames to come. */void fireInterlacedFrameEvent(int frameCount) {	if (loader.hasListeners()) {		ImageData image = (ImageData) imageData.clone();		boolean finalFrame = frameCount == 6;		loader.notifyListeners(new ImageLoaderEvent(loader, image, frameCount, finalFrame));	}}/** * Read the pixel data for a non-interlaced image from the * data stream. * Update the imageData to reflect the new data. */void readNonInterlacedImage() {	int dataOffset = 0;	int alignedBytesPerRow = getAlignedBytesPerRow();	int bytesPerRow = getBytesPerRow();	byte[] row1 = new byte[bytesPerRow];	byte[] row2 = new byte[bytesPerRow];	byte[] currentRow = row1;		byte[] lastRow = row2;	for (int row = 0; row < headerChunk.getHeight(); row++) {		byte filterType = decodingStream.getNextDecodedByte();		for (int col = 0; col < bytesPerRow; col++) {			currentRow[col] = decodingStream.getNextDecodedByte();		}		filterRow(currentRow, lastRow, filterType);		System.arraycopy(currentRow, 0, data, dataOffset, bytesPerRow);		dataOffset += alignedBytesPerRow;		currentRow = (currentRow == row1) ? row2 : row1;		lastRow = (lastRow == row1) ? row2 : row1;	}	setImageDataValues(data, imageData);}/** * SWT does not support 16-bit depth color formats. * Convert the 16-bit data to 8-bit data. * The correct way to do this is to multiply each * 16 bit value by the value: * (2^8 - 1) / (2^16 - 1). * The fast way to do this is just to drop the low * byte of the 16-bit value. */static void compress16BitDepthTo8BitDepth(	byte[] source,	int sourceOffset,	byte[] destination, 	int destinationOffset,	int numberOfValues) {	//double multiplier = (Compatibility.pow2(8) - 1) / (Compatibility.pow2(16) - 1);	for (int i = 0; i < numberOfValues; i++) {		int sourceIndex = sourceOffset + (2 * i);		int destinationIndex = destinationOffset + i;		//int value = (source[sourceIndex] << 8) | source[sourceIndex + 1];		//byte compressedValue = (byte)(value * multiplier);		byte compressedValue = source[sourceIndex];		destination[destinationIndex] = compressedValue;	}}/** * SWT does not support 16-bit depth color formats. * Convert the 16-bit data to 8-bit data. * The correct way to do this is to multiply each * 16 bit value by the value: * (2^8 - 1) / (2^16 - 1). * The fast way to do this is just to drop the low * byte of the 16-bit value. */static int compress16BitDepthTo8BitDepth(int value) {	//double multiplier = (Compatibility.pow2(8) - 1) / (Compatibility.pow2(16) - 1);	//byte compressedValue = (byte)(value * multiplier);	return value >> 8;}/** * PNG supports four filtering types. These types are applied * per row of image data. This method unfilters the given row * based on the filterType. */void filterRow(byte[] row, byte[] previousRow, int filterType) {	int byteOffset = headerChunk.getFilterByteOffset();	switch (filterType) {		case PngIhdrChunk.FILTER_NONE:			break;		case PngIhdrChunk.FILTER_SUB:			for (int i = byteOffset; i < row.length; i++) {				int current = row[i] & 0xFF;				int left = row[i - byteOffset] & 0xFF;				row[i] = (byte)((current + left) & 0xFF);			}			break;		case PngIhdrChunk.FILTER_UP:			for (int i = 0; i < row.length; i++) {				int current = row[i] & 0xFF;				int above = previousRow[i] & 0xFF;								row[i] = (byte)((current + above) & 0xFF);			}			break;		case PngIhdrChunk.FILTER_AVERAGE:			for (int i = 0; i < row.length; i++) {				int left = (i < byteOffset) ? 0 : row[i - byteOffset] & 0xFF;				int above = previousRow[i] & 0xFF;				int current = row[i] & 0xFF;				row[i] = (byte)((current + ((left + above) / 2)) & 0xFF);			}			break;		case PngIhdrChunk.FILTER_PAETH:			for (int i = 0; i < row.length; i++) {				int left = (i < byteOffset) ? 0 : row[i - byteOffset] & 0xFF;				int aboveLeft = (i < byteOffset) ? 0 : previousRow[i - byteOffset] & 0xFF;				int above = previousRow[i] & 0xFF;								int a = Math.abs(above - aboveLeft);				int b = Math.abs(left - aboveLeft);				int c = Math.abs(left - aboveLeft + above - aboveLeft);								int preductor = 0;				if (a <= b && a <= c) {					preductor = left;				} else if (b <= c) {					preductor = above;				} else {					preductor = aboveLeft;				}								int currentValue = row[i] & 0xFF;				row[i] = (byte) ((currentValue + preductor) & 0xFF);			}			break;	}}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品电影一区亚洲| 国产精品久久看| 韩国三级中文字幕hd久久精品| 国产精品超碰97尤物18| 精品国产免费久久| 在线观看www91| 91麻豆精品国产| 日韩一区二区三区精品视频| 欧美日韩高清一区二区| 在线不卡一区二区| 精品理论电影在线| 欧美国产成人精品| 亚洲伦理在线免费看| 亚洲自拍偷拍av| 日韩福利视频导航| 久久国产乱子精品免费女| 久久精工是国产品牌吗| 高清不卡在线观看av| 91免费视频大全| 91麻豆精品国产综合久久久久久| 欧美成人r级一区二区三区| 国产欧美久久久精品影院| 亚洲日本青草视频在线怡红院| 亚洲第一精品在线| 捆绑变态av一区二区三区| 成人免费视频一区| 欧美亚洲国产一区二区三区| 日韩精品最新网址| 国产精品电影一区二区| 香蕉久久一区二区不卡无毒影院| 国产综合色在线| 在线免费视频一区二区| 精品日韩一区二区三区 | 亚洲国产精品t66y| 亚洲一级电影视频| 国产suv精品一区二区三区| 欧洲人成人精品| 国产精品色一区二区三区| 亚洲精品videosex极品| 国产真实乱对白精彩久久| 色老头久久综合| 久久综合色婷婷| 午夜国产不卡在线观看视频| 丁香六月综合激情| 日韩午夜电影av| 亚洲午夜一区二区| eeuss鲁一区二区三区| 欧美一区二区三级| 国产精品久久久久久久久晋中| 日韩精品视频网站| 97精品久久久久中文字幕| 欧美不卡在线视频| 日本在线不卡一区| 在线免费观看日本欧美| 成人欧美一区二区三区小说| 精品无码三级在线观看视频| 欧美精品vⅰdeose4hd| 亚洲精品大片www| 99久久精品久久久久久清纯| 久久久久国产一区二区三区四区 | 成人精品国产一区二区4080| 欧美成人女星排行榜| 青草av.久久免费一区| 欧美日韩一区中文字幕| 亚洲午夜久久久久久久久久久 | 国产sm精品调教视频网站| 欧美一区二区精美| 日本不卡123| 日韩一区二区三区免费观看| 日本最新不卡在线| 日韩一区二区三区视频在线 | 久久久久久久久久美女| 国产一区二区按摩在线观看| 精品国偷自产国产一区| 极品销魂美女一区二区三区| 欧美一区二区三区在线观看视频| 日韩一区精品视频| 欧美一区二区视频免费观看| 日韩 欧美一区二区三区| 91精品久久久久久久久99蜜臂| 日韩国产欧美一区二区三区| 日韩一区二区三区电影在线观看| 日韩电影免费在线看| 日韩免费观看高清完整版在线观看| 久久精品国产久精国产爱| 久久久亚洲欧洲日产国码αv| 国产成人精品免费网站| 亚洲美女屁股眼交3| 欧美色图12p| 国产在线精品免费av| 中文字幕二三区不卡| 91行情网站电视在线观看高清版| 亚洲妇女屁股眼交7| 日韩免费电影网站| 成人网在线播放| 亚洲一区免费在线观看| 欧美mv日韩mv亚洲| 91在线视频官网| 日本大胆欧美人术艺术动态| 国产亚洲综合在线| 色婷婷狠狠综合| 美女精品一区二区| 亚洲欧美日韩久久| 日韩精品一区二区三区四区| 成人免费看的视频| 丝袜脚交一区二区| 欧美高清在线视频| 欧美日韩激情一区二区三区| 国产伦精品一区二区三区视频青涩| 国产欧美日韩在线观看| 欧美三级电影在线看| 国产91精品一区二区麻豆网站 | 国产精品一区二区三区网站| 亚洲精品高清在线| 欧美韩日一区二区三区四区| 精品视频免费在线| 不卡的电视剧免费网站有什么| 亚洲1区2区3区4区| 亚洲国产成人一区二区三区| 欧美久久久久久久久久| 99九九99九九九视频精品| 麻豆精品在线播放| 亚洲国产另类av| 亚洲蜜臀av乱码久久精品蜜桃| 久久久久久久久久看片| 欧美精三区欧美精三区| 一本大道av伊人久久综合| 国产精品一二三| 美国毛片一区二区| 日韩专区在线视频| 一区二区三区成人| 最新高清无码专区| 欧美国产一区在线| 久久久噜噜噜久噜久久综合| 日韩女优电影在线观看| 欧美久久一二区| 欧美精品在欧美一区二区少妇| 一本到三区不卡视频| 国产91在线看| 粗大黑人巨茎大战欧美成人| 国产一区二区三区免费播放| 日本成人在线电影网| 午夜精品久久久久久久99樱桃| 亚洲精品你懂的| 亚洲一区二区影院| 亚洲综合999| 亚洲一区二区三区自拍| 日韩伦理免费电影| 中文字幕日本乱码精品影院| 国产精品久久久久久久久久久免费看| 2014亚洲片线观看视频免费| 欧美大片免费久久精品三p| 51午夜精品国产| 日韩免费一区二区三区在线播放| 日韩午夜激情电影| 久久在线免费观看| 国产人成亚洲第一网站在线播放 | 美女视频一区二区三区| 麻豆91在线观看| 国产在线播放一区| 丁香啪啪综合成人亚洲小说| 97国产一区二区| 欧美日韩一卡二卡三卡| 欧美一级日韩一级| ww亚洲ww在线观看国产| 亚洲国产精品成人综合色在线婷婷| 国产精品久久三区| 亚洲综合久久久| 理论电影国产精品| 成人免费视频一区| 欧美三级日韩三级| 精品福利av导航| 亚洲欧美日韩一区二区三区在线观看| 亚洲综合色丁香婷婷六月图片| 欧美aaaaaa午夜精品| 成人在线综合网| 欧美日本乱大交xxxxx| 久久综合久久鬼色| 亚洲综合一区二区精品导航| 免费观看日韩av| 99视频热这里只有精品免费| 欧美视频在线不卡| 国产婷婷一区二区| 天天综合色天天| 国产91在线看| 欧美一区二区精品在线| 国产精品午夜免费| 丝袜亚洲精品中文字幕一区| 成人在线视频一区| 日韩视频一区二区三区在线播放| 国产精品国产自产拍高清av| 日韩黄色免费网站| 97精品久久久午夜一区二区三区| 91精品国产福利| 一区二区三区在线影院| 国精品**一区二区三区在线蜜桃| 欧美专区在线观看一区| 欧美国产在线观看| 激情综合网激情| 91精品国产综合久久福利|