ReactOS  0.4.14-dev-376-gaedba84
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 65 of file tif_print.c.

◆ NPHOTONAMES

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

Definition at line 52 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 142 of file tif_print.c.

144 {
145  (void) tif;
146 
147  /* do not try to pretty print auto-defined fields */
148  if (strncmp(fip->field_name,"Tag ", 4) == 0) {
149  return 0;
150  }
151 
152  switch (tag)
153  {
154  case TIFFTAG_INKSET:
155  if (value_count == 2 && fip->field_type == TIFF_SHORT) {
156  fprintf(fd, " Ink Set: ");
157  switch (*((uint16*)raw_data)) {
158  case INKSET_CMYK:
159  fprintf(fd, "CMYK\n");
160  break;
161  default:
162  fprintf(fd, "%u (0x%x)\n",
163  *((uint16*)raw_data),
164  *((uint16*)raw_data));
165  break;
166  }
167  return 1;
168  }
169  return 0;
170 
171  case TIFFTAG_DOTRANGE:
172  if (value_count == 2 && fip->field_type == TIFF_SHORT) {
173  fprintf(fd, " Dot Range: %u-%u\n",
174  ((uint16*)raw_data)[0], ((uint16*)raw_data)[1]);
175  return 1;
176  }
177  return 0;
178 
179  case TIFFTAG_WHITEPOINT:
180  if (value_count == 2 && fip->field_type == TIFF_RATIONAL) {
181  fprintf(fd, " White Point: %g-%g\n",
182  ((float *)raw_data)[0], ((float *)raw_data)[1]);
183  return 1;
184  }
185  return 0;
186 
187  case TIFFTAG_XMLPACKET:
188  {
189  uint32 i;
190 
191  fprintf(fd, " XMLPacket (XMP Metadata):\n" );
192  for(i = 0; i < value_count; i++)
193  fputc(((char *)raw_data)[i], fd);
194  fprintf( fd, "\n" );
195  return 1;
196  }
198  /*
199  * XXX: for some weird reason RichTIFFIPTC tag
200  * defined as array of LONG values.
201  */
202  fprintf(fd,
203  " RichTIFFIPTC Data: <present>, %lu bytes\n",
204  (unsigned long) value_count * 4);
205  return 1;
206 
207  case TIFFTAG_PHOTOSHOP:
208  fprintf(fd, " Photoshop Data: <present>, %lu bytes\n",
209  (unsigned long) value_count);
210  return 1;
211 
212  case TIFFTAG_ICCPROFILE:
213  fprintf(fd, " ICC Profile: <present>, %lu bytes\n",
214  (unsigned long) value_count);
215  return 1;
216 
217  case TIFFTAG_STONITS:
218  if (value_count == 1 && fip->field_type == TIFF_DOUBLE) {
219  fprintf(fd,
220  " Sample to Nits conversion factor: %.4e\n",
221  *((double*)raw_data));
222  return 1;
223  }
224  return 0;
225  }
226 
227  return 0;
228 }
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define TIFFTAG_ICCPROFILE
Definition: tiff.h:440
unsigned int uint32
Definition: types.h:32
Definition: ecma_167.h:138
#define TIFFTAG_DOTRANGE
Definition: tiff.h:302
static int fd
Definition: io.c:51
#define INKSET_CMYK
Definition: tiff.h:298
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
char * field_name
Definition: tif_dir.h:289
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define TIFFTAG_XMLPACKET
Definition: tiff.h:373
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define TIFFTAG_WHITEPOINT
Definition: tiff.h:282
#define TIFFTAG_INKSET
Definition: tiff.h:297
#define TIFFTAG_STONITS
Definition: tiff.h:451
TIFFDataType field_type
Definition: tif_dir.h:282
unsigned short uint16
Definition: types.h:30
#define TIFFTAG_RICHTIFFIPTC
Definition: tiff.h:413
#define TIFFTAG_PHOTOSHOP
Definition: tiff.h:436

Referenced by TIFFPrintDirectory().

◆ _TIFFprintAscii()

void _TIFFprintAscii ( FILE fd,
const char cp 
)

Definition at line 681 of file tif_print.c.

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

Referenced by _TIFFprintAsciiTag().

◆ _TIFFprintAsciiBounded()

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

Definition at line 687 of file tif_print.c.

688 {
689  for (; max_chars > 0 && *cp != '\0'; cp++, max_chars--) {
690  const char* tp;
691 
692  if (isprint((int)*cp)) {
693  fputc(*cp, fd);
694  continue;
695  }
696  for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
697  if (*tp++ == *cp)
698  break;
699  if (*tp)
700  fprintf(fd, "\\%c", *tp);
701  else
702  fprintf(fd, "\\%03o", *cp & 0xff);
703  }
704 }
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
static int fd
Definition: io.c:51
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2855
#define isprint(c)
Definition: acclib.h:73
POINT cp
Definition: magnifier.c:59

Referenced by _TIFFprintAscii(), and TIFFPrintDirectory().

◆ _TIFFprintAsciiTag()

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

Definition at line 707 of file tif_print.c.

708 {
709  fprintf(fd, " %s: \"", name);
711  fprintf(fd, "\"\n");
712 }
void _TIFFprintAscii(FILE *fd, const char *cp)
Definition: tif_print.c:681
static int fd
Definition: io.c:51
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:36

◆ _TIFFPrintField()

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

Definition at line 68 of file tif_print.c.

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

Referenced by TIFFPrintDirectory().

◆ TIFFPrintDirectory()

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

Definition at line 235 of file tif_print.c.

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

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 54 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 39 of file tif_print.c.

Referenced by TIFFPrintDirectory().