ReactOS 0.4.16-dev-2574-g474348f
tif_print.c File Reference
#include "tiffiop.h"
#include <stdio.h>
#include <ctype.h>
Include dependency graph for tif_print.c:

Go to the source code of this file.

Classes

struct  tagname
 

Macros

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

Functions

static void _TIFFprintAsciiBounded (FILE *fd, const char *cp, size_t max_chars)
 
static void _TIFFPrintField (FILE *fd, const TIFFField *fip, uint32_t value_count, void *raw_data)
 
static int _TIFFPrettyPrintField (TIFF *tif, const TIFFField *fip, FILE *fd, uint32_t tag, uint32_t 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 []
 
static const struct tagname tagnames []
 

Macro Definition Documentation

◆ NORIENTNAMES

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

Definition at line 63 of file tif_print.c.

◆ NPHOTONAMES

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

Definition at line 50 of file tif_print.c.

◆ NTAGS

#define NTAGS   (sizeof(tagnames) / sizeof(tagnames[0]))

Definition at line 73 of file tif_print.c.

Function Documentation

◆ _TIFFPrettyPrintField()

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

Definition at line 151 of file tif_print.c.

154{
155 (void)tif;
156
157 /* do not try to pretty print auto-defined fields */
158 if (TIFFFieldIsAnonymous(fip))
159 {
160 return 0;
161 }
162
163 switch (tag)
164 {
165 case TIFFTAG_INKSET:
166 if (value_count == 2 && fip->field_type == TIFF_SHORT)
167 {
168 fprintf(fd, " Ink Set: ");
169 switch (*((uint16_t *)raw_data))
170 {
171 case INKSET_CMYK:
172 fprintf(fd, "CMYK\n");
173 break;
174 default:
175 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n",
176 *((uint16_t *)raw_data),
177 *((uint16_t *)raw_data));
178 break;
179 }
180 return 1;
181 }
182 return 0;
183
184 case TIFFTAG_DOTRANGE:
185 if (value_count == 2 && fip->field_type == TIFF_SHORT)
186 {
187 fprintf(fd, " Dot Range: %" PRIu16 "-%" PRIu16 "\n",
188 ((uint16_t *)raw_data)[0], ((uint16_t *)raw_data)[1]);
189 return 1;
190 }
191 return 0;
192
194 if (value_count == 2 && fip->field_type == TIFF_RATIONAL)
195 {
196 fprintf(fd, " White Point: %g-%g\n", ((float *)raw_data)[0],
197 ((float *)raw_data)[1]);
198 return 1;
199 }
200 return 0;
201
203 {
204 uint32_t i;
205
206 fprintf(fd, " XMLPacket (XMP Metadata):\n");
207 for (i = 0; i < value_count; i++)
208 fputc(((char *)raw_data)[i], fd);
209 fprintf(fd, "\n");
210 return 1;
211 }
213 fprintf(fd, " RichTIFFIPTC Data: <present>, %" PRIu32 " bytes\n",
214 value_count);
215 return 1;
216
218 fprintf(fd, " Photoshop Data: <present>, %" PRIu32 " bytes\n",
219 value_count);
220 return 1;
221
223 fprintf(fd, " ICC Profile: <present>, %" PRIu32 " bytes\n",
224 value_count);
225 return 1;
226
227 case TIFFTAG_STONITS:
228 if (value_count == 1 && fip->field_type == TIFF_DOUBLE)
229 {
230 fprintf(fd, " Sample to Nits conversion factor: %.4e\n",
231 *((double *)raw_data));
232 return 1;
233 }
234 return 0;
235 }
236
237 return 0;
238}
UINT32 uint32_t
Definition: types.h:75
int WINAPIV fprintf(FILE *file, const char *format,...)
Definition: file.c:5549
int CDECL fputc(int c, FILE *file)
Definition: file.c:4360
#define PRIx16
Definition: inttypes.h:100
#define PRIu16
Definition: inttypes.h:83
#define PRIu32
Definition: inttypes.h:84
unsigned short uint16_t
Definition: stdint.h:35
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
static int fd
Definition: io.c:51
TIFFDataType field_type
Definition: tif_dir.h:335
Definition: ecma_167.h:138
int TIFFFieldIsAnonymous(const TIFFField *fip)
Definition: tif_dirinfo.c:879
#define TIFFTAG_WHITEPOINT
Definition: tiff.h:307
#define TIFFTAG_DOTRANGE
Definition: tiff.h:327
#define TIFFTAG_XMLPACKET
Definition: tiff.h:394
#define TIFFTAG_INKSET
Definition: tiff.h:322
@ TIFF_SHORT
Definition: tiff.h:150
@ TIFF_DOUBLE
Definition: tiff.h:159
@ TIFF_RATIONAL
Definition: tiff.h:152
#define INKSET_CMYK
Definition: tiff.h:323
#define TIFFTAG_ICCPROFILE
Definition: tiff.h:479
#define TIFFTAG_STONITS
Definition: tiff.h:490
#define TIFFTAG_PHOTOSHOP
Definition: tiff.h:475
#define TIFFTAG_RICHTIFFIPTC
Definition: tiff.h:448

