summaryrefslogtreecommitdiff
path: root/doc/functions/TIFFCreateDirectory.rst
blob: 7c285c056a6b9ece12ca61b9e8360e70671c665d (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
TIFFCreateDirectory
===================

Synopsis
--------

.. highlight:: c

::

    #include <tiffio.h>

.. c:function:: int TIFFCreateDirectory(TIFF* tif)

.. c:function:: int TIFFFreeDirectory(TIFF* tif)

.. c:function:: int TIFFUnlinkDirectory(TIFF* tif, tdir_t dirn)

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

The following routines create or release a directory.

:c:func:`TIFFCreateDirectory` setup for a directory in a open TIFF file.
The newly created directory will not exist on the file till
:c:func:`TIFFWriteDirectory`, :c:func:`TIFFCheckpointDirectory`,
:c:func:`TIFFFlush` or :c:func:`TIFFClose` is called.
:c:func:`TIFFWriteDirectory` also creates a new directory,
frees the ``*tif`` structure and sets up a new one.

:c:func:`TIFFFreeDirectory` releases allocated storage associated with a
directory, especially custom-fields.
However, the main part of the directory is not touched. Routine
:c:func:`TIFFCleanup` calls :c:func:`TIFFFreeDirectory` to release
the directory part of the `tif` structure.

:c:func:`TIFFUnlinkDirectory` unlink the specified directory from the
directory chain.
The parameter *dirn* specifies the subfile/directory
as an integer number, with the first directory numbered one (1).
This is different to :c:func:`TIFFSetDirectory` or :c:func:`TIFFCurrentDirectory` where the first
directory starts with zero (0).

Directory query functions :c:func:`TIFFCurrentDirectory`,
:c:func:`TIFFCurrentDirOffset`, :c:func:`TIFFLastDirectory` and
:c:func:`TIFFNumberOfDirectories` retrieve information about directories
in an open TIFF file. Be aware that until a directory is
not written to file AND read back, the query functions won't retrieve
the correct information!

Notes
-----

Be aware:

- that until a directory is not written to file AND read back, the
  query functions won't retrieve the correct information!
- that the newly created directory will not exist on the file till
  :c:func:`TIFFWriteDirectory`, :c:func:`TIFFCheckpointDirectory`,
  :c:func:`TIFFFlush` or :c:func:`TIFFClose` has been called.
- that :c:func:`TIFFCreateDirectory` and :c:func:`TIFFWriteDirectory`
  create a new directory, free the ``*tif`` structure and set up a new one.
- that unlike :c:func:`TIFFWriteDirectory`, :c:func:`TIFFCheckpointDirectory`
  does not free up the directory data structures in memory.

Diagnostics
-----------

All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine.

See also
--------

:doc:`libtiff` (3tiff),
:doc:`TIFFCustomDirectory` (3tiff),
:doc:`TIFFquery` (3tiff),
:doc:`TIFFSetDirectory` (3tiff),
:doc:`TIFFWriteDirectory` (3tiff)