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

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

?? tif_dirwrite.c

?? 支持各種柵格圖像和矢量圖像讀取的庫
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* $Id: tif_dirwrite.c,v 1.37 2006/07/20 03:27:01 fwarmerdam Exp $ *//* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and  * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. *  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.   *  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE  * OF THIS SOFTWARE. *//* * TIFF Library. * * Directory Write Support Routines. */#include "tiffiop.h"#ifdef HAVE_IEEEFP# define	TIFFCvtNativeToIEEEFloat(tif, n, fp)# define	TIFFCvtNativeToIEEEDouble(tif, n, dp)#elseextern	void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);extern	void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);#endifstatic	int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);static	void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);static	void TIFFSetupShort(TIFF*, ttag_t, TIFFDirEntry*, uint16);static	int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);static	int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);static	int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);static	int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);static	int TIFFWriteShortArray(TIFF*, TIFFDirEntry*, uint16*);static	int TIFFWriteLongArray(TIFF *, TIFFDirEntry*, uint32*);static	int TIFFWriteRationalArray(TIFF *, TIFFDirEntry*, float*);static	int TIFFWriteFloatArray(TIFF *, TIFFDirEntry*, float*);static	int TIFFWriteDoubleArray(TIFF *, TIFFDirEntry*, double*);static	int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);static	int TIFFWriteAnyArray(TIFF*,	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);static	int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);static	int TIFFWriteInkNames(TIFF*, TIFFDirEntry*);static	int TIFFWriteData(TIFF*, TIFFDirEntry*, char*);static	int TIFFLinkDirectory(TIFF*);#define	WriteRationalPair(type, tag1, v1, tag2, v2) {		\	TIFFWriteRational((tif), (type), (tag1), (dir), (v1))	\	TIFFWriteRational((tif), (type), (tag2), (dir)+1, (v2))	\	(dir)++;						\}#define	TIFFWriteRational(tif, type, tag, dir, v)		\	(dir)->tdir_tag = (tag);				\	(dir)->tdir_type = (type);				\	(dir)->tdir_count = 1;					\	if (!TIFFWriteRationalArray((tif), (dir), &(v)))	\		goto bad;/* * Write the contents of the current directory * to the specified file.  This routine doesn't * handle overwriting a directory with auxiliary * storage that's been changed. */static int_TIFFWriteDirectory(TIFF* tif, int done){	uint16 dircount;	toff_t diroff;	ttag_t tag;	uint32 nfields;	tsize_t dirsize;	char* data;	TIFFDirEntry* dir;	TIFFDirectory* td;	unsigned long b, fields[FIELD_SETLONGS];	int fi, nfi;	if (tif->tif_mode == O_RDONLY)		return (1);	/*	 * Clear write state so that subsequent images with	 * different characteristics get the right buffers	 * setup for them.	 */	if (done)	{		if (tif->tif_flags & TIFF_POSTENCODE) {			tif->tif_flags &= ~TIFF_POSTENCODE;			if (!(*tif->tif_postencode)(tif)) {				TIFFErrorExt(tif->tif_clientdata,					     tif->tif_name,				"Error post-encoding before directory write");				return (0);			}		}		(*tif->tif_close)(tif);		/* shutdown encoder */		/*		 * Flush any data that might have been written		 * by the compression close+cleanup routines.		 */		if (tif->tif_rawcc > 0                     && (tif->tif_flags & TIFF_BEENWRITING) != 0                    && !TIFFFlushData1(tif)) {			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			    "Error flushing data before directory write");			return (0);		}		if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {			_TIFFfree(tif->tif_rawdata);			tif->tif_rawdata = NULL;			tif->tif_rawcc = 0;			tif->tif_rawdatasize = 0;		}		tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP);	}	td = &tif->tif_dir;	/*	 * Size the directory so that we can calculate	 * offsets for the data items that aren't kept	 * in-place in each field.	 */	nfields = 0;	for (b = 0; b <= FIELD_LAST; b++)		if (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM)			nfields += (b < FIELD_SUBFILETYPE ? 2 : 1);	nfields += td->td_customValueCount;	dirsize = nfields * sizeof (TIFFDirEntry);	data = (char*) _TIFFmalloc(dirsize);	if (data == NULL) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Cannot write directory, out of space");		return (0);	}	/*	 * Directory hasn't been placed yet, put	 * it at the end of the file and link it	 * into the existing directory structure.	 */	if (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif))		goto bad;	tif->tif_dataoff = (toff_t)(	    tif->tif_diroff + sizeof (uint16) + dirsize + sizeof (toff_t));	if (tif->tif_dataoff & 1)		tif->tif_dataoff++;	(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);	tif->tif_curdir++;	dir = (TIFFDirEntry*) data;	/*	 * Setup external form of directory	 * entries and write data items.	 */	_TIFFmemcpy(fields, td->td_fieldsset, sizeof (fields));	/*	 * Write out ExtraSamples tag only if	 * extra samples are present in the data.	 */	if (FieldSet(fields, FIELD_EXTRASAMPLES) && !td->td_extrasamples) {		ResetFieldBit(fields, FIELD_EXTRASAMPLES);		nfields--;		dirsize -= sizeof (TIFFDirEntry);	}								/*XXX*/	for (fi = 0, nfi = tif->tif_nfields; nfi > 0; nfi--, fi++) {		const TIFFFieldInfo* fip = tif->tif_fieldinfo[fi];		/*		 * For custom fields, we test to see if the custom field		 * is set or not.  For normal fields, we just use the		 * FieldSet test.		*/		if( fip->field_bit == FIELD_CUSTOM )		{			int ci, is_set = FALSE;			for( ci = 0; ci < td->td_customValueCount; ci++ )				is_set |= (td->td_customValues[ci].info == fip);			if( !is_set )				continue;		}		else if (!FieldSet(fields, fip->field_bit))			continue;		/*		 * Handle other fields.		 */		switch (fip->field_bit)		{		case FIELD_STRIPOFFSETS:			/*			 * We use one field bit for both strip and tile			 * offsets, and so must be careful in selecting			 * the appropriate field descriptor (so that tags			 * are written in sorted order).			 */			tag = isTiled(tif) ?			    TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS;			if (tag != fip->field_tag)				continue;						dir->tdir_tag = (uint16) tag;			dir->tdir_type = (uint16) TIFF_LONG;			dir->tdir_count = (uint32) td->td_nstrips;			if (!TIFFWriteLongArray(tif, dir, td->td_stripoffset))				goto bad;			break;		case FIELD_STRIPBYTECOUNTS:			/*			 * We use one field bit for both strip and tile			 * byte counts, and so must be careful in selecting			 * the appropriate field descriptor (so that tags			 * are written in sorted order).			 */			tag = isTiled(tif) ?			    TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS;			if (tag != fip->field_tag)				continue;						dir->tdir_tag = (uint16) tag;			dir->tdir_type = (uint16) TIFF_LONG;			dir->tdir_count = (uint32) td->td_nstrips;			if (!TIFFWriteLongArray(tif, dir, td->td_stripbytecount))				goto bad;			break;		case FIELD_ROWSPERSTRIP:			TIFFSetupShortLong(tif, TIFFTAG_ROWSPERSTRIP,			    dir, td->td_rowsperstrip);			break;		case FIELD_COLORMAP:			if (!TIFFWriteShortTable(tif, TIFFTAG_COLORMAP, dir,			    3, td->td_colormap))				goto bad;			break;		case FIELD_IMAGEDIMENSIONS:			TIFFSetupShortLong(tif, TIFFTAG_IMAGEWIDTH,			    dir++, td->td_imagewidth);			TIFFSetupShortLong(tif, TIFFTAG_IMAGELENGTH,			    dir, td->td_imagelength);			break;		case FIELD_TILEDIMENSIONS:			TIFFSetupShortLong(tif, TIFFTAG_TILEWIDTH,			    dir++, td->td_tilewidth);			TIFFSetupShortLong(tif, TIFFTAG_TILELENGTH,			    dir, td->td_tilelength);			break;		case FIELD_COMPRESSION:			TIFFSetupShort(tif, TIFFTAG_COMPRESSION,			    dir, td->td_compression);			break;		case FIELD_PHOTOMETRIC:			TIFFSetupShort(tif, TIFFTAG_PHOTOMETRIC,			    dir, td->td_photometric);			break;		case FIELD_POSITION:			WriteRationalPair(TIFF_RATIONAL,			    TIFFTAG_XPOSITION, td->td_xposition,			    TIFFTAG_YPOSITION, td->td_yposition);			break;		case FIELD_RESOLUTION:			WriteRationalPair(TIFF_RATIONAL,			    TIFFTAG_XRESOLUTION, td->td_xresolution,			    TIFFTAG_YRESOLUTION, td->td_yresolution);			break;		case FIELD_BITSPERSAMPLE:		case FIELD_MINSAMPLEVALUE:		case FIELD_MAXSAMPLEVALUE:		case FIELD_SAMPLEFORMAT:			if (!TIFFWritePerSampleShorts(tif, fip->field_tag, dir))				goto bad;			break;		case FIELD_SMINSAMPLEVALUE:		case FIELD_SMAXSAMPLEVALUE:			if (!TIFFWritePerSampleAnys(tif,			    _TIFFSampleToTagType(tif), fip->field_tag, dir))				goto bad;			break;		case FIELD_PAGENUMBER:		case FIELD_HALFTONEHINTS:		case FIELD_YCBCRSUBSAMPLING:			if (!TIFFSetupShortPair(tif, fip->field_tag, dir))				goto bad;			break;		case FIELD_INKNAMES:			if (!TIFFWriteInkNames(tif, dir))				goto bad;			break;		case FIELD_TRANSFERFUNCTION:			if (!TIFFWriteTransferFunction(tif, dir))				goto bad;			break;		case FIELD_SUBIFD:			/*			 * XXX: Always write this field using LONG type			 * for backward compatibility.			 */			dir->tdir_tag = (uint16) fip->field_tag;			dir->tdir_type = (uint16) TIFF_LONG;			dir->tdir_count = (uint32) td->td_nsubifd;			if (!TIFFWriteLongArray(tif, dir, td->td_subifd))				goto bad;			/*			 * Total hack: if this directory includes a SubIFD			 * tag then force the next <n> directories to be			 * written as ``sub directories'' of this one.  This			 * is used to write things like thumbnails and			 * image masks that one wants to keep out of the			 * normal directory linkage access mechanism.			 */			if (dir->tdir_count > 0) {				tif->tif_flags |= TIFF_INSUBIFD;				tif->tif_nsubifd = (uint16) dir->tdir_count;				if (dir->tdir_count > 1)					tif->tif_subifdoff = dir->tdir_offset;				else					tif->tif_subifdoff = (uint32)(					      tif->tif_diroff					    + sizeof (uint16)					    + ((char*)&dir->tdir_offset-data));			}			break;		default:			/* XXX: Should be fixed and removed. */			if (fip->field_tag == TIFFTAG_DOTRANGE) {				if (!TIFFSetupShortPair(tif, fip->field_tag, dir))					goto bad;			}			else if (!TIFFWriteNormalTag(tif, dir, fip))				goto bad;			break;		}		dir++;                		if( fip->field_bit != FIELD_CUSTOM )			ResetFieldBit(fields, fip->field_bit);	}	/*	 * Write directory.	 */	dircount = (uint16) nfields;	diroff = (uint32) tif->tif_nextdiroff;	if (tif->tif_flags & TIFF_SWAB) {		/*		 * The file's byte order is opposite to the		 * native machine architecture.  We overwrite		 * the directory information with impunity		 * because it'll be released below after we		 * write it to the file.  Note that all the		 * other tag construction routines assume that		 * we do this byte-swapping; i.e. they only		 * byte-swap indirect data.		 */		for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {			TIFFSwabArrayOfShort(&dir->tdir_tag, 2);			TIFFSwabArrayOfLong(&dir->tdir_count, 2);		}		dircount = (uint16) nfields;		TIFFSwabShort(&dircount);		TIFFSwabLong(&diroff);	}	(void) TIFFSeekFile(tif, tif->tif_diroff, SEEK_SET);	if (!WriteOK(tif, &dircount, sizeof (dircount))) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Error writing directory count");		goto bad;	}	if (!WriteOK(tif, data, dirsize)) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Error writing directory contents");		goto bad;	}	if (!WriteOK(tif, &diroff, sizeof (uint32))) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Error writing directory link");		goto bad;	}	if (done) {		TIFFFreeDirectory(tif);		tif->tif_flags &= ~TIFF_DIRTYDIRECT;		(*tif->tif_cleanup)(tif);		/*		* Reset directory-related state for subsequent		* directories.		*/		TIFFCreateDirectory(tif);	}	_TIFFfree(data);	return (1);bad:	_TIFFfree(data);	return (0);}#undef WriteRationalPairintTIFFWriteDirectory(TIFF* tif){	return _TIFFWriteDirectory(tif, TRUE);}/* * Similar to TIFFWriteDirectory(), writes the directory out * but leaves all data structures in memory so that it can be * written again.  This will make a partially written TIFF file * readable before it is successfully completed/closed. */ intTIFFCheckpointDirectory(TIFF* tif){	int rc;	/* Setup the strips arrays, if they haven't already been. */	if (tif->tif_dir.td_stripoffset == NULL)	    (void) TIFFSetupStrips(tif);	rc = _TIFFWriteDirectory(tif, FALSE);	(void) TIFFSetWriteOffset(tif, TIFFSeekFile(tif, 0, SEEK_END));	return rc;}static int_TIFFWriteCustomDirectory(TIFF* tif, toff_t *pdiroff){	uint16 dircount;	uint32 nfields;	tsize_t dirsize;	char* data;	TIFFDirEntry* dir;	TIFFDirectory* td;	unsigned long b, fields[FIELD_SETLONGS];	int fi, nfi;	if (tif->tif_mode == O_RDONLY)		return (1);	td = &tif->tif_dir;	/*	 * Size the directory so that we can calculate	 * offsets for the data items that aren't kept	 * in-place in each field.	 */	nfields = 0;	for (b = 0; b <= FIELD_LAST; b++)		if (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM)			nfields += (b < FIELD_SUBFILETYPE ? 2 : 1);	nfields += td->td_customValueCount;	dirsize = nfields * sizeof (TIFFDirEntry);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产视频在线| 狠狠色2019综合网| 久久蜜桃香蕉精品一区二区三区| 高清免费成人av| 亚洲精品视频自拍| 精品国产一二三| 91福利资源站| 丁香六月综合激情| 另类调教123区 | 亚洲色图丝袜美腿| 日韩一区二区免费视频| 91看片淫黄大片一级| 精品一区二区综合| 亚洲一级二级三级| 中文字幕一区二区不卡| 久久久亚洲欧洲日产国码αv| 欧美调教femdomvk| 91在线观看一区二区| 精品亚洲成a人在线观看| 亚洲第一综合色| 中文字幕制服丝袜一区二区三区| 日韩免费在线观看| 欧美日韩视频在线观看一区二区三区| www.亚洲色图.com| 国产精品一区一区| 激情综合一区二区三区| 日韩**一区毛片| 亚洲www啪成人一区二区麻豆| 国产精品福利在线播放| 欧美激情一区二区三区| 久久午夜电影网| 精品精品国产高清一毛片一天堂| 这里只有精品电影| 欧美日韩dvd在线观看| 在线观看免费成人| 色婷婷综合久久久久中文一区二区| 处破女av一区二区| 丰满岳乱妇一区二区三区| 国产毛片精品视频| 国产自产高清不卡| 国产麻豆一精品一av一免费 | 99视频一区二区三区| 丁香婷婷深情五月亚洲| 国产伦精一区二区三区| 国产凹凸在线观看一区二区| 国产精品2024| 国产成人免费av在线| 成人黄色电影在线| 91在线你懂得| 日本久久电影网| 欧美三级日韩在线| 欧美精品久久一区| 日韩免费高清电影| 欧美xxxx老人做受| 国产婷婷色一区二区三区| 国产精品久久久久久久久图文区 | 日韩精品最新网址| 久久青草国产手机看片福利盒子| 精品区一区二区| 国产日韩欧美一区二区三区乱码| 国产欧美日韩三级| 日韩毛片一二三区| 亚洲一区二区三区小说| 天天综合色天天综合| 日韩有码一区二区三区| 国产一区久久久| 97精品久久久久中文字幕| 欧美午夜精品一区二区三区| 欧美剧情片在线观看| 欧美精品一区在线观看| 中文字幕一区不卡| 亚洲成人免费影院| 国产一区不卡在线| 91激情在线视频| 欧美一区二区在线视频| 久久网站热最新地址| 亚洲欧洲精品一区二区三区不卡| 曰韩精品一区二区| 久久99精品国产91久久来源| 成人激情黄色小说| 欧美久久婷婷综合色| 久久久久久久av麻豆果冻| 椎名由奈av一区二区三区| 五月激情六月综合| 狠狠色综合日日| 91久久香蕉国产日韩欧美9色| 日韩欧美中文字幕精品| 中文字幕在线不卡| 久久国产精品99久久久久久老狼 | 亚洲风情在线资源站| 精品系列免费在线观看| 91日韩精品一区| 日韩视频一区二区在线观看| 国产精品视频一区二区三区不卡| 婷婷成人激情在线网| 国产69精品一区二区亚洲孕妇| 欧美性xxxxxxxx| 久久久不卡影院| 日韩高清在线一区| 99久久综合国产精品| 欧美一级精品大片| 亚洲影院理伦片| 国产成人精品www牛牛影视| 5566中文字幕一区二区电影| 日韩理论片在线| 国产在线一区观看| 日韩一区二区三区四区| 亚洲精品乱码久久久久久久久| 国产在线日韩欧美| 欧美日韩国产精品自在自线| 中文字幕一区二区三区色视频| 精品一区二区三区在线播放| 色哟哟国产精品| 欧美国产一区二区| 九九国产精品视频| 欧美精品日韩一区| 亚洲综合激情网| 成人91在线观看| 亚洲国产精品v| 国产激情一区二区三区| 精品国产一区久久| 奇米四色…亚洲| 欧美精品xxxxbbbb| 亚洲一区二区三区在线看| 成人av资源站| 中文av字幕一区| 国产一区二区三区免费观看| 日韩欧美中文字幕制服| 日韩精品亚洲一区| 欧美猛男gaygay网站| 亚洲一区二区三区三| 欧美综合视频在线观看| 亚洲激情av在线| 91视频国产观看| 亚洲欧美日韩国产手机在线| 91尤物视频在线观看| 国产精品国产馆在线真实露脸| 成人av先锋影音| 一区二区中文视频| 色综合一区二区三区| 亚洲精品成人天堂一二三| 91久久精品一区二区| 亚洲一区二区三区四区五区中文| 91精品福利视频| 午夜成人在线视频| 91精品国产高清一区二区三区蜜臀| 性做久久久久久久免费看| 欧美日产在线观看| 日韩不卡一二三区| 精品福利在线导航| 国产麻豆精品视频| 国产精品欧美经典| 色综合久久天天| 亚洲一区二区三区视频在线 | 精品奇米国产一区二区三区| 蜜桃av一区二区| 久久久综合精品| 国产精品一二二区| 亚洲日本欧美天堂| 激情深爱一区二区| 欧美岛国在线观看| 国产寡妇亲子伦一区二区| 国产精品情趣视频| 一本大道久久a久久综合| 一区二区三区高清不卡| 欧美日本国产一区| 精品无码三级在线观看视频| 久久久99精品免费观看| 97久久精品人人澡人人爽| 亚洲成av人片www| 2024国产精品视频| 99久久夜色精品国产网站| 亚洲国产成人高清精品| 欧美xxx久久| 99久久精品费精品国产一区二区| 亚洲高清在线视频| 26uuu国产日韩综合| 99久久99久久免费精品蜜臀| 亚洲成人第一页| 久久久久国产精品免费免费搜索| 91视频www| 麻豆精品在线看| 国产精品国产三级国产aⅴ原创 | 中文字幕第一区第二区| 91免费版在线| 毛片av中文字幕一区二区| 国产精品国产三级国产aⅴ原创| 欧美群妇大交群的观看方式| 风间由美一区二区三区在线观看| 亚洲自拍偷拍图区| 久久精品一区蜜桃臀影院| 色久综合一二码| 国产麻豆午夜三级精品| 午夜久久电影网| 国产精品久久久久天堂| 精品国产网站在线观看| 欧美在线观看视频一区二区| 成人在线视频首页| 久久精品理论片| 亚洲午夜电影在线观看|