|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Format custom fields, labels, and private escaped text. More...
Data Structures | |
| struct | tagname |
| Associate an anonymous on-disk tag with a friendly print label. More... | |
Macros | |
| #define | NPHOTONAMES (sizeof(photoNames) / sizeof(photoNames[0])) |
| Count the entries in photoNames, including the reserved placeholder. | |
| #define | NORIENTNAMES (sizeof(orientNames) / sizeof(orientNames[0])) |
| Count orientation display entries, including the zero placeholder. | |
| #define | NTAGS (sizeof(tagnames) / sizeof(tagnames[0])) |
| Count the anonymous-tag friendly-name overrides. | |
Functions | |
| static void | _TIFFPrintField (FILE *fd, const TIFFField *fip, uint32_t value_count, void *raw_data) |
| Print a custom field using its generic numeric or string representation. | |
| static int | _TIFFPrettyPrintField (TIFF *tif, const TIFFField *fip, FILE *fd, uint32_t tag, uint32_t value_count, void *raw_data) |
| Try specialised formatting for selected named custom tags. | |
| static void | _TIFFprintAsciiBounded (FILE *fd, const char *cp, size_t max_chars) |
| Print at most a byte bound using the private ASCII escape convention. | |
| void | _TIFFprintAscii (FILE *fd, const char *cp) |
| Print a terminated string using the private ASCII escape convention. | |
| void | _TIFFprintAsciiTag (FILE *fd, const char *name, const char *value) |
| Print a labelled quoted value using the private ASCII formatter. | |
Variables | |
| static const char *const | photoNames [] |
| Map common photometric identifiers to display names. | |
| static const char *const | orientNames [] |
| Map orientation identifiers to display descriptions. | |
| static const struct tagname | tagnames [] |
| Supply display labels for anonymous GDAL metadata and nodata tags. | |
Format custom fields, labels, and private escaped text.
| #define NORIENTNAMES (sizeof(orientNames) / sizeof(orientNames[0])) |
Count orientation display entries, including the zero placeholder.
Orientation values at or above this count are printed numerically.
Definition at line 95 of file tif_print.c.
| #define NPHOTONAMES (sizeof(photoNames) / sizeof(photoNames[0])) |
Count the entries in photoNames, including the reserved placeholder.
Photometric values at or above this count are printed numerically.
Definition at line 69 of file tif_print.c.
Count the anonymous-tag friendly-name overrides.
Number of entries in tagnames[] searched by the generic field printer.
Definition at line 131 of file tif_print.c.
|
static |
Try specialised formatting for selected named custom tags.
Anonymous fields return zero without output. Handles DotRange, WhitePoint, XMP, IPTC, Photoshop, ICCProfile, StoNits, and a special InkSet shape. Shape/type checks differ by tag; WhitePoint explicitly assumes two float elements even if a private descriptor would use double rationals. InkSet requires count two and SHORT but reads only the first element; usual count-one InkSet falls back to generic printing. XMP writes exactly value_count raw bytes with fputc(), including embedded NULs; binary summaries label the supplied element count as bytes without converting it. Does not allocate, change values, retain pointers, or use tif. Output is locale/stdio formatting, not escaped serialisation; stdio errors do not affect the handled result.
| [in] | tif | Unused compatibility context; no handle access, may be NULL. |
| [in] | fip | Non-NULL borrowed live field descriptor with representation matching raw_data. |
| [in,out] | fd | Non-NULL writable caller-owned stdio stream; not closed or flushed by this helper. |
| [in] | tag | Tag identifier to select specialised formatting; normally matches fip. |
| [in] | value_count | Readable element count; specialised predicates determine required shape. |
| [in] | raw_data | Borrowed matching data, including two floats for WhitePoint; must be readable on any selected output path. |
Definition at line 268 of file tif_print.c.
References _TIFFField::field_type, INKSET_CMYK, tagname::tag, TIFF_DOUBLE, TIFF_RATIONAL, TIFF_SHORT, TIFFFieldIsAnonymous(), TIFFTAG_DOTRANGE, TIFFTAG_ICCPROFILE, TIFFTAG_INKSET, TIFFTAG_PHOTOSHOP, TIFFTAG_RICHTIFFIPTC, TIFFTAG_STONITS, TIFFTAG_WHITEPOINT, and TIFFTAG_XMLPACKET.
Referenced by TIFFPrintDirectory().
|
extern |
Print a terminated string using the private ASCII escape convention.
Writes at the stream's current position without flushing, closing, allocating, or taking ownership. Printable bytes depend on the current C locale; quotes and backslashes are written unchanged. Nonprintable tab, backspace, carriage return, newline, and vertical tab use named backslash escapes; other bytes use three octal digits. The implementation passes plain char to isprint(), so portable input is seven-bit ASCII; high-bit bytes on signed-char hosts are outside the classifier's valid domain except EOF. Does not check/report stdio failures and returns no status. Computes strlen() before formatting, so input must terminate in readable storage. Adds no quotes or newline.
| [in,out] | fd | Non-NULL writable caller-owned stdio stream; not closed or flushed by this helper. |
| [in] | cp | Non-NULL borrowed terminated string satisfying the classifier domain; no alias with stream storage. |
Definition at line 856 of file tif_print.c.
References _TIFFprintAsciiBounded().
Referenced by _TIFFprintAsciiTag().
|
static |
Print at most a byte bound using the private ASCII escape convention.
Writes at the stream's current position without flushing, closing, allocating, or taking ownership. Printable bytes depend on the current C locale; quotes and backslashes are written unchanged. Nonprintable tab, backspace, carriage return, newline, and vertical tab use named backslash escapes; other bytes use three octal digits. The implementation passes plain char to isprint(), so portable input is seven-bit ASCII; high-bit bytes on signed-char hosts are outside the classifier's valid domain except EOF. Does not check/report stdio failures and returns no status. Stops at the first NUL or max_chars, whichever comes first, without a strlen() pre-scan. The bound limits source bytes, not output bytes; one source byte can expand to four. No quotes/newline are added.
| [in,out] | fd | Non-NULL writable caller-owned stdio stream; not closed or flushed by this helper. |
| [in] | cp | Borrowed readable source through the first NUL or max_chars bytes; may be NULL only when max_chars is zero. Seven-bit ASCII is portable. |
| [in] | max_chars | Maximum number of source bytes examined; zero emits nothing. |
Definition at line 885 of file tif_print.c.
Referenced by _TIFFprintAscii(), and TIFFPrintDirectory().
|
extern |
Print a labelled quoted value using the private ASCII formatter.
Writes at the stream's current position without flushing, closing, allocating, or taking ownership. Printable bytes depend on the current C locale; quotes and backslashes are written unchanged. Nonprintable tab, backspace, carriage return, newline, and vertical tab use named backslash escapes; other bytes use three octal digits. The implementation passes plain char to isprint(), so portable input is seven-bit ASCII; high-bit bytes on signed-char hosts are outside the classifier's valid domain except EOF. Does not check/report stdio failures and returns no status. Writes two leading spaces, the raw label, colon/space, quote-delimited escaped value, and a final newline. The label is not escaped; unchanged quotes/backslashes in the value prevent reliable round-trip parsing.
| [in,out] | fd | Non-NULL writable caller-owned stdio stream; not closed or flushed by this helper. |
| [in] | name | Non-NULL borrowed null-terminated label, printed raw. |
| [in] | value | Non-NULL borrowed terminated value satisfying _TIFFprintAscii() preconditions. |
Definition at line 906 of file tif_print.c.
References _TIFFprintAscii(), and tagname::name.
|
static |
Print a custom field using its generic numeric or string representation.
Prints a label, comma-separated values, and a newline; zero count prints only the label/newline. Anonymous GDAL tags use the local friendly-name overrides. Integers/IFDs follow field_type widths (IFDs hexadecimal); rationals use float or double storage according to TIFFFieldSetGetSize(). ASCII with nonzero count uses unbounded s, ignoring the count as a byte limit and adding no escapes. Requires matching readable storage and a terminating ASCII string. Other unsupported types print a placeholder. Does not allocate, mutate input, retain values, or invoke callbacks. Stream failures are ignored, with no status/diagnostic or flush. Private schema representations that disagree with the selected file-type width are not normalised here.
| [in,out] | fd | Non-NULL writable caller-owned stdio stream; not closed or flushed by this helper. |
| [in] | fip | Non-NULL borrowed live field descriptor with representation matching raw_data. |
| [in] | value_count | Number of readable internal elements; zero permits raw_data NULL. |
| [in] | raw_data | Borrowed matching element array; ASCII must terminate if count is nonzero. Numeric representation must match the selected formatting path. |
Definition at line 160 of file tif_print.c.
References _TIFFField::field_name, _TIFFField::field_tag, _TIFFField::field_type, tagname::name, NTAGS, tagname::tag, tagnames, TIFF_ASCII, TIFF_BYTE, TIFF_DOUBLE, TIFF_FLOAT, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFF_RATIONAL, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SRATIONAL, TIFF_SSHORT, TIFF_UNDEFINED, TIFFFieldIsAnonymous(), and TIFFFieldSetGetSize().
Referenced by TIFFPrintDirectory().
|
static |
Map orientation identifiers to display descriptions.
Static borrowed strings including a numeric zero placeholder; valid TIFF orientation values occupy indices one through eight.
Definition at line 78 of file tif_print.c.
Referenced by TIFFPrintDirectory().
|
static |
Map common photometric identifiers to display names.
Static borrowed strings indexed by photometric codes zero through ten, including a numeric reserved-code placeholder. Higher LogL/LogLuv values are handled explicitly by TIFFPrintDirectory().
Definition at line 50 of file tif_print.c.
Referenced by TIFFPrintDirectory().
|
static |
Supply display labels for anonymous GDAL metadata and nodata tags.
Only generic printing consults these static overrides, and only for anonymous descriptors; no registration or ownership change occurs.
Definition at line 120 of file tif_print.c.
Referenced by _TIFFPrintField().