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

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

?? pluginpsd.cpp

?? 一款最完整的工業組態軟源代碼
?? CPP
字號:
// ==========================================================
// Photoshop Loader
//
// Design and implementation by
// - Floris van den Berg (flvdberg@wxs.nl)
//
// Based on public domain code created and
// published by Thatcher Ulrich (ulrich@world.std.com)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================

#include "FreeImage.h"

// ==========================================================
// Bitmap pointer access macros
// ==========================================================

#define BP_START(DIB, WIDTH, HEIGHT) \
	int xxxscanline = 0; \
	unsigned *xxxbits = (unsigned *)FreeImage_GetScanLine(DIB, HEIGHT - 1 - xxxscanline); \
	unsigned *xxxp = xxxbits;

#define BP_NEXT(DIB, WIDTH, HEIGHT) \
	xxxp++; \
	if (xxxp - xxxbits == WIDTH) { \
		xxxscanline++; \
		xxxbits = (unsigned *)FreeImage_GetScanLine(DIB, HEIGHT - 1 - xxxscanline); \
		xxxp = xxxbits; \
	}

#define BP_SETVALUE(VALUE, OFFSET) \
	((unsigned char *)xxxp)[OFFSET] = VALUE;

// ==========================================================
// Internal functions
// ==========================================================

static unsigned
Read8(FreeImageIO *io, fi_handle handle) {
	unsigned char i = 0;
	io->read_proc(&i, 1, 1, handle);
	return i;
}

static unsigned
Read16(FreeImageIO *io, fi_handle handle) {
	// reads a two-byte big-endian integer from the given file and returns its value.
	// assumes unsigned.

	unsigned hi = Read8(io, handle);
	unsigned lo = Read8(io, handle);
	return lo + (hi << 8);
}

static unsigned
Read32(FreeImageIO *io, fi_handle handle) {
	// reads a four-byte big-endian integer from the given file and returns its value.
	// assumes unsigned.

	unsigned b3 = Read8(io, handle);
	unsigned b2 = Read8(io, handle);
	unsigned b1 = Read8(io, handle);
	unsigned b0 = Read8(io, handle);
	return (b3 << 24) + (b2 << 16) + (b1 << 8) + b0;
}

// ----------------------------------------------------------

static void
ScanForResolution(float* hres, float* vres, FreeImageIO *io, fi_handle handle, int width, int height, int channel_count, int byte_count) {
	// scans through the next byte_count bytes of the file, looking for an
	// image resource block encoding the image's resolution.  Returns the resolution(s),
	// if found, in the pointed-to floats.  Units are in pixels/meter.

	while (byte_count) {
		// read the image resource block header.

		if (Read32(io, handle) != 0x3842494D /* "8BIM" */)
			throw "image resource block has unknown signature";

		int	id = Read16(io, handle);

		// skip the name.

		int	name_length = Read8(io, handle) | 1;	// name_length must be odd, so that total including size byte is even.

		io->seek_proc(handle, name_length, SEEK_CUR);

		// get the size of the data block.

		int	data_size = Read32(io, handle);

		if ((data_size & 1) == 1)
			data_size++; // block size must be even.		

		// account for header size.

		byte_count -= 11 + name_length;

		// if this block is a resolution info structure, then get the resolution.

		if (id == 0x03ED) {
			int junk;

			int	hres_fixed = Read32(io, handle);
			junk = Read16(io, handle);	// display units of hres.
			junk = Read16(io, handle);	// display units of width.

			int	vres_fixed = Read32(io, handle);
			junk = Read16(io, handle);	// display units of vres.
			junk = Read16(io, handle);	// display units of height.

			byte_count -= data_size;
			data_size -= 16;

			// skip any extra bytes at the end of this block...

			if (data_size > 0)
				io->seek_proc(handle, data_size, SEEK_CUR);			

			// need to convert resolution figures from fixed point, pixels/inch
			// to floating point, pixels/meter.

			*hres = hres_fixed * ((float)39.4 / (float)65536.0);
			*vres = vres_fixed * ((float)39.4 / (float)65536.0);			
		} else {
			// skip the rest of this block.

			io->seek_proc(handle, data_size, SEEK_CUR);

			byte_count -= data_size;
		}
	}
}

// ----------------------------------------------------------

