ReactOS 0.4.16-dev-109-gf4cb10f
tif_print.c File Reference
#include <precomp.h>
Include dependency graph for tif_print.c:

Go to the source code of this file.

Macros

#define NPHOTONAMES   (sizeof (photoNames) / sizeof (photoNames[0]))
 
#define NORIENTNAMES   (sizeof (orientNames) / sizeof (orientNames[0]))
 

Functions

static void _TIFFprintAsciiBounded (FILE *fd, const char *cp, size_t max_chars)
 
static void _TIFFPrintField (FILE *fd, const TIFFField *fip, uint32 value_count, void *raw_data)
 
static int _TIFFPrettyPrintField (TIFF *tif, const TIFFField *fip, FILE *fd, uint32 tag, uint32 value_count, void *raw_data)
 
void TIFFPrintDirectory (TIFF *tif, FILE *fd, long flags)
 
void _TIFFprintAscii (FILE *fd, const char *cp)
 
void _TIFFprintAsciiTag (FILE *fd, const char *name, const char *value)
 

Variables

static const char *const photoNames []
 
static const char *const orientNames []
 

Macro Definition Documentation

◆ NORIENTNAMES

#define NORIENTNAMES   (sizeof (orientNames) / sizeof (orientNames[0]))

Definition at line 64 of file tif_print.c.

◆ NPHOTONAMES

#define NPHOTONAMES   (sizeof (photoNames) / sizeof (photoNames[0]))

Definition at line 51 of file tif_print.c.

Function Documentation

◆ _TIFFPrettyPrintField()

static int _TIFFPrettyPrintField ( TIFF tif,
const TIFFField fip,
FILE fd,
uint32  tag,
uint32  value_count,
void raw_data 
)
static

Definition at line 141 of file tif_print.c.

143{
144 (void) tif;
145
146 /* do not try to pretty print auto-defined fields */
147 if (strncmp(fip->field_name,"Tag ", 4) == 0) {
148 return 0;
149 }
150
151 switch (tag)
152 {
153 case TIFFTAG_INKSET:
154 if (value_count == 2 && fip->field_type == TIFF_SHORT) {
155 fprintf(fd, " Ink Set: ");
156 switch (*((uint16*)raw_data)) {
157 case INKSET_CMYK:
158 fprintf(fd, "CMYK\n");
159 break;
160 default:
161 fprintf(fd, "%u (0x%x)\n",
162 *((uint16*)raw_data),
163 *((uint16*)raw_data));
164 break;
165 }
166 return 1;
167 }
168 return 0;
169
170 case TIFFTAG_DOTRANGE:
171 if (value_count == 2 && fip->field_type == TIFF_SHORT) {
172 fprintf(fd, " Dot Range: %u-%u\n",
173 ((uint16*)raw_data)[0], ((uint16*)raw_data)[1]);
174 return 1;
175 }
176 return 0;
177
179 if (value_count == 2 && fip->field_type == TIFF_RATIONAL) {
180 fprintf(fd, " White Point: %g-%g\n",
181 ((float *)raw_data)[0], ((float *)raw_data)[1]);
182 return 1;
183 }
184 return 0;
185
187 {
188 uint32 i;
189
190 fprintf(fd, " XMLPacket (XMP Metadata):\n" );
191 for(i = 0; i < value_count; i++)
192 fputc(((char *)raw_data)[i], fd);
193 fprintf( fd, "\n" );
194 return 1;
195 }
197 /*
198 * XXX: for some weird reason RichTIFFIPTC tag
199 * defined as array of LONG values.
200 */
201 fprintf(fd,
202 " RichTIFFIPTC Data: <present>, %lu bytes\n",
203 (unsigned long) value_count * 4);
204 return 1;
205
207 fprintf(fd, " Photoshop Data: <present>, %lu bytes\n",
208 (unsigned long) value_count);
209 return 1;
210
212 fprintf(fd, " ICC Profile: <present>, %lu bytes\n",
213 (unsigned long) value_count);
214 return 1;
215
216 case TIFFTAG_STONITS:
217 if (value_count == 1 && fip->field_type == TIFF_DOUBLE) {
218 fprintf(fd,
219 " Sample to Nits conversion factor: %.4e\n",
220 *((double*)raw_data));
221 return 1;
222 }
223 return 0;
224 }
225
226 return 0;
227}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned short uint16
Definition: types.h:30
unsigned int uint32
Definition: types.h:32
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
static int fd
Definition: io.c:51
TIFFDataType field_type
Definition: tif_dir.h:286
char * field_name
Definition: tif_dir.h:293
Definition: ecma_167.h:138
#define TIFFTAG_WHITEPOINT
Definition: tiff.h:281
#define TIFFTAG_DOTRANGE
Definition: tiff.h:301
#define TIFFTAG_XMLPACKET
Definition: tiff.h:368
#define TIFFTAG_INKSET
Definition: tiff.h:296
@ TIFF_SHORT
Definition: tiff.h:127
@ TIFF_DOUBLE
Definition: tiff.h:136
@ TIFF_RATIONAL
Definition: tiff.h:129
#define INKSET_CMYK
Definition: tiff.h:297
#define TIFFTAG_ICCPROFILE
Definition: tiff.h:431
#define TIFFTAG_STONITS
Definition: tiff.h:442
#define TIFFTAG_PHOTOSHOP
Definition: tiff.h:427
#define TIFFTAG_RICHTIFFIPTC
Definition: tiff.h:405

Referenced by TIFFPrintDirectory().

◆ _TIFFprintAscii()

void _TIFFprintAscii ( FILE fd,
const char cp 
)

Definition at line 678 of file tif_print.c.

679{
681}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
POINT cp
Definition: magnifier.c:59
static void _TIFFprintAsciiBounded(FILE *fd, const char *cp, size_t max_chars)
Definition: tif_print.c:684

Referenced by _TIFFprintAsciiTag().

◆ _TIFFprintAsciiBounded()

static void _TIFFprintAsciiBounded ( FILE fd,
const char cp,
size_t  max_chars 
)
static

Definition at line 684 of file tif_print.c.

685{
686 for (; max_chars > 0 && *cp != '\0'; cp++, max_chars--) {
687 const char* tp;
688
689 if (isprint((int)*cp)) {
690 fputc(*cp, fd);
691 continue;
692 }
693 for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
694 if (*tp++ == *cp)
695 break;
696 if (*tp)
697 fprintf(fd, "\\%c", *tp);
698 else
699 fprintf(fd, "\\%03o", *cp & 0xff);
700 }
701}
#define isprint(c)
Definition: acclib.h:73
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996

Referenced by _TIFFprintAscii(), and TIFFPrintDirectory().

◆ _TIFFprintAsciiTag()

void _TIFFprintAsciiTag ( FILE fd,
const char name,
const char value 
)

Definition at line 704 of file tif_print.c.

705{
706 fprintf(fd, " %s: \"", name);
708 fprintf(fd, "\"\n");
709}
Definition: name.c:39
void _TIFFprintAscii(FILE *fd, const char *cp)
Definition: tif_print.c:678
Definition: pdh_main.c:94

◆ _TIFFPrintField()

static void _TIFFPrintField ( FILE fd,
const TIFFField fip,
uint32  value_count,
void raw_data 
)
static

Definition at line 67 of file tif_print.c.

69{
70 uint32 j;
71
72 fprintf(fd, " %s: ", fip->field_name);
73
74 for(j = 0; j < value_count; j++) {
75 if(fip->field_type == TIFF_BYTE)
76 fprintf(fd, "%u", ((uint8 *) raw_data)[j]);
77 else if(fip->field_type == TIFF_UNDEFINED)
78 fprintf(fd, "0x%x",
79 (unsigned int) ((unsigned char *) raw_data)[j]);
80 else if(fip->field_type == TIFF_SBYTE)
81 fprintf(fd, "%d", ((int8 *) raw_data)[j]);
82 else if(fip->field_type == TIFF_SHORT)
83 fprintf(fd, "%u", ((uint16 *) raw_data)[j]);
84 else if(fip->field_type == TIFF_SSHORT)
85 fprintf(fd, "%d", ((int16 *) raw_data)[j]);
86 else if(fip->field_type == TIFF_LONG)
87 fprintf(fd, "%lu",
88 (unsigned long)((uint32 *) raw_data)[j]);
89 else if(fip->field_type == TIFF_SLONG)
90 fprintf(fd, "%ld", (long)((int32 *) raw_data)[j]);
91 else if(fip->field_type == TIFF_IFD)
92 fprintf(fd, "0x%lx",
93 (unsigned long)((uint32 *) raw_data)[j]);
94 else if(fip->field_type == TIFF_RATIONAL
95 || fip->field_type == TIFF_SRATIONAL
96 || fip->field_type == TIFF_FLOAT)
97 fprintf(fd, "%f", ((float *) raw_data)[j]);
98 else if(fip->field_type == TIFF_LONG8)
99#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
100 fprintf(fd, "%I64u",
101 (unsigned __int64)((uint64 *) raw_data)[j]);
102#else
103 fprintf(fd, "%llu",
104 (unsigned long long)((uint64 *) raw_data)[j]);
105#endif
106 else if(fip->field_type == TIFF_SLONG8)
107#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
108 fprintf(fd, "%I64d", (__int64)((int64 *) raw_data)[j]);
109#else
110 fprintf(fd, "%lld", (long long)((int64 *) raw_data)[j]);
111#endif
112 else if(fip->field_type == TIFF_IFD8)
113#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
114 fprintf(fd, "0x%I64x",
115 (unsigned __int64)((uint64 *) raw_data)[j]);
116#else
117 fprintf(fd, "0x%llx",
118 (unsigned long long)((uint64 *) raw_data)[j]);
119#endif
120 else if(fip->field_type == TIFF_FLOAT)
121 fprintf(fd, "%f", ((float *)raw_data)[j]);
122 else if(fip->field_type == TIFF_DOUBLE)
123 fprintf(fd, "%f", ((double *) raw_data)[j]);
124 else if(fip->field_type == TIFF_ASCII) {
125 fprintf(fd, "%s", (char *) raw_data);
126 break;
127 }
128 else {
129 fprintf(fd, "<unsupported data type in TIFFPrint>");
130 break;
131 }
132
133 if(j < value_count - 1)
134 fprintf(fd, ",");
135 }
136
137 fprintf(fd, "\n");
138}
unsigned char uint8
Definition: types.h:28
#define __int64
Definition: basetyps.h:16
unsigned long long uint64
Definition: platform.h:18
short int16
Definition: platform.h:11
long int32
Definition: platform.h:12
char int8
Definition: platform.h:10
long long int64
Definition: platform.h:13
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
@ TIFF_SSHORT
Definition: tiff.h:132
@ TIFF_SLONG
Definition: tiff.h:133
@ TIFF_BYTE
Definition: tiff.h:125
@ TIFF_SBYTE
Definition: tiff.h:130
@ TIFF_IFD
Definition: tiff.h:137
@ TIFF_UNDEFINED
Definition: tiff.h:131
@ TIFF_LONG
Definition: tiff.h:128
@ TIFF_SLONG8
Definition: tiff.h:139
@ TIFF_LONG8
Definition: tiff.h:138
@ TIFF_ASCII
Definition: tiff.h:126
@ TIFF_FLOAT
Definition: tiff.h:135
@ TIFF_IFD8
Definition: tiff.h:140
@ TIFF_SRATIONAL
Definition: tiff.h:134

Referenced by TIFFPrintDirectory().

◆ TIFFPrintDirectory()

void TIFFPrintDirectory ( TIFF tif,
FILE fd,
long  flags 
)

Definition at line 234 of file tif_print.c.

235{
236 TIFFDirectory *td = &tif->tif_dir;
237 char *sep;
238 long l, n;
239
240#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
241 fprintf(fd, "TIFF Directory at offset 0x%I64x (%I64u)\n",
242 (unsigned __int64) tif->tif_diroff,
243 (unsigned __int64) tif->tif_diroff);
244#else
245 fprintf(fd, "TIFF Directory at offset 0x%llx (%llu)\n",
246 (unsigned long long) tif->tif_diroff,
247 (unsigned long long) tif->tif_diroff);
248#endif
250 fprintf(fd, " Subfile Type:");
251 sep = " ";
253 fprintf(fd, "%sreduced-resolution image", sep);
254 sep = "/";
255 }
256 if (td->td_subfiletype & FILETYPE_PAGE) {
257 fprintf(fd, "%smulti-page document", sep);
258 sep = "/";
259 }
261 fprintf(fd, "%stransparency mask", sep);
262 fprintf(fd, " (%lu = 0x%lx)\n",
263 (unsigned long) td->td_subfiletype, (long) td->td_subfiletype);
264 }
266 fprintf(fd, " Image Width: %lu Image Length: %lu",
267 (unsigned long) td->td_imagewidth, (unsigned long) td->td_imagelength);
269 fprintf(fd, " Image Depth: %lu",
270 (unsigned long) td->td_imagedepth);
271 fprintf(fd, "\n");
272 }
274 fprintf(fd, " Tile Width: %lu Tile Length: %lu",
275 (unsigned long) td->td_tilewidth, (unsigned long) td->td_tilelength);
277 fprintf(fd, " Tile Depth: %lu",
278 (unsigned long) td->td_tiledepth);
279 fprintf(fd, "\n");
280 }
282 fprintf(fd, " Resolution: %g, %g",
285 switch (td->td_resolutionunit) {
286 case RESUNIT_NONE:
287 fprintf(fd, " (unitless)");
288 break;
289 case RESUNIT_INCH:
290 fprintf(fd, " pixels/inch");
291 break;
293 fprintf(fd, " pixels/cm");
294 break;
295 default:
296 fprintf(fd, " (unit %u = 0x%x)",
299 break;
300 }
301 }
302 fprintf(fd, "\n");
303 }
305 fprintf(fd, " Position: %g, %g\n",
306 td->td_xposition, td->td_yposition);
308 fprintf(fd, " Bits/Sample: %u\n", td->td_bitspersample);
310 fprintf(fd, " Sample Format: ");
311 switch (td->td_sampleformat) {
313 fprintf(fd, "void\n");
314 break;
315 case SAMPLEFORMAT_INT:
316 fprintf(fd, "signed integer\n");
317 break;
319 fprintf(fd, "unsigned integer\n");
320 break;
322 fprintf(fd, "IEEE floating point\n");
323 break;
325 fprintf(fd, "complex signed integer\n");
326 break;
328 fprintf(fd, "complex IEEE floating point\n");
329 break;
330 default:
331 fprintf(fd, "%u (0x%x)\n",
333 break;
334 }
335 }
338 fprintf(fd, " Compression Scheme: ");
339 if (c)
340 fprintf(fd, "%s\n", c->name);
341 else
342 fprintf(fd, "%u (0x%x)\n",
344 }
346 fprintf(fd, " Photometric Interpretation: ");
347 if (td->td_photometric < NPHOTONAMES)
348 fprintf(fd, "%s\n", photoNames[td->td_photometric]);
349 else {
350 switch (td->td_photometric) {
351 case PHOTOMETRIC_LOGL:
352 fprintf(fd, "CIE Log2(L)\n");
353 break;
355 fprintf(fd, "CIE Log2(L) (u',v')\n");
356 break;
357 default:
358 fprintf(fd, "%u (0x%x)\n",
360 break;
361 }
362 }
363 }
365 uint16 i;
366 fprintf(fd, " Extra Samples: %u<", td->td_extrasamples);
367 sep = "";
368 for (i = 0; i < td->td_extrasamples; i++) {
369 switch (td->td_sampleinfo[i]) {
371 fprintf(fd, "%sunspecified", sep);
372 break;
374 fprintf(fd, "%sassoc-alpha", sep);
375 break;
377 fprintf(fd, "%sunassoc-alpha", sep);
378 break;
379 default:
380 fprintf(fd, "%s%u (0x%x)", sep,
381 td->td_sampleinfo[i], td->td_sampleinfo[i]);
382 break;
383 }
384 sep = ", ";
385 }
386 fprintf(fd, ">\n");
387 }
388 if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
389 char* cp;
390 uint16 i;
391 fprintf(fd, " Ink Names: ");
392 i = td->td_samplesperpixel;
393 sep = "";
394 for (cp = td->td_inknames;
395 i > 0 && cp < td->td_inknames + td->td_inknameslen;
396 cp = strchr(cp,'\0')+1, i--) {
397 size_t max_chars =
398 td->td_inknameslen - (cp - td->td_inknames);
399 fputs(sep, fd);
400 _TIFFprintAsciiBounded(fd, cp, max_chars);
401 sep = ", ";
402 }
403 fputs("\n", fd);
404 }
406 fprintf(fd, " Thresholding: ");
407 switch (td->td_threshholding) {
409 fprintf(fd, "bilevel art scan\n");
410 break;
412 fprintf(fd, "halftone or dithered scan\n");
413 break;
415 fprintf(fd, "error diffused\n");
416 break;
417 default:
418 fprintf(fd, "%u (0x%x)\n",
420 break;
421 }
422 }
423 if (TIFFFieldSet(tif,FIELD_FILLORDER)) {
424 fprintf(fd, " FillOrder: ");
425 switch (td->td_fillorder) {
427 fprintf(fd, "msb-to-lsb\n");
428 break;
430 fprintf(fd, "lsb-to-msb\n");
431 break;
432 default:
433 fprintf(fd, "%u (0x%x)\n",
434 td->td_fillorder, td->td_fillorder);
435 break;
436 }
437 }
439 {
440 fprintf(fd, " YCbCr Subsampling: %u, %u\n",
442 }
444 fprintf(fd, " YCbCr Positioning: ");
445 switch (td->td_ycbcrpositioning) {
447 fprintf(fd, "centered\n");
448 break;
450 fprintf(fd, "cosited\n");
451 break;
452 default:
453 fprintf(fd, "%u (0x%x)\n",
455 break;
456 }
457 }
459 fprintf(fd, " Halftone Hints: light %u dark %u\n",
460 td->td_halftonehints[0], td->td_halftonehints[1]);
462 fprintf(fd, " Orientation: ");
464 fprintf(fd, "%s\n", orientNames[td->td_orientation]);
465 else
466 fprintf(fd, "%u (0x%x)\n",
468 }
470 fprintf(fd, " Samples/Pixel: %u\n", td->td_samplesperpixel);
472 fprintf(fd, " Rows/Strip: ");
473 if (td->td_rowsperstrip == (uint32) -1)
474 fprintf(fd, "(infinite)\n");
475 else
476 fprintf(fd, "%lu\n", (unsigned long) td->td_rowsperstrip);
477 }
479 fprintf(fd, " Min Sample Value: %u\n", td->td_minsamplevalue);
481 fprintf(fd, " Max Sample Value: %u\n", td->td_maxsamplevalue);
483 int i;
484 int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
485 fprintf(fd, " SMin Sample Value:");
486 for (i = 0; i < count; ++i)
487 fprintf(fd, " %g", td->td_sminsamplevalue[i]);
488 fprintf(fd, "\n");
489 }
491 int i;
492 int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
493 fprintf(fd, " SMax Sample Value:");
494 for (i = 0; i < count; ++i)
495 fprintf(fd, " %g", td->td_smaxsamplevalue[i]);
496 fprintf(fd, "\n");
497 }
499 fprintf(fd, " Planar Configuration: ");
500 switch (td->td_planarconfig) {
502 fprintf(fd, "single image plane\n");
503 break;
505 fprintf(fd, "separate image planes\n");
506 break;
507 default:
508 fprintf(fd, "%u (0x%x)\n",
510 break;
511 }
512 }
514 fprintf(fd, " Page Number: %u-%u\n",
515 td->td_pagenumber[0], td->td_pagenumber[1]);
516 if (TIFFFieldSet(tif,FIELD_COLORMAP)) {
517 fprintf(fd, " Color Map: ");
519 fprintf(fd, "\n");
520 n = 1L<<td->td_bitspersample;
521 for (l = 0; l < n; l++)
522 fprintf(fd, " %5ld: %5u %5u %5u\n",
523 l,
524 td->td_colormap[0][l],
525 td->td_colormap[1][l],
526 td->td_colormap[2][l]);
527 } else
528 fprintf(fd, "(present)\n");
529 }
531 int i;
532 fprintf(fd, " Reference Black/White:\n");
533 for (i = 0; i < 3; i++)
534 fprintf(fd, " %2d: %5g %5g\n", i,
535 td->td_refblackwhite[2*i+0],
536 td->td_refblackwhite[2*i+1]);
537 }
539 fprintf(fd, " Transfer Function: ");
540 if (flags & TIFFPRINT_CURVES) {
541 fprintf(fd, "\n");
542 n = 1L<<td->td_bitspersample;
543 for (l = 0; l < n; l++) {
544 uint16 i;
545 fprintf(fd, " %2ld: %5u",
546 l, td->td_transferfunction[0][l]);
547 for (i = 1; i < td->td_samplesperpixel - td->td_extrasamples && i < 3; i++)
548 fprintf(fd, " %5u",
549 td->td_transferfunction[i][l]);
550 fputc('\n', fd);
551 }
552 } else
553 fprintf(fd, "(present)\n");
554 }
555 if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) {
556 uint16 i;
557 fprintf(fd, " SubIFD Offsets:");
558 for (i = 0; i < td->td_nsubifd; i++)
559#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
560 fprintf(fd, " %5I64u",
561 (unsigned __int64) td->td_subifd[i]);
562#else
563 fprintf(fd, " %5llu",
564 (unsigned long long) td->td_subifd[i]);
565#endif
566 fputc('\n', fd);
567 }
568
569 /*
570 ** Custom tag support.
571 */
572 {
573 int i;
574 short count;
575
577 for(i = 0; i < count; i++) {
579 const TIFFField *fip;
580 uint32 value_count;
581 int mem_alloc = 0;
582 void *raw_data;
583
584 fip = TIFFFieldWithTag(tif, tag);
585 if(fip == NULL)
586 continue;
587
588 if(fip->field_passcount) {
589 if (fip->field_readcount == TIFF_VARIABLE2 ) {
590 if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
591 continue;
592 } else if (fip->field_readcount == TIFF_VARIABLE ) {
593 uint16 small_value_count;
594 if(TIFFGetField(tif, tag, &small_value_count, &raw_data) != 1)
595 continue;
596 value_count = small_value_count;
597 } else {
600 continue;
601 }
602 } else {
605 value_count = 1;
606 else if (fip->field_readcount == TIFF_SPP)
607 value_count = td->td_samplesperpixel;
608 else
609 value_count = fip->field_readcount;
610 if (fip->field_tag == TIFFTAG_DOTRANGE
611 && strcmp(fip->field_name,"DotRange") == 0) {
612 /* TODO: This is an evil exception and should not have been
613 handled this way ... likely best if we move it into
614 the directory structure with an explicit field in
615 libtiff 4.1 and assign it a FIELD_ value */
616 static uint16 dotrange[2];
617 raw_data = dotrange;
618 TIFFGetField(tif, tag, dotrange+0, dotrange+1);
619 } else if (fip->field_type == TIFF_ASCII
622 || fip->field_readcount == TIFF_SPP
623 || value_count > 1) {
624 if(TIFFGetField(tif, tag, &raw_data) != 1)
625 continue;
626 } else {
627 raw_data = _TIFFmalloc(
629 * value_count);
630 mem_alloc = 1;
631 if(TIFFGetField(tif, tag, raw_data) != 1) {
632 _TIFFfree(raw_data);
633 continue;
634 }
635 }
636 }
637
638 /*
639 * Catch the tags which needs to be specially handled
640 * and pretty print them. If tag not handled in
641 * _TIFFPrettyPrintField() fall down and print it as
642 * any other tag.
643 */
644 if (!_TIFFPrettyPrintField(tif, fip, fd, tag, value_count, raw_data))
645 _TIFFPrintField(fd, fip, value_count, raw_data);
646
647 if(mem_alloc)
648 _TIFFfree(raw_data);
649 }
650 }
651
652 if (tif->tif_tagmethods.printdir)
653 (*tif->tif_tagmethods.printdir)(tif, fd, flags);
654
655 if ((flags & TIFFPRINT_STRIPS) &&
657 uint32 s;
658
659 fprintf(fd, " %lu %s:\n",
660 (unsigned long) td->td_nstrips,
661 isTiled(tif) ? "Tiles" : "Strips");
662 for (s = 0; s < td->td_nstrips; s++)
663#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
664 fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
665 (unsigned long) s,
666 (unsigned __int64) TIFFGetStrileOffset(tif, s),
667 (unsigned __int64) TIFFGetStrileByteCount(tif, s));
668#else
669 fprintf(fd, " %3lu: [%8llu, %8llu]\n",
670 (unsigned long) s,
671 (unsigned long long) TIFFGetStrileOffset(tif, s),
672 (unsigned long long) TIFFGetStrileByteCount(tif, s));
673#endif
674 }
675}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strchr(const char *String, int ch)
Definition: utclib.c:501
r l[0]
Definition: byte_order.h:168
#define NULL
Definition: types.h:112
#define mem_alloc(bsize)
Definition: types.h:123
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define assert(x)
Definition: debug.h:53
GLdouble s
Definition: gl.h:2039
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLbitfield flags
Definition: glext.h:7161
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
float td_xposition
Definition: tif_dir.h:90
uint16 td_resolutionunit
Definition: tif_dir.h:88
uint16 td_sampleformat
Definition: tif_dir.h:76
uint16 td_samplesperpixel
Definition: tif_dir.h:82
uint32 td_imagedepth
Definition: tif_dir.h:72
float td_xresolution
Definition: tif_dir.h:87
int td_inknameslen
Definition: tif_dir.h:118
uint16 td_pagenumber[2]
Definition: tif_dir.h:91
float * td_refblackwhite
Definition: tif_dir.h:116
uint16 td_bitspersample
Definition: tif_dir.h:75
uint32 td_imagewidth
Definition: tif_dir.h:72
uint16 td_maxsamplevalue
Definition: tif_dir.h:84
uint32 td_rowsperstrip
Definition: tif_dir.h:83
uint32 td_tiledepth
Definition: tif_dir.h:73
float td_yresolution
Definition: tif_dir.h:87
uint16 td_photometric
Definition: tif_dir.h:78
uint16 td_fillorder
Definition: tif_dir.h:80
uint32 td_subfiletype
Definition: tif_dir.h:74
double * td_sminsamplevalue
Definition: tif_dir.h:85
uint16 td_minsamplevalue
Definition: tif_dir.h:84
uint16 td_threshholding
Definition: tif_dir.h:79
char * td_inknames
Definition: tif_dir.h:119
uint16 td_planarconfig
Definition: tif_dir.h:89
uint16 td_nsubifd
Definition: tif_dir.h:109
uint32 td_tilelength
Definition: tif_dir.h:73
uint32 td_nstrips
Definition: tif_dir.h:100
uint16 * td_transferfunction[3]
Definition: tif_dir.h:115
uint16 td_ycbcrpositioning
Definition: tif_dir.h:113
uint16 * td_sampleinfo
Definition: tif_dir.h:95
double * td_smaxsamplevalue
Definition: tif_dir.h:86
uint16 td_compression
Definition: tif_dir.h:77
uint32 td_tilewidth
Definition: tif_dir.h:73
uint32 td_imagelength
Definition: tif_dir.h:72
uint16 td_extrasamples
Definition: tif_dir.h:94
uint16 td_halftonehints[2]
Definition: tif_dir.h:93
uint16 td_orientation
Definition: tif_dir.h:81
uint16 * td_colormap[3]
Definition: tif_dir.h:92
uint16 td_ycbcrsubsampling[2]
Definition: tif_dir.h:112
uint64 * td_subifd
Definition: tif_dir.h:110
float td_yposition
Definition: tif_dir.h:90
TIFFPrintMethod printdir
Definition: tiffio.h:335
uint32 field_tag
Definition: tif_dir.h:283
unsigned char field_passcount
Definition: tif_dir.h:292
short field_readcount
Definition: tif_dir.h:284
TIFFTagMethods tif_tagmethods
Definition: tiffiop.h:219
uint32 tif_flags
Definition: tiffiop.h:119
TIFFDirectory tif_dir
Definition: tiffiop.h:151
uint64 tif_diroff
Definition: tiffiop.h:146
const TIFFCodec * TIFFFindCODEC(uint16 scheme)
Definition: tif_compress.c:186
int TIFFGetField(TIFF *tif, uint32 tag,...)
Definition: tif_dir.c:1232
#define FIELD_RESOLUTION
Definition: tif_dir.h:143
#define FIELD_SUBFILETYPE
Definition: tif_dir.h:147
#define FIELD_STRIPOFFSETS
Definition: tif_dir.h:162
#define FIELD_TRANSFERFUNCTION
Definition: tif_dir.h:174
#define FIELD_HALFTONEHINTS
Definition: tif_dir.h:170
#define FIELD_ORIENTATION
Definition: tif_dir.h:153
#define FIELD_MINSAMPLEVALUE
Definition: tif_dir.h:156
#define FIELD_FILLORDER
Definition: tif_dir.h:152
#define FIELD_SMAXSAMPLEVALUE
Definition: tif_dir.h:167
#define FIELD_IMAGEDIMENSIONS
Definition: tif_dir.h:141
#define FIELD_YCBCRSUBSAMPLING
Definition: tif_dir.h:171
#define FIELD_COLORMAP
Definition: tif_dir.h:163
#define FIELD_SUBIFD
Definition: tif_dir.h:176
#define FIELD_EXTRASAMPLES
Definition: tif_dir.h:164
#define FIELD_IMAGEDEPTH
Definition: tif_dir.h:168
#define FIELD_SMINSAMPLEVALUE
Definition: tif_dir.h:166
#define TIFFFieldSet(tif, field)
Definition: tif_dir.h:196
#define FIELD_MAXSAMPLEVALUE
Definition: tif_dir.h:157
#define FIELD_TILEDEPTH
Definition: tif_dir.h:169
#define FIELD_TILEDIMENSIONS
Definition: tif_dir.h:142
#define FIELD_POSITION
Definition: tif_dir.h:144
#define FIELD_ROWSPERSTRIP
Definition: tif_dir.h:155
#define FIELD_COMPRESSION
Definition: tif_dir.h:149
#define FIELD_YCBCRPOSITIONING
Definition: tif_dir.h:172
#define FIELD_REFBLACKWHITE
Definition: tif_dir.h:173
#define FIELD_SAMPLEFORMAT
Definition: tif_dir.h:165
#define FIELD_PAGENUMBER
Definition: tif_dir.h:160
#define FIELD_BITSPERSAMPLE
Definition: tif_dir.h:148
#define FIELD_INKNAMES
Definition: tif_dir.h:175
#define FIELD_RESOLUTIONUNIT
Definition: tif_dir.h:159
#define FIELD_PLANARCONFIG
Definition: tif_dir.h:158
#define FIELD_SAMPLESPERPIXEL
Definition: tif_dir.h:154
#define FIELD_PHOTOMETRIC
Definition: tif_dir.h:150
#define FIELD_THRESHHOLDING
Definition: tif_dir.h:151
const TIFFField * TIFFFieldWithTag(TIFF *tif, uint32 tag)
Definition: tif_dirinfo.c:558
int _TIFFDataSize(TIFFDataType type)
Definition: tif_dirinfo.c:476
uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile)
Definition: tif_dirread.c:6290
uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile)
Definition: tif_dirread.c:6305
int TIFFGetTagListCount(TIFF *tif)
Definition: tif_extension.c:34
uint32 TIFFGetTagListEntry(TIFF *tif, int tag_index)
Definition: tif_extension.c:42
static void _TIFFPrintField(FILE *fd, const TIFFField *fip, uint32 value_count, void *raw_data)
Definition: tif_print.c:67
#define NORIENTNAMES
Definition: tif_print.c:64
#define NPHOTONAMES
Definition: tif_print.c:51
static int _TIFFPrettyPrintField(TIFF *tif, const TIFFField *fip, FILE *fd, uint32 tag, uint32 value_count, void *raw_data)
Definition: tif_print.c:141
static const char *const photoNames[]
Definition: tif_print.c:38
static const char *const orientNames[]
Definition: tif_print.c:53
void _TIFFfree(void *p)
Definition: tif_unix.c:326
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
#define PLANARCONFIG_SEPARATE
Definition: tiff.h:240
#define THRESHHOLD_HALFTONE
Definition: tiff.h:210
#define EXTRASAMPLE_UNASSALPHA
Definition: tiff.h:306
#define YCBCRPOSITION_CENTERED
Definition: tiff.h:364
#define YCBCRPOSITION_COSITED
Definition: tiff.h:365
#define RESUNIT_CENTIMETER
Definition: tiff.h:264
#define EXTRASAMPLE_ASSOCALPHA
Definition: tiff.h:305
#define FILETYPE_MASK
Definition: tiff.h:149
#define PHOTOMETRIC_LOGL
Definition: tiff.h:206
#define FILLORDER_LSB2MSB
Definition: tiff.h:216
#define SAMPLEFORMAT_COMPLEXINT
Definition: tiff.h:312
#define SAMPLEFORMAT_UINT
Definition: tiff.h:308
#define EXTRASAMPLE_UNSPECIFIED
Definition: tiff.h:304
#define RESUNIT_NONE
Definition: tiff.h:262
#define FILETYPE_REDUCEDIMAGE
Definition: tiff.h:147
#define THRESHHOLD_ERRORDIFFUSE
Definition: tiff.h:211
#define PHOTOMETRIC_LOGLUV
Definition: tiff.h:207
#define FILETYPE_PAGE
Definition: tiff.h:148
#define SAMPLEFORMAT_IEEEFP
Definition: tiff.h:310
#define FILLORDER_MSB2LSB
Definition: tiff.h:215
#define SAMPLEFORMAT_COMPLEXIEEEFP
Definition: tiff.h:313
#define RESUNIT_INCH
Definition: tiff.h:263
#define THRESHHOLD_BILEVEL
Definition: tiff.h:209
#define SAMPLEFORMAT_VOID
Definition: tiff.h:311
#define SAMPLEFORMAT_INT
Definition: tiff.h:309
#define PLANARCONFIG_CONTIG
Definition: tiff.h:239
#define TIFFPRINT_STRIPS
Definition: tiffio.h:114
#define TIFFPRINT_COLORMAP
Definition: tiffio.h:116
#define TIFF_SPP
Definition: tiffio.h:309
#define TIFF_VARIABLE
Definition: tiffio.h:308
#define TIFFPRINT_CURVES
Definition: tiffio.h:115
#define TIFF_VARIABLE2
Definition: tiffio.h:310
#define isTiled(tif)
Definition: tiffiop.h:229
#define TIFF_PERSAMPLE
Definition: tiffiop.h:141

Variable Documentation

◆ orientNames

const char* const orientNames[]
static
Initial value:
= {
"0 (0x0)",
"row 0 top, col 0 lhs",
"row 0 top, col 0 rhs",
"row 0 bottom, col 0 rhs",
"row 0 bottom, col 0 lhs",
"row 0 lhs, col 0 top",
"row 0 rhs, col 0 top",
"row 0 rhs, col 0 bottom",
"row 0 lhs, col 0 bottom",
}

Definition at line 53 of file tif_print.c.

Referenced by TIFFPrintDirectory().

◆ photoNames

const char* const photoNames[]
static
Initial value:
= {
"min-is-white",
"min-is-black",
"RGB color",
"palette color (RGB from colormap)",
"transparency mask",
"separated",
"YCbCr",
"7 (0x7)",
"CIE L*a*b*",
"ICC L*a*b*",
"ITU L*a*b*"
}

Definition at line 38 of file tif_print.c.

Referenced by TIFFPrintDirectory().