Referenced by TIFFPrintDirectory().

◆ _TIFFprintAscii()

void _TIFFprintAscii ( FILE fd,
const char cp 
)

Definition at line 725 of file tif_print.c.

726{
728}
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
POINT cp
Definition: magnifier.c:59
static void _TIFFprintAsciiBounded(FILE *fd, const char *cp, size_t max_chars)
Definition: tif_print.c:730

Referenced by _TIFFprintAsciiTag().

◆ _TIFFprintAsciiBounded()

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

Definition at line 730 of file tif_print.c.

731{
732 for (; max_chars > 0 && *cp != '\0'; cp++, max_chars--)
733 {
734 const char *tp;
735
736 if (isprint((int)*cp))
737 {
738 fputc(*cp, fd);
739 continue;
740 }
741 for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
742 if (*tp++ == *cp)
743 break;
744 if (*tp)
745 fprintf(fd, "\\%c", *tp);
746 else
747 fprintf(fd, "\\%03o", *cp & 0xff);
748 }
749}
#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 751 of file tif_print.c.

752{
753 fprintf(fd, " %s: \"", name);
755 fprintf(fd, "\"\n");
756}
Definition: name.c:39
void _TIFFprintAscii(FILE *fd, const char *cp)
Definition: tif_print.c:725
Definition: pdh_main.c:96

◆ _TIFFPrintField()

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

Definition at line 75 of file tif_print.c.

77{
78 uint32_t j;
79
80 /* Print a user-friendly name for tags of relatively common use, but */
81 /* which aren't registered by libtiff itself. */
82 const char *field_name = fip->field_name;
83 if (TIFFFieldIsAnonymous(fip))
84 {
85 for (size_t i = 0; i < NTAGS; ++i)
86 {
87 if (fip->field_tag == tagnames[i].tag)
88 {
89 field_name = tagnames[i].name;
90 break;
91 }
92 }
93 }
94 fprintf(fd, " %s: ", field_name);
95
96 for (j = 0; j < value_count; j++)
97 {
98 if (fip->field_type == TIFF_BYTE)
99 fprintf(fd, "%" PRIu8, ((uint8_t *)raw_data)[j]);
100 else if (fip->field_type == TIFF_UNDEFINED)
101 fprintf(fd, "0x%" PRIx8, ((uint8_t *)raw_data)[j]);
102 else if (fip->field_type == TIFF_SBYTE)
103 fprintf(fd, "%" PRId8, ((int8_t *)raw_data)[j]);
104 else if (fip->field_type == TIFF_SHORT)
105 fprintf(fd, "%" PRIu16, ((uint16_t *)raw_data)[j]);
106 else if (fip->field_type == TIFF_SSHORT)
107 fprintf(fd, "%" PRId16, ((int16_t *)raw_data)[j]);
108 else if (fip->field_type == TIFF_LONG)
109 fprintf(fd, "%" PRIu32, ((uint32_t *)raw_data)[j]);
110 else if (fip->field_type == TIFF_SLONG)
111 fprintf(fd, "%" PRId32, ((int32_t *)raw_data)[j]);
112 else if (fip->field_type == TIFF_IFD)
113 fprintf(fd, "0x%" PRIx32, ((uint32_t *)raw_data)[j]);
114 else if (fip->field_type == TIFF_RATIONAL ||
116 {
117 int tv_size = TIFFFieldSetGetSize(fip);
118 if (tv_size == 8)
119 fprintf(fd, "%lf", ((double *)raw_data)[j]);
120 else
121 fprintf(fd, "%f", ((float *)raw_data)[j]);
122 }
123 else if (fip->field_type == TIFF_FLOAT)
124 fprintf(fd, "%f", ((float *)raw_data)[j]);
125 else if (fip->field_type == TIFF_LONG8)
126 fprintf(fd, "%" PRIu64, ((uint64_t *)raw_data)[j]);
127 else if (fip->field_type == TIFF_SLONG8)
128 fprintf(fd, "%" PRId64, ((int64_t *)raw_data)[j]);
129 else if (fip->field_type == TIFF_IFD8)
130 fprintf(fd, "0x%" PRIx64, ((uint64_t *)raw_data)[j]);
131 else if (fip->field_type == TIFF_DOUBLE)
132 fprintf(fd, "%lf", ((double *)raw_data)[j]);
133 else if (fip->field_type == TIFF_ASCII)
134 {
135 fprintf(fd, "%s", (char *)raw_data);
136 break;
137 }
138 else
139 {
140 fprintf(fd, "<unsupported data type in TIFFPrint>");
141 break;
142 }
143
144 if (j < value_count - 1)
145 fprintf(fd, ",");
146 }
147
148 fprintf(fd, "\n");
149}
INT32 int32_t
Definition: types.h:71
INT16 int16_t
Definition: types.h:70
UINT64 uint64_t
Definition: types.h:77
INT64 int64_t
Definition: types.h:72
#define PRId16
Definition: inttypes.h:34
#define PRId32
Definition: inttypes.h:35
#define PRIx32
Definition: inttypes.h:101
#define PRIu8
Definition: inttypes.h:82
#define PRIx64
Definition: inttypes.h:29
#define PRIu64
Definition: inttypes.h:28
#define PRIx8
Definition: inttypes.h:99
#define PRId64
Definition: inttypes.h:25
#define PRId8
Definition: inttypes.h:33
unsigned char uint8_t
Definition: stdint.h:33
signed char int8_t
Definition: stdint.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 GLint GLint j
Definition: glfuncs.h:250
char * field_name
Definition: tif_dir.h:343
uint32_t field_tag
Definition: tif_dir.h:332
int TIFFFieldSetGetSize(const TIFFField *fip)
Definition: tif_dirinfo.c:673
#define NTAGS
Definition: tif_print.c:73
static const struct tagname tagnames[]
@ TIFF_SSHORT
Definition: tiff.h:155
@ TIFF_SLONG
Definition: tiff.h:156
@ TIFF_BYTE
Definition: tiff.h:148
@ TIFF_SBYTE
Definition: tiff.h:153
@ TIFF_IFD
Definition: tiff.h:160
@ TIFF_UNDEFINED
Definition: tiff.h:154
@ TIFF_LONG
Definition: tiff.h:151
@ TIFF_SLONG8
Definition: tiff.h:162
@ TIFF_LONG8
Definition: tiff.h:161
@ TIFF_ASCII
Definition: tiff.h:149
@ TIFF_FLOAT
Definition: tiff.h:158
@ TIFF_IFD8
Definition: tiff.h:163
@ TIFF_SRATIONAL
Definition: tiff.h:157

Referenced by TIFFPrintDirectory().

◆ TIFFPrintDirectory()

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

Definition at line 244 of file tif_print.c.

245{
246 TIFFDirectory *td = &tif->tif_dir;
247 char *sep;
248 long l, n;
249
250 fprintf(fd, "TIFF Directory at offset 0x%" PRIx64 " (%" PRIu64 ")\n",
251 tif->tif_diroff, tif->tif_diroff);
253 {
254 fprintf(fd, " Subfile Type:");
255 sep = " ";
257 {
258 fprintf(fd, "%sreduced-resolution image", sep);
259 sep = "/";
260 }
262 {
263 fprintf(fd, "%smulti-page document", sep);
264 sep = "/";
265 }
267 fprintf(fd, "%stransparency mask", sep);
268 fprintf(fd, " (%" PRIu32 " = 0x%" PRIx32 ")\n", td->td_subfiletype,
269 td->td_subfiletype);
270 }
272 {
273 fprintf(fd, " Image Width: %" PRIu32 " Image Length: %" PRIu32,
276 fprintf(fd, " Image Depth: %" PRIu32, td->td_imagedepth);
277 fprintf(fd, "\n");
278 }
280 {
281 fprintf(fd, " Tile Width: %" PRIu32 " Tile Length: %" PRIu32,
282 td->td_tilewidth, td->td_tilelength);
284 fprintf(fd, " Tile Depth: %" PRIu32, td->td_tiledepth);
285 fprintf(fd, "\n");
286 }
288 {
289 fprintf(fd, " Resolution: %g, %g", td->td_xresolution,
290 td->td_yresolution);
292 {
293 switch (td->td_resolutionunit)
294 {
295 case RESUNIT_NONE:
296 fprintf(fd, " (unitless)");
297 break;
298 case RESUNIT_INCH:
299 fprintf(fd, " pixels/inch");
300 break;
302 fprintf(fd, " pixels/cm");
303 break;
304 default:
305 fprintf(fd, " (unit %" PRIu16 " = 0x%" PRIx16 ")",
307 break;
308 }
309 }
310 fprintf(fd, "\n");
311 }
313 fprintf(fd, " Position: %g, %g\n", td->td_xposition, td->td_yposition);
315 fprintf(fd, " Bits/Sample: %" PRIu16 "\n", td->td_bitspersample);
317 {
318 fprintf(fd, " Sample Format: ");
319 switch (td->td_sampleformat)
320 {
322 fprintf(fd, "void\n");
323 break;
324 case SAMPLEFORMAT_INT:
325 fprintf(fd, "signed integer\n");
326 break;
328 fprintf(fd, "unsigned integer\n");
329 break;
331 fprintf(fd, "IEEE floating point\n");
332 break;
334 fprintf(fd, "complex signed integer\n");
335 break;
337 fprintf(fd, "complex IEEE floating point\n");
338 break;
339 default:
340 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n",
342 break;
343 }
344 }
346 {
348 fprintf(fd, " Compression Scheme: ");
349 if (c)
350 fprintf(fd, "%s\n", c->name);
351 else
352 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n", td->td_compression,
353 td->td_compression);
354 }
356 {
357 fprintf(fd, " Photometric Interpretation: ");
358 if (td->td_photometric < NPHOTONAMES)
359 fprintf(fd, "%s\n", photoNames[td->td_photometric]);
360 else
361 {
362 switch (td->td_photometric)
363 {
364 case PHOTOMETRIC_LOGL:
365 fprintf(fd, "CIE Log2(L)\n");
366 break;
368 fprintf(fd, "CIE Log2(L) (u',v')\n");
369 break;
370 default:
371 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n",
373 break;
374 }
375 }
376 }
378 {
379 uint16_t i;
380 fprintf(fd, " Extra Samples: %" PRIu16 "<", td->td_extrasamples);
381 sep = "";
382 for (i = 0; i < td->td_extrasamples; i++)
383 {
384 switch (td->td_sampleinfo[i])
385 {
387 fprintf(fd, "%sunspecified", sep);
388 break;
390 fprintf(fd, "%sassoc-alpha", sep);
391 break;
393 fprintf(fd, "%sunassoc-alpha", sep);
394 break;
395 default:
396 fprintf(fd, "%s%" PRIu16 " (0x%" PRIx16 ")", sep,
397 td->td_sampleinfo[i], td->td_sampleinfo[i]);
398 break;
399 }
400 sep = ", ";
401 }
402 fprintf(fd, ">\n");
403 }
405 {
406 char *cp;
407 uint16_t i;
408 fprintf(fd, " Ink Names: ");
409 i = td->td_samplesperpixel;
410 sep = "";
411 for (cp = td->td_inknames;
412 i > 0 && cp < td->td_inknames + td->td_inknameslen;
413 cp = strchr(cp, '\0') + 1, i--)
414 {
415 size_t max_chars = td->td_inknameslen - (cp - td->td_inknames);
416 fputs(sep, fd);
417 _TIFFprintAsciiBounded(fd, cp, max_chars);
418 sep = ", ";
419 }
420 fputs("\n", fd);
421 }
423 {
424 fprintf(fd, " NumberOfInks: %d\n", td->td_numberofinks);
425 }
427 {
428 fprintf(fd, " Thresholding: ");
429 switch (td->td_threshholding)
430 {
432 fprintf(fd, "bilevel art scan\n");
433 break;
435 fprintf(fd, "halftone or dithered scan\n");
436 break;
438 fprintf(fd, "error diffused\n");
439 break;
440 default:
441 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n",
443 break;
444 }
445 }
447 {
448 fprintf(fd, " FillOrder: ");
449 switch (td->td_fillorder)
450 {
452 fprintf(fd, "msb-to-lsb\n");
453 break;
455 fprintf(fd, "lsb-to-msb\n");
456 break;
457 default:
458 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n", td->td_fillorder,
459 td->td_fillorder);
460 break;
461 }
462 }
464 {
465 fprintf(fd, " YCbCr Subsampling: %" PRIu16 ", %" PRIu16 "\n",
467 }
469 {
470 fprintf(fd, " YCbCr Positioning: ");
471 switch (td->td_ycbcrpositioning)
472 {
474 fprintf(fd, "centered\n");
475 break;
477 fprintf(fd, "cosited\n");
478 break;
479 default:
480 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n",
482 break;
483 }
484 }
486 fprintf(fd, " Halftone Hints: light %" PRIu16 " dark %" PRIu16 "\n",
487 td->td_halftonehints[0], td->td_halftonehints[1]);
489 {
490 fprintf(fd, " Orientation: ");
492 fprintf(fd, "%s\n", orientNames[td->td_orientation]);
493 else
494 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n", td->td_orientation,
495 td->td_orientation);
496 }
498 fprintf(fd, " Samples/Pixel: %" PRIx16 "\n", td->td_samplesperpixel);
500 {
501 fprintf(fd, " Rows/Strip: ");
502 if (td->td_rowsperstrip == (uint32_t)-1)
503 fprintf(fd, "(infinite)\n");
504 else
505 fprintf(fd, "%" PRIu32 "\n", td->td_rowsperstrip);
506 }
508 fprintf(fd, " Min Sample Value: %" PRIu16 "\n", td->td_minsamplevalue);
510 fprintf(fd, " Max Sample Value: %" PRIu16 "\n", td->td_maxsamplevalue);
512 {
513 int i;
514 int count =
516 fprintf(fd, " SMin Sample Value:");
517 for (i = 0; i < count; ++i)
518 fprintf(fd, " %g", td->td_sminsamplevalue[i]);
519 fprintf(fd, "\n");
520 }
522 {
523 int i;
524 int count =
526 fprintf(fd, " SMax Sample Value:");
527 for (i = 0; i < count; ++i)
528 fprintf(fd, " %g", td->td_smaxsamplevalue[i]);
529 fprintf(fd, "\n");
530 }
532 {
533 fprintf(fd, " Planar Configuration: ");
534 switch (td->td_planarconfig)
535 {
537 fprintf(fd, "single image plane\n");
538 break;
540 fprintf(fd, "separate image planes\n");
541 break;
542 default:
543 fprintf(fd, "%" PRIu16 " (0x%" PRIx16 ")\n",
545 break;
546 }
547 }
549 fprintf(fd, " Page Number: %" PRIu16 "-%" PRIu16 "\n",
550 td->td_pagenumber[0], td->td_pagenumber[1]);
552 {
553 fprintf(fd, " Color Map: ");
555 {
556 fprintf(fd, "\n");
557 n = 1L << td->td_bitspersample;
558 for (l = 0; l < n; l++)
559 fprintf(fd, " %5ld: %5" PRIu16 " %5" PRIu16 " %5" PRIu16 "\n",
560 l, td->td_colormap[0][l], td->td_colormap[1][l],
561 td->td_colormap[2][l]);
562 }
563 else
564 fprintf(fd, "(present)\n");
565 }
567 {
568 int i;
569 fprintf(fd, " Reference Black/White:\n");
570 for (i = 0; i < 3; i++)
571 fprintf(fd, " %2d: %5g %5g\n", i,
572 td->td_refblackwhite[2 * i + 0],
573 td->td_refblackwhite[2 * i + 1]);
574 }
576 {
577 fprintf(fd, " Transfer Function: ");
579 {
580 fprintf(fd, "\n");
581 n = 1L << td->td_bitspersample;
582 for (l = 0; l < n; l++)
583 {
584 uint16_t i;
585 fprintf(fd, " %2ld: %5" PRIu16, l,
586 td->td_transferfunction[0][l]);
587 for (i = 1;
588 i < td->td_samplesperpixel - td->td_extrasamples && i < 3;
589 i++)
590 fprintf(fd, " %5" PRIu16, td->td_transferfunction[i][l]);
591 fputc('\n', fd);
592 }
593 }
594 else
595 fprintf(fd, "(present)\n");
596 }
597 if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd))
598 {
599 uint16_t i;
600 fprintf(fd, " SubIFD Offsets:");
601 for (i = 0; i < td->td_nsubifd; i++)
602 fprintf(fd, " %5" PRIu64, td->td_subifd[i]);
603 fputc('\n', fd);
604 }
605
606 /*
607 ** Custom tag support.
608 */
609 {
610 int i;
611 short count;
612
614 for (i = 0; i < count; i++)
615 {
617 const TIFFField *fip;
618 uint32_t value_count;
619 int mem_alloc = 0;
620 void *raw_data = NULL;
621 uint16_t dotrange[2]; /* must be kept in that scope and not moved in
622 the below TIFFTAG_DOTRANGE specific case */
623
624 fip = TIFFFieldWithTag(tif, tag);
625 if (fip == NULL)
626 continue;
627
628 if (fip->field_passcount)
629 {
631 {
632 if (TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
633 continue;
634 }
635 else if (fip->field_readcount == TIFF_VARIABLE)
636 {
637 uint16_t small_value_count;
638 if (TIFFGetField(tif, tag, &small_value_count, &raw_data) !=
639 1)
640 continue;
641 value_count = small_value_count;
642 }
643 else
644 {
647 continue;
648 }
649 }
650 else
651 {
652 if (fip->field_readcount == TIFF_VARIABLE ||
654 value_count = 1;
655 else if (fip->field_readcount == TIFF_SPP)
656 value_count = td->td_samplesperpixel;
657 else
658 value_count = fip->field_readcount;
659 if (fip->field_tag == TIFFTAG_DOTRANGE &&
660 strcmp(fip->field_name, "DotRange") == 0)
661 {
662 /* TODO: This is an evil exception and should not have been
663 handled this way ... likely best if we move it into
664 the directory structure with an explicit field in
665 libtiff 4.1 and assign it a FIELD_ value */
666 raw_data = dotrange;
667 TIFFGetField(tif, tag, dotrange + 0, dotrange + 1);
668 }
669 else if (fip->field_type == TIFF_ASCII ||
672 fip->field_readcount == TIFF_SPP || value_count > 1)
673 {
674 if (TIFFGetField(tif, tag, &raw_data) != 1)
675 continue;
676 }
677 else
678 {
679 /*--: Rational2Double: For Rationals evaluate
680 * "set_get_field_type" to determine internal storage size.
681 */
682 int tv_size = TIFFFieldSetGetSize(fip);
683 raw_data = _TIFFmallocExt(tif, tv_size * value_count);
684 mem_alloc = 1;
685 if (TIFFGetField(tif, tag, raw_data) != 1)
686 {
687 _TIFFfreeExt(tif, raw_data);
688 continue;
689 }
690 }
691 }
692
693 /*
694 * Catch the tags which needs to be specially handled
695 * and pretty print them. If tag not handled in
696 * _TIFFPrettyPrintField() fall down and print it as
697 * any other tag.
698 */
699 if (raw_data != NULL &&
700 !_TIFFPrettyPrintField(tif, fip, fd, tag, value_count,
701 raw_data))
702 _TIFFPrintField(fd, fip, value_count, raw_data);
703
704 if (mem_alloc)
705 _TIFFfreeExt(tif, raw_data);
706 }
707 }
708
709 if (tif->tif_tagmethods.printdir)
710 (*tif->tif_tagmethods.printdir)(tif, fd, flags);
711
713 {
714 uint32_t s;
715
716 fprintf(fd, " %" PRIu32 " %s:\n", td->td_nstrips,
717 isTiled(tif) ? "Tiles" : "Strips");
718 for (s = 0; s < td->td_nstrips; s++)
719 fprintf(fd, " %3" PRIu32 ": [%8" PRIu64 ", %8" PRIu64 "]\n", s,
722 }
723}
r l[0]
Definition: byte_order.h:168
#define NULL
Definition: types.h:112
#define mem_alloc(bsize)
Definition: types.h:123
int CDECL fputs(const char *s, FILE *file)
Definition: file.c:4769
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3286
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLbitfield flags
Definition: glext.h:7161
uint16_t td_pagenumber[2]
Definition: tif_dir.h:102
float td_xposition
Definition: tif_dir.h:101
uint32_t td_tiledepth
Definition: tif_dir.h:84
uint16_t td_fillorder
Definition: tif_dir.h:91
float td_xresolution
Definition: tif_dir.h:98
int td_inknameslen
Definition: tif_dir.h:138
uint16_t * td_sampleinfo
Definition: tif_dir.h:106
float * td_refblackwhite
Definition: tif_dir.h:136
uint32_t td_rowsperstrip
Definition: tif_dir.h:94
uint32_t td_imagewidth
Definition: tif_dir.h:83
uint16_t td_compression
Definition: tif_dir.h:88
uint16_t td_photometric
Definition: tif_dir.h:89
uint32_t td_tilewidth
Definition: tif_dir.h:84
float td_yresolution
Definition: tif_dir.h:98
uint16_t td_extrasamples
Definition: tif_dir.h:105
uint16_t td_threshholding
Definition: tif_dir.h:90
uint16_t td_minsamplevalue
Definition: tif_dir.h:95
double * td_sminsamplevalue
Definition: tif_dir.h:96
uint16_t td_bitspersample
Definition: tif_dir.h:86
char * td_inknames
Definition: tif_dir.h:139
uint16_t * td_transferfunction[3]
Definition: tif_dir.h:135
uint16_t td_maxsamplevalue
Definition: tif_dir.h:95
uint32_t td_imagedepth
Definition: tif_dir.h:83
uint16_t td_orientation
Definition: tif_dir.h:92
uint16_t td_resolutionunit
Definition: tif_dir.h:99
uint16_t td_planarconfig
Definition: tif_dir.h:100
double * td_smaxsamplevalue
Definition: tif_dir.h:97
uint16_t * td_colormap[3]
Definition: tif_dir.h:103
uint16_t td_sampleformat
Definition: tif_dir.h:87
uint16_t td_ycbcrsubsampling[2]
Definition: tif_dir.h:132
uint16_t td_samplesperpixel
Definition: tif_dir.h:93
uint32_t td_subfiletype
Definition: tif_dir.h:85
uint32_t td_nstrips
Definition: tif_dir.h:111
uint16_t td_numberofinks
Definition: tif_dir.h:140
uint32_t td_imagelength
Definition: tif_dir.h:83
uint32_t td_tilelength
Definition: tif_dir.h:84
uint16_t td_nsubifd
Definition: tif_dir.h:129
uint64_t * td_subifd
Definition: tif_dir.h:130
float td_yposition
Definition: tif_dir.h:101
uint16_t td_ycbcrpositioning
Definition: tif_dir.h:133
uint16_t td_halftonehints[2]
Definition: tif_dir.h:104
TIFFPrintMethod printdir
Definition: tiffio.h:377
unsigned char field_passcount
Definition: tif_dir.h:342
short field_readcount
Definition: tif_dir.h:333
TIFFTagMethods tif_tagmethods
Definition: tiffiop.h:244
uint64_t tif_diroff
Definition: tiffiop.h:150
TIFFDirectory tif_dir
Definition: tiffiop.h:157
uint32_t tif_flags
Definition: tiffiop.h:117
const TIFFCodec * TIFFFindCODEC(uint16_t scheme)
Definition: tif_compress.c:192
int TIFFGetField(TIFF *tif, uint32_t tag,...)
Definition: tif_dir.c:1582
#define FIELD_RESOLUTION
Definition: tif_dir.h:183
#define FIELD_SUBFILETYPE
Definition: tif_dir.h:187
#define FIELD_STRIPOFFSETS
Definition: tif_dir.h:202
#define FIELD_TRANSFERFUNCTION
Definition: tif_dir.h:214
#define FIELD_HALFTONEHINTS
Definition: tif_dir.h:210
#define FIELD_ORIENTATION
Definition: tif_dir.h:193
#define FIELD_MINSAMPLEVALUE
Definition: tif_dir.h:196
#define FIELD_FILLORDER
Definition: tif_dir.h:192
#define FIELD_SMAXSAMPLEVALUE
Definition: tif_dir.h:207
#define FIELD_IMAGEDIMENSIONS
Definition: tif_dir.h:181
#define FIELD_YCBCRSUBSAMPLING
Definition: tif_dir.h:211
#define FIELD_COLORMAP
Definition: tif_dir.h:203
#define FIELD_SUBIFD
Definition: tif_dir.h:216
#define FIELD_EXTRASAMPLES
Definition: tif_dir.h:204
#define FIELD_IMAGEDEPTH
Definition: tif_dir.h:208
#define FIELD_SMINSAMPLEVALUE
Definition: tif_dir.h:206
#define TIFFFieldSet(tif, field)
Definition: tif_dir.h:236
#define FIELD_MAXSAMPLEVALUE
Definition: tif_dir.h:197
#define FIELD_NUMBEROFINKS
Definition: tif_dir.h:217
#define FIELD_TILEDEPTH
Definition: tif_dir.h:209
#define FIELD_TILEDIMENSIONS
Definition: tif_dir.h:182
#define FIELD_POSITION
Definition: tif_dir.h:184
#define FIELD_ROWSPERSTRIP
Definition: tif_dir.h:195
#define FIELD_COMPRESSION
Definition: tif_dir.h:189
#define FIELD_YCBCRPOSITIONING
Definition: tif_dir.h:212
#define FIELD_REFBLACKWHITE
Definition: tif_dir.h:213
#define FIELD_SAMPLEFORMAT
Definition: tif_dir.h:205
#define FIELD_PAGENUMBER
Definition: tif_dir.h:200
#define FIELD_BITSPERSAMPLE
Definition: tif_dir.h:188
#define FIELD_INKNAMES
Definition: tif_dir.h:215
#define FIELD_RESOLUTIONUNIT
Definition: tif_dir.h:199
#define FIELD_PLANARCONFIG
Definition: tif_dir.h:198
#define FIELD_SAMPLESPERPIXEL
Definition: tif_dir.h:194
#define FIELD_PHOTOMETRIC
Definition: tif_dir.h:190
#define FIELD_THRESHHOLDING
Definition: tif_dir.h:191
const TIFFField * TIFFFieldWithTag(TIFF *tif, uint32_t tag)
Definition: tif_dirinfo.c:845
uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile)
Definition: tif_dirread.c:8349
uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile)
Definition: tif_dirread.c:8366
uint32_t TIFFGetTagListEntry(TIFF *tif, int tag_index)
Definition: tif_extension.c:42
int TIFFGetTagListCount(TIFF *tif)
Definition: tif_extension.c:34
void _TIFFfreeExt(TIFF *tif, void *p)
Definition: tif_open.c:275
void * _TIFFmallocExt(TIFF *tif, tmsize_t s)
Definition: tif_open.c:173
static int _TIFFPrettyPrintField(TIFF *tif, const TIFFField *fip, FILE *fd, uint32_t tag, uint32_t value_count, void *raw_data)
Definition: tif_print.c:151
#define NORIENTNAMES
Definition: tif_print.c:63
#define NPHOTONAMES
Definition: tif_print.c:50
static void _TIFFPrintField(FILE *fd, const TIFFField *fip, uint32_t value_count, void *raw_data)
Definition: tif_print.c:75
static const char *const photoNames[]
Definition: tif_print.c:37
static const char *const orientNames[]
Definition: tif_print.c:52
#define PLANARCONFIG_SEPARATE
Definition: tiff.h:266
#define THRESHHOLD_HALFTONE
Definition: tiff.h:236
#define EXTRASAMPLE_UNASSALPHA
Definition: tiff.h:332
#define YCBCRPOSITION_CENTERED
Definition: tiff.h:390
#define YCBCRPOSITION_COSITED
Definition: tiff.h:391
#define RESUNIT_CENTIMETER
Definition: tiff.h:290
#define EXTRASAMPLE_ASSOCALPHA
Definition: tiff.h:331
#define FILETYPE_MASK
Definition: tiff.h:173
#define PHOTOMETRIC_LOGL
Definition: tiff.h:232
#define FILLORDER_LSB2MSB
Definition: tiff.h:242
#define SAMPLEFORMAT_COMPLEXINT
Definition: tiff.h:338
#define SAMPLEFORMAT_UINT
Definition: tiff.h:334
#define EXTRASAMPLE_UNSPECIFIED
Definition: tiff.h:330
#define RESUNIT_NONE
Definition: tiff.h:288
#define FILETYPE_REDUCEDIMAGE
Definition: tiff.h:171
#define THRESHHOLD_ERRORDIFFUSE
Definition: tiff.h:237
#define PHOTOMETRIC_LOGLUV
Definition: tiff.h:233
#define FILETYPE_PAGE
Definition: tiff.h:172
#define SAMPLEFORMAT_IEEEFP
Definition: tiff.h:336
#define FILLORDER_MSB2LSB
Definition: tiff.h:241
#define SAMPLEFORMAT_COMPLEXIEEEFP
Definition: tiff.h:339
#define RESUNIT_INCH
Definition: tiff.h:289
#define THRESHHOLD_BILEVEL
Definition: tiff.h:235
#define SAMPLEFORMAT_VOID
Definition: tiff.h:337
#define SAMPLEFORMAT_INT
Definition: tiff.h:335
#define PLANARCONFIG_CONTIG
Definition: tiff.h:265
#define TIFFPRINT_STRIPS
Definition: tiffio.h:116
#define TIFFPRINT_COLORMAP
Definition: tiffio.h:118
#define TIFF_SPP
Definition: tiffio.h:343
#define TIFF_VARIABLE
Definition: tiffio.h:342
#define TIFFPRINT_CURVES
Definition: tiffio.h:117
#define TIFF_VARIABLE2
Definition: tiffio.h:344
#define isTiled(tif)
Definition: tiffiop.h:274
#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 52 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 37 of file tif_print.c.

Referenced by TIFFPrintDirectory().

◆ tagnames

const struct tagname tagnames[]
static
Initial value:
= {
{TIFFTAG_GDAL_METADATA, "GDAL Metadata"},
{TIFFTAG_GDAL_NODATA, "GDAL NoDataValue"},
}
#define TIFFTAG_GDAL_METADATA
Definition: tiff.h:495
#define TIFFTAG_GDAL_NODATA
Definition: tiff.h:496

Referenced by _TIFFPrintField().