static FIBITMAP *
LoadPSDRGB(FreeImageIO *io, fi_handle handle, int width, int height, int channel_count) {
	// skip the mode data.  (it's the palette for indexed color; other info for other modes.)
	
	long area = width * height;

	int	mode_data_count = Read32(io, handle);
  
	if (mode_data_count)
		io->seek_proc(handle, mode_data_count, SEEK_CUR);	

	// skip the image resources.  (resolution, pen tool paths, alpha channel names, etc)

	int	resource_data_count = Read32(io, handle);

	if (resource_data_count)
		io->seek_proc(handle, resource_data_count, SEEK_CUR);	

	// skip the reserved data

	int	reserved_data_count = Read32(io, handle);

	if (reserved_data_count)
		io->seek_proc(handle, reserved_data_count, SEEK_CUR);

	// find out if the data is compressed
	//   0: no compressiod
	//   1: RLE compressed

	unsigned compression = Read16(io, handle);

	if ((compression > 1) || (compression < 0))
		return NULL;	

	// some formatting information about the channels

	const struct ChannelInfo {
		int	ofs, deflt;
	} Channel[4] = {
		{  FI_RGBA_RED,   0 },	// red
		{  FI_RGBA_GREEN, 0 },	// green
		{  FI_RGBA_BLUE,  0 },	// blue
		{  FI_RGBA_ALPHA, 255 }	// alpha
	};

	// Create the destination bitmap

	FIBITMAP *dib = FreeImage_Allocate(width, height, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);

	// finally, read the image data.

	if (compression) {
		// the RLE-compressed data is preceeded by a 2-byte data count for each row in the data

		io->seek_proc(handle, height * channel_count * 2, SEEK_CUR);

		// read the RLE data by channel

		for (int channel = 0; channel < 4; channel++) {
			const ChannelInfo &c = Channel[channel];

			BP_START(dib, width, height)

			if (channel >= channel_count) {
				// fill this channel with default data.

				for (int i = 0; i < area; i++) {
					BP_SETVALUE(c.deflt, c.ofs);
					BP_NEXT(dib, width, height)
				}
			} else {
				// read the RLE data.

				int	count = 0;

				while (count < area) {
					int	len = Read8(io, handle);

					if (len == 128) {
						// nop
					} else if (len < 128) {
						// copy next len + 1 bytes literally.

						len++;
						// check for buffer overrun
						if ((count + len) > area) {
							len = area - count; 
						}
						count += len;

						while (len) {
							BP_SETVALUE(Read8(io, handle), c.ofs);
							BP_NEXT(dib, width, height)

							len--;
						}
					} else if (len > 128) {
						// next -len + 1 bytes in the dest are replicated from next source byte.
						// (interpret len as a negative 8-bit int.)

						len ^= 0x0FF;
						len += 2;
						// check for buffer overrun
						if ((count + len) > area) {
							len = area - count; 
						}
						count += len;

						unsigned val = Read8(io, handle);

						while (len) {
							BP_SETVALUE(val, c.ofs);
							BP_NEXT(dib, width, height)

							len--;
						}
					}
				}
			}			
		}		
	} else {
		// we're at the raw image data.  it's each channel in order (Red, Green, Blue, Alpha, ...)
		// where each channel consists of an 8-bit value for each pixel in the image.

		for (int channel = 0; channel < 4; channel++) {
			const ChannelInfo &c = Channel[channel];
			
			BP_START(dib, width, height)

			if (channel > channel_count) {
				// fill this channel with default data.

				for (int i = 0; i < area; i++) {
					BP_SETVALUE(c.deflt, c.ofs);
					BP_NEXT(dib, width, height)
				}
			} else {
				// read the data

				for (int i = 0; i < area; i++) {
					BP_SETVALUE(Read8(io, handle), c.ofs);
					BP_NEXT(dib, width, height)
				}
			}
		}
	}
	
	return dib;
}

// ==========================================================
// Plugin Interface
// ==========================================================

static int s_format_id;

// ==========================================================
// Plugin Implementation
// ==========================================================

static const char * DLL_CALLCONV
Format() {
	return "PSD";
}

static const char * DLL_CALLCONV
Description() {
	return "Adobe Photoshop";
}

static const char * DLL_CALLCONV
Extension() {
	return "psd";
}

static const char * DLL_CALLCONV
MimeType() {
	return "image/freeimage-psd";
}

static BOOL DLL_CALLCONV
Validate(FreeImageIO *io, fi_handle handle) {
	return (Read32(io, handle) == 0x38425053);
}

static BOOL DLL_CALLCONV
SupportsExportDepth(int depth) {
	return FALSE;
}

static BOOL DLL_CALLCONV 
SupportsExportType(FREE_IMAGE_TYPE type) {
	return FALSE;
}

// ----------------------------------------------------------

static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
	try {
		if (Read32(io, handle) == 0x38425053) {
			if (Read16(io, handle) == 1) {
				// 6 reserved bytes.

				Read32(io, handle);
				Read16(io, handle);

				// Read the number of channels (R, G, B, A, etc).

				unsigned channel_count = Read16(io, handle);

				if (channel_count >= 0 && channel_count <= 16) {
					unsigned height = Read32(io, handle);
					unsigned width = Read32(io, handle);

					if (Read16(io, handle) == 8) {
						unsigned mode = Read16(io, handle);

						// Valid options are:
						//   0: Bitmap (not implemented)
						//   1: Grayscale (not implemented)
						//   2: Indexed color (not implemented)
						//   3: RGB color
						//   4: CMYK color (not implemented)
						//   7: Multichannel (not implemented)
						//   8: Duotone (not implemented)
						//   9: Lab color (not implemented)

						switch (mode) {
							case 3 :
								return LoadPSDRGB(io, handle, width, height, channel_count);

							default :
								throw "color mode not supported";
						}
					}
				}
			}
		}
	} catch(const char *message) {
		FreeImage_OutputMessageProc(s_format_id, message);
	}

	return NULL;
}

// ==========================================================
//   Init
// ==========================================================

