⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tif_print.c

📁 tiff文件开发库
💻 C
📖 第 1 页 / 共 2 页
字号:
		case FILLORDER_MSB2LSB:			fprintf(fd, "msb-to-lsb\n");			break;		case FILLORDER_LSB2MSB:			fprintf(fd, "lsb-to-msb\n");			break;		default:			fprintf(fd, "%u (0x%x)\n",			    td->td_fillorder, td->td_fillorder);			break;		}	}#ifdef YCBCR_SUPPORT	if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING))        {            /*             * For hacky reasons (see tif_jpeg.c - JPEGFixupTestSubsampling),             * we need to fetch this rather than trust what is in our             * structures.             */            uint16 subsampling[2];            TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING,                           subsampling + 0, subsampling + 1 );		fprintf(fd, "  YCbCr Subsampling: %u, %u\n",                        subsampling[0], subsampling[1] );        }	if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) {		fprintf(fd, "  YCbCr Positioning: ");		switch (td->td_ycbcrpositioning) {		case YCBCRPOSITION_CENTERED:			fprintf(fd, "centered\n");			break;		case YCBCRPOSITION_COSITED:			fprintf(fd, "cosited\n");			break;		default:			fprintf(fd, "%u (0x%x)\n",			    td->td_ycbcrpositioning, td->td_ycbcrpositioning);			break;		}	}	if (TIFFFieldSet(tif,FIELD_YCBCRCOEFFICIENTS))		fprintf(fd, "  YCbCr Coefficients: %g, %g, %g\n",		    td->td_ycbcrcoeffs[0],		    td->td_ycbcrcoeffs[1],		    td->td_ycbcrcoeffs[2]);#endif	if (TIFFFieldSet(tif,FIELD_HALFTONEHINTS))		fprintf(fd, "  Halftone Hints: light %u dark %u\n",		    td->td_halftonehints[0], td->td_halftonehints[1]);	if (TIFFFieldSet(tif,FIELD_ARTIST))		_TIFFprintAsciiTag(fd, "Artist", td->td_artist);	if (TIFFFieldSet(tif,FIELD_DATETIME))		_TIFFprintAsciiTag(fd, "Date & Time", td->td_datetime);	if (TIFFFieldSet(tif,FIELD_HOSTCOMPUTER))		_TIFFprintAsciiTag(fd, "Host Computer", td->td_hostcomputer);	if (TIFFFieldSet(tif,FIELD_COPYRIGHT))		_TIFFprintAsciiTag(fd, "Copyright", td->td_copyright);	if (TIFFFieldSet(tif,FIELD_DOCUMENTNAME))		_TIFFprintAsciiTag(fd, "Document Name", td->td_documentname);	if (TIFFFieldSet(tif,FIELD_IMAGEDESCRIPTION))		_TIFFprintAsciiTag(fd, "Image Description", td->td_imagedescription);	if (TIFFFieldSet(tif,FIELD_MAKE))		_TIFFprintAsciiTag(fd, "Make", td->td_make);	if (TIFFFieldSet(tif,FIELD_MODEL))		_TIFFprintAsciiTag(fd, "Model", td->td_model);	if (TIFFFieldSet(tif,FIELD_ORIENTATION)) {		fprintf(fd, "  Orientation: ");		if (td->td_orientation < NORIENTNAMES)			fprintf(fd, "%s\n", orientNames[td->td_orientation]);		else			fprintf(fd, "%u (0x%x)\n",			    td->td_orientation, td->td_orientation);	}	if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))		fprintf(fd, "  Samples/Pixel: %u\n", td->td_samplesperpixel);	if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) {		fprintf(fd, "  Rows/Strip: ");		if (td->td_rowsperstrip == (uint32) -1)			fprintf(fd, "(infinite)\n");		else			fprintf(fd, "%lu\n", (u_long) td->td_rowsperstrip);	}	if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE))		fprintf(fd, "  Min Sample Value: %u\n", td->td_minsamplevalue);	if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE))		fprintf(fd, "  Max Sample Value: %u\n", td->td_maxsamplevalue);	if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE))		fprintf(fd, "  SMin Sample Value: %g\n",		    td->td_sminsamplevalue);	if (TIFFFieldSet(tif,FIELD_SMAXSAMPLEVALUE))		fprintf(fd, "  SMax Sample Value: %g\n",		    td->td_smaxsamplevalue);	if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) {		fprintf(fd, "  Planar Configuration: ");		switch (td->td_planarconfig) {		case PLANARCONFIG_CONTIG:			fprintf(fd, "single image plane\n");			break;		case PLANARCONFIG_SEPARATE:			fprintf(fd, "separate image planes\n");			break;		default:			fprintf(fd, "%u (0x%x)\n",			    td->td_planarconfig, td->td_planarconfig);			break;		}	}	if (TIFFFieldSet(tif,FIELD_PAGENAME))		_TIFFprintAsciiTag(fd, "Page Name", td->td_pagename);	if (TIFFFieldSet(tif,FIELD_PAGENUMBER))		fprintf(fd, "  Page Number: %u-%u\n",		    td->td_pagenumber[0], td->td_pagenumber[1]);	if (TIFFFieldSet(tif,FIELD_COLORMAP)) {		fprintf(fd, "  Color Map: ");		if (flags & TIFFPRINT_COLORMAP) {			fprintf(fd, "\n");			n = 1L<<td->td_bitspersample;			for (l = 0; l < n; l++)				fprintf(fd, "   %5lu: %5u %5u %5u\n",				    l,				    td->td_colormap[0][l],				    td->td_colormap[1][l],				    td->td_colormap[2][l]);		} else			fprintf(fd, "(present)\n");	}#ifdef COLORIMETRY_SUPPORT	if (TIFFFieldSet(tif,FIELD_WHITEPOINT))		fprintf(fd, "  White Point: %g-%g\n",		    td->td_whitepoint[0], td->td_whitepoint[1]);	if (TIFFFieldSet(tif,FIELD_PRIMARYCHROMAS))		fprintf(fd, "  Primary Chromaticities: %g,%g %g,%g %g,%g\n",		    td->td_primarychromas[0], td->td_primarychromas[1],		    td->td_primarychromas[2], td->td_primarychromas[3],		    td->td_primarychromas[4], td->td_primarychromas[5]);	if (TIFFFieldSet(tif,FIELD_REFBLACKWHITE)) {		fprintf(fd, "  Reference Black/White:\n");		for (i = 0; i < td->td_samplesperpixel; i++)			fprintf(fd, "    %2d: %5g %5g\n",			    i,			    td->td_refblackwhite[2*i+0],			    td->td_refblackwhite[2*i+1]);	}	if (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) {		fprintf(fd, "  Transfer Function: ");		if (flags & TIFFPRINT_CURVES) {			fprintf(fd, "\n");			n = 1L<<td->td_bitspersample;			for (l = 0; l < n; l++) {				fprintf(fd, "    %2lu: %5u",				    l, td->td_transferfunction[0][l]);				for (i = 1; i < td->td_samplesperpixel; i++)					fprintf(fd, " %5u",					    td->td_transferfunction[i][l]);				fputc('\n', fd);			}		} else			fprintf(fd, "(present)\n");	}#endif#ifdef ICC_SUPPORT	if (TIFFFieldSet(tif,FIELD_ICCPROFILE))		fprintf(fd, "  ICC Profile: <present>, %lu bytes\n",		    (u_long) td->td_profileLength);#endif#ifdef PHOTOSHOP_SUPPORT 	if (TIFFFieldSet(tif,FIELD_PHOTOSHOP)) 		fprintf(fd, "  Photoshop Data: <present>, %lu bytes\n", 		    (u_long) td->td_photoshopLength);#endif#ifdef IPTC_SUPPORT 	if (TIFFFieldSet(tif,FIELD_RICHTIFFIPTC)) 		fprintf(fd, "  RichTIFFIPTC Data: <present>, %lu bytes\n", 		    (u_long) td->td_richtiffiptcLength);#endif#if SUBIFD_SUPPORT	if (TIFFFieldSet(tif, FIELD_SUBIFD)) {		fprintf(fd, "  SubIFD Offsets:");		for (i = 0; i < td->td_nsubifd; i++)			fprintf(fd, " %5lu", (long) td->td_subifd[i]);		fputc('\n', fd);	}#endif        /*        ** Custom tag support.        */        {            int  i;            short count;            count = (short) TIFFGetTagListCount( tif );            for( i = 0; i < count; i++ )            {                ttag_t  tag = TIFFGetTagListEntry( tif, i );                const TIFFFieldInfo *fld;                fld = TIFFFieldWithTag( tif, tag );                if( fld == NULL )                    continue;                if( fld->field_passcount )                {                    short value_count;                    int j;                    void *raw_data;                                        if( TIFFGetField( tif, tag, &value_count, &raw_data ) != 1 )                        continue;                    fprintf(fd, "  %s: ", fld->field_name );                    for( j = 0; j < value_count; j++ )                    {			if( fld->field_type == TIFF_BYTE )                            fprintf( fd, "%d",                                     (int) ((char *) raw_data)[j] );			else if( fld->field_type == TIFF_SHORT )                            fprintf( fd, "%d",                                     (int) ((short *) raw_data)[j] );                        else if( fld->field_type == TIFF_LONG )                            fprintf( fd, "%d",                                     (int) ((long *) raw_data)[j] );			else if( fld->field_type == TIFF_RATIONAL )			    fprintf( fd, "%f",				     ((float *) raw_data)[j] );                        else if( fld->field_type == TIFF_ASCII )                        {                            fprintf( fd, "%s",                                     (char *) raw_data );                            break;                        }                        else if( fld->field_type == TIFF_DOUBLE )                            fprintf( fd, "%f",                                     ((double *) raw_data)[j] );                        else if( fld->field_type == TIFF_FLOAT )                            fprintf( fd, "%f",                                     ((float *) raw_data)[j] );                        else                        {                            fprintf( fd,                                     "<unsupported data type in TIFFPrint>" );                            break;                        }                        if( j < value_count-1 )                            fprintf( fd, "," );                    }                    fprintf( fd, "\n" );                }                 else if( !fld->field_passcount                         && fld->field_type == TIFF_ASCII )                {                    char *data;                                        if( TIFFGetField( tif, tag, &data ) )                        fprintf(fd, "  %s: %s\n", fld->field_name, data );                }            }        }        	if (tif->tif_tagmethods.printdir)		(*tif->tif_tagmethods.printdir)(tif, fd, flags);	if ((flags & TIFFPRINT_STRIPS) &&	    TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) {		tstrip_t s;		fprintf(fd, "  %lu %s:\n",		    (long) td->td_nstrips,		    isTiled(tif) ? "Tiles" : "Strips");		for (s = 0; s < td->td_nstrips; s++)			fprintf(fd, "    %3lu: [%8lu, %8lu]\n",			    (u_long) s,			    (u_long) td->td_stripoffset[s],			    (u_long) td->td_stripbytecount[s]);	}}void_TIFFprintAscii(FILE* fd, const char* cp){	for (; *cp != '\0'; cp++) {		const char* tp;		if (isprint(*cp)) {			fputc(*cp, fd);			continue;		}		for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)			if (*tp++ == *cp)				break;		if (*tp)			fprintf(fd, "\\%c", *tp);		else			fprintf(fd, "\\%03o", *cp & 0xff);	}}void_TIFFprintAsciiTag(FILE* fd, const char* name, const char* value){	fprintf(fd, "  %s: \"", name);	_TIFFprintAscii(fd, value);	fprintf(fd, "\"\n");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -