summaryrefslogtreecommitdiff
path: root/doc/functions/TIFFtypes.rst
blob: 1b97fa9f56029ec80d1a5dcd3643c0547fab6a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.. _public-data-types:

TIFFtypes
=========

Synopsis
--------

.. highlight:: c

::

    #include <tiffio.h>


Description
-----------

LibTIFF uses several custom datatypes in its programming interfaces,
which are detailed here.  These types are use to promote portability.
Two sets of typedefs are used, one for communication with clients
of the library, and one for internal data structures and parsing of the
TIFF format.  The following typedefs are exposed to users either through
function definitions or through parameters passed through the varargs
interfaces.

Structures
----------

.. c:struct:: TIFF

    An opaque data type representing an open TIFF file.

Integer types
-------------

.. doxygentypedef:: ttag_t

.. doxygentypedef:: tdir_t

.. doxygentypedef:: tsample_t

.. doxygentypedef:: tstrip_t

.. doxygentypedef:: ttile_t

.. doxygentypedef:: tmsize_t

.. doxygendefine:: TIFF_TMSIZE_T_MAX

.. doxygentypedef:: tmsize_t

.. doxygentypedef:: tsize_t

.. doxygentypedef:: tdata_t

.. doxygentypedef:: thandle_t

.. doxygentypedef:: toff_t

Note that :c:type:`tstrip_t`, :c:type:`ttile_t`, and :c:type:`tsize_t`
are constrained to be no more than 32-bit quantities by 32-bit fields
they are stored in in the TIFF image.  Likewise :c:type:`tsample_t` is
limited by the 16-bit field used to store the ``SamplesPerPixel`` tag.
:c:type:`tdir_t` constrains the maximum number of IFDs that may appear
in an image and may be an arbitrary size (w/o penalty).  :c:type:`ttag_t`
must be either :c:expr:`int`, :c:expr:`unsigned int`, pointer, or
:c:expr:`double`, because the library uses a varargs interface and
C restricts the type of the parameter before an ellipsis to be a
promoted type.  :c:type:`toff_t`  is defined as :c:type:`uint64_t`
because TIFF file offsets are (unsigned) 32-bit quantities, and BigTIFF
file offsets are unsigned 64-bit quantities.  A signed value is used
because some interfaces return -1 on error. Finally, note that
user-specified data references are passed as opaque handles and only
cast at the lowest layers where their type is presumed.

.. TODO: Check why this toff_t was switched to unsigned and update description.


I/O types
---------

.. doxygentypedef:: TIFFReadWriteProc

.. doxygentypedef:: TIFFSeekProc

.. doxygentypedef:: TIFFCloseProc

.. doxygentypedef:: TIFFSizeProc

.. doxygentypedef:: TIFFMapFileProc

.. doxygentypedef:: TIFFUnmapFileProc

See also
--------

:doc:`libtiff` (3tiff)