void DLL_CALLCONV
InitPSD(Plugin *plugin, int format_id) {
	s_format_id = format_id;

	plugin->format_proc = Format;
	plugin->description_proc = Description;
	plugin->extension_proc = Extension;
	plugin->regexpr_proc = NULL;
	plugin->open_proc = NULL;
	plugin->close_proc = NULL;
	plugin->pagecount_proc = NULL;
	plugin->pagecapability_proc = NULL;
	plugin->load_proc = Load;
	plugin->save_proc = NULL;
	plugin->validate_proc = Validate;
	plugin->mime_proc = MimeType;
	plugin->supports_export_bpp_proc = SupportsExportDepth;
	plugin->supports_export_type_proc = SupportsExportType;
	plugin->supports_icc_profiles_proc = NULL;	// not implemented yet;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆国产欧美日韩综合精品二区| 欧美美女视频在线观看| 欧美性感一类影片在线播放| 欧美成人vr18sexvr| 亚洲黄色录像片| 成人自拍视频在线| 欧美va亚洲va国产综合| 婷婷中文字幕综合| 91亚洲国产成人精品一区二三| 欧美成人一区二区三区在线观看| 亚洲图片一区二区| 色综合久久九月婷婷色综合| 国产精品久久久久久久久免费相片| 蜜乳av一区二区| 欧美日韩一级二级| 一区二区三区精品视频在线| 成人动漫一区二区在线| 久久伊人蜜桃av一区二区| 久久精品免费观看| 欧美高清视频不卡网| 亚洲制服丝袜av| 91色九色蝌蚪| 亚洲日韩欧美一区二区在线| 成人精品高清在线| 日本一区二区电影| 国产精品一二三区| 国产欧美日韩综合| 丁香婷婷综合网| 国产清纯美女被跳蛋高潮一区二区久久w| 免费成人性网站| 欧美一区二区久久久| 老司机精品视频导航| 日韩精品一区二区三区视频播放| 蜜臀av一区二区三区| 精品91自产拍在线观看一区| 五月天久久比比资源色| 欧美色偷偷大香| 视频在线观看国产精品| 欧美电影免费观看高清完整版在 | 精一区二区三区| 欧美大胆一级视频| 国产美女娇喘av呻吟久久| 欧美激情综合在线| 99免费精品视频| 亚洲男同性视频| 欧美综合一区二区| 五月天激情小说综合| 欧美v国产在线一区二区三区| 国产一区二区三区美女| 中文字幕亚洲不卡| 欧美日韩在线播放| 裸体健美xxxx欧美裸体表演| 国产婷婷精品av在线| 91片黄在线观看| 日本亚洲免费观看| 欧美激情在线看| 色偷偷久久一区二区三区| 亚洲bt欧美bt精品777| 精品国产一区二区国模嫣然| 成人97人人超碰人人99| 午夜精品视频一区| 久久久蜜桃精品| 色狠狠桃花综合| 久久99精品一区二区三区| 国产精品久久国产精麻豆99网站| 在线电影欧美成精品| 国产乱子伦一区二区三区国色天香| 中文字幕一区二区三| 日韩视频免费观看高清在线视频| 高清久久久久久| 日本va欧美va精品| 成人欧美一区二区三区黑人麻豆| 欧美肥胖老妇做爰| 99精品国产一区二区三区不卡| 首页综合国产亚洲丝袜| 中文字幕精品一区| 欧美一区二区三区白人| 一本大道av一区二区在线播放| 老汉av免费一区二区三区| 中文成人综合网| 欧美成人a∨高清免费观看| 色婷婷国产精品| 国产成人精品网址| 免费精品99久久国产综合精品| 亚洲精品五月天| 亚洲永久免费视频| 在线观看国产日韩| 久久国产日韩欧美精品| 亚洲人成小说网站色在线 | 成人福利电影精品一区二区在线观看| 亚洲成av人影院| 亚洲欧洲www| 国产日韩欧美在线一区| 欧美一区二区三区免费大片| 欧美调教femdomvk| 99精品欧美一区| 成人午夜av影视| 国产在线精品不卡| 美国欧美日韩国产在线播放| 亚洲一区二区三区在线播放| ...xxx性欧美| 国产精品美女久久久久高潮| 久久综合九色综合97婷婷| 51午夜精品国产| 欧美精品一级二级| 欧美日韩卡一卡二| 日本韩国欧美一区二区三区| 成人黄色电影在线| 成人免费看视频| 懂色av一区二区三区免费看| 成人网在线免费视频| 国产麻豆一精品一av一免费| 久久se精品一区精品二区| 日韩成人av影视| 麻豆精品蜜桃视频网站| 捆绑调教一区二区三区| 蜜臀国产一区二区三区在线播放| 另类欧美日韩国产在线| 国产一区二区在线观看免费| 狠狠色狠狠色综合日日91app| 日本女人一区二区三区| 蜜桃av一区二区三区| 国产在线播放一区三区四| 国产精品影视网| 成人av在线播放网址| 91久久线看在观草草青青| 欧美亚洲综合色| 欧美一区二区三区喷汁尤物| 久久这里只有精品首页| 国产精品麻豆久久久| 亚洲久本草在线中文字幕| 亚洲一区二区在线免费观看视频| 亚洲制服欧美中文字幕中文字幕| 日韩av一区二区三区四区| 精品亚洲成av人在线观看| 成人午夜伦理影院| 欧美主播一区二区三区| 欧美大片国产精品| 国产精品女同互慰在线看 | 中文字幕一区不卡| 一区二区三区欧美久久| 日韩成人精品在线观看| 国产精品18久久久久久久久 | 韩国午夜理伦三级不卡影院| 粉嫩aⅴ一区二区三区四区五区 | 国产白丝精品91爽爽久久| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 亚洲人成在线播放网站岛国| 亚洲成在人线在线播放| 九色综合狠狠综合久久| av电影在线观看一区| 在线成人免费观看| 久久久久久久国产精品影院| 亚洲精品视频自拍| 久久不见久久见中文字幕免费| av电影在线不卡| 精品美女被调教视频大全网站| 中文字幕一区二区三区乱码在线| 日本怡春院一区二区| 国产99久久久久久免费看农村| 欧美色涩在线第一页| 国产精品久久久久永久免费观看| 午夜婷婷国产麻豆精品| 成人免费黄色大片| 精品久久久久久久久久久久包黑料 | 亚洲自拍偷拍av| 国产精品伊人色| 欧美一区三区四区| 亚洲免费av在线| 国产精品一区二区x88av| 在线电影院国产精品| 日韩一区在线播放| 国产91精品一区二区麻豆亚洲| 欧美精品视频www在线观看 | 欧美精品一区二区不卡| 一区二区三区精品久久久| 高清成人在线观看| 日韩精品中文字幕一区二区三区 | 国产一区二区不卡老阿姨| 欧美日韩国产综合视频在线观看 | 久久精品噜噜噜成人88aⅴ| 在线影视一区二区三区| 18成人在线观看| 成人午夜免费视频| 国产亚洲欧美一区在线观看| 麻豆精品国产传媒mv男同| 这里只有精品99re| 日韩精品成人一区二区三区| 色婷婷综合久久久| 亚洲天堂2014| 99这里都是精品| 中文字幕中文字幕一区二区 | 制服丝袜亚洲网站| 一个色妞综合视频在线观看| 99久久精品国产毛片| 国产精品久久看| 91小视频免费看| 亚洲黄一区二区三区| 欧美色综合天天久久综合精品| 一区二区三区中文免费|