| 1 |
TIFFCreateDirectory |
| 2 |
=================== |
| 3 |
|
| 4 |
Synopsis |
| 5 |
-------- |
| 6 |
|
| 7 |
.. highlight:: c |
| 8 |
|
| 9 |
:: |
| 10 |
|
| 11 |
#include <tiffio.h> |
| 12 |
|
| 13 |
.. c:function:: int TIFFCreateDirectory(TIFF* tif) |
| 14 |
|
| 15 |
.. c:function:: int TIFFFreeDirectory(TIFF* tif) |
| 16 |
|
| 17 |
.. c:function:: int TIFFUnlinkDirectory(TIFF* tif, tdir_t dirn) |
| 18 |
|
| 19 |
Description |
| 20 |
----------- |
| 21 |
|
| 22 |
The following routines create or release a directory. |
| 23 |
|
| 24 |
:c:func:`TIFFCreateDirectory` setup for a directory in a open TIFF file. |
| 25 |
The newly created directory will not exist on the file till |
| 26 |
:c:func:`TIFFWriteDirectory`, :c:func:`TIFFCheckpointDirectory`, |
| 27 |
:c:func:`TIFFFlush` or :c:func:`TIFFClose` is called. |
| 28 |
:c:func:`TIFFWriteDirectory` also creates a new directory, |
| 29 |
frees the ``*tif`` structure and sets up a new one. |
| 30 |
|
| 31 |
:c:func:`TIFFFreeDirectory` releases allocated storage associated with a |
| 32 |
directory, especially custom-fields. |
| 33 |
However, the main part of the directory is not touched. Routine |
| 34 |
:c:func:`TIFFCleanup` calls :c:func:`TIFFFreeDirectory` to release |
| 35 |
the directory part of the `tif` structure. |
| 36 |
|
| 37 |
:c:func:`TIFFUnlinkDirectory` unlink the specified directory from the |
| 38 |
directory chain. |
| 39 |
The parameter *dirn* specifies the subfile/directory |
| 40 |
as an integer number, with the first directory numbered one (1). |
| 41 |
This is different to :c:func:`TIFFSetDirectory` or :c:func:`TIFFCurrentDirectory` where the first |
| 42 |
directory starts with zero (0). |
| 43 |
|
| 44 |
Directory query functions :c:func:`TIFFCurrentDirectory`, |
| 45 |
:c:func:`TIFFCurrentDirOffset`, :c:func:`TIFFLastDirectory` and |
| 46 |
:c:func:`TIFFNumberOfDirectories` retrieve information about directories |
| 47 |
in an open TIFF file. Be aware that until a directory is |
| 48 |
not written to file AND read back, the query functions won't retrieve |
| 49 |
the correct information! |
| 50 |
|
| 51 |
Notes |
| 52 |
----- |
| 53 |
|
| 54 |
Be aware: |
| 55 |
|
| 56 |
- that until a directory is not written to file AND read back, the |
| 57 |
query functions won't retrieve the correct information! |
| 58 |
- that the newly created directory will not exist on the file till |
| 59 |
:c:func:`TIFFWriteDirectory`, :c:func:`TIFFCheckpointDirectory`, |
| 60 |
:c:func:`TIFFFlush` or :c:func:`TIFFClose` has been called. |
| 61 |
- that :c:func:`TIFFCreateDirectory` and :c:func:`TIFFWriteDirectory` |
| 62 |
create a new directory, free the ``*tif`` structure and set up a new one. |
| 63 |
- that unlike :c:func:`TIFFWriteDirectory`, :c:func:`TIFFCheckpointDirectory` |
| 64 |
does not free up the directory data structures in memory. |
| 65 |
|
| 66 |
After ``libtiff`` version 4.6.0 :c:func:`TIFFCreateDirectory` also releases |
| 67 |
the directory part of the `tif` structure by calling :c:func:`TIFFFreeDirectory`, |
| 68 |
which should have been called by the user application before creating a new directory. |
| 69 |
|
| 70 |
Diagnostics |
| 71 |
----------- |
| 72 |
|
| 73 |
All error messages are directed to the :c:func:`TIFFErrorExtR` routine. |
| 74 |
Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine. |
| 75 |
|
| 76 |
See also |
| 77 |
-------- |
| 78 |
|
| 79 |
:doc:`libtiff` (3tiff), |
| 80 |
:doc:`TIFFCustomDirectory` (3tiff), |
| 81 |
:doc:`TIFFquery` (3tiff), |
| 82 |
:doc:`TIFFSetDirectory` (3tiff), |
| 83 |
:doc:`TIFFWriteDirectory` (3tiff) |