TIFFWriteDirectory.3tiff 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. .\"
  2. .\" Copyright (c) 1988-1997 Sam Leffler
  3. .\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
  4. .\"
  5. .\" Permission to use, copy, modify, distribute, and sell this software and
  6. .\" its documentation for any purpose is hereby granted without fee, provided
  7. .\" that (i) the above copyright notices and this permission notice appear in
  8. .\" all copies of the software and related documentation, and (ii) the names of
  9. .\" Sam Leffler and Silicon Graphics may not be used in any advertising or
  10. .\" publicity relating to the software without the specific, prior written
  11. .\" permission of Sam Leffler and Silicon Graphics.
  12. .\"
  13. .\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  14. .\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  15. .\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  16. .\"
  17. .\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  18. .\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  19. .\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20. .\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
  21. .\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  22. .\" OF THIS SOFTWARE.
  23. .\"
  24. .if n .po 0
  25. .TH TIFFWriteDirectory 3TIFF "September 26, 2001" "libtiff"
  26. .SH NAME
  27. TIFFWriteDirectory, TIFFRewriteDirectory, TIFFCheckpointDirectory \- write the
  28. current directory in an open
  29. .SM TIFF
  30. file
  31. .SH SYNOPSIS
  32. .B "#include <tiffio.h>"
  33. .sp
  34. .BI "int TIFFWriteDirectory(TIFF *" tif ")"
  35. .br
  36. .BI "int TIFFRewriteDirectory(TIFF *" tif ")"
  37. .br
  38. .BI "int TIFFCheckpointDirectory(TIFF *" tif ")"
  39. .SH DESCRIPTION
  40. .IR TIFFWriteDirectory
  41. will write the contents of the current directory to the file and setup to
  42. create a new subfile in the same file. Applications only need to call
  43. .IR TIFFWriteDirectory
  44. when writing multiple subfiles to a single
  45. .SM TIFF
  46. file.
  47. .IR TIFFWriteDirectory
  48. is automatically called by
  49. .IR TIFFClose
  50. and
  51. .IR TIFFFlush
  52. to write a modified directory if the file is open for writing.
  53. .PP
  54. The
  55. .IR TIFFRewriteDirectory
  56. function operates similarly to
  57. .IR TIFFWriteDirectory,
  58. but can be called with directories previously read or written that already
  59. have an established location in the file. It will rewrite the directory,
  60. but instead of place it at it's old location (as
  61. .IR TIFFWriteDirectory
  62. would) it will place them at the end of the file, correcting the pointer from
  63. the preceding directory or file header to point to it's new location. This
  64. is particularly important in cases where the size of the directory and
  65. pointed to data has grown, so it won't fit in the space available at the
  66. old location.
  67. .PP
  68. The
  69. .IR TIFFCheckpointDirectory
  70. writes the current state of the tiff directory into the file to make what
  71. is currently in the file readable. Unlike
  72. .IR TIFFWriteDirectory,
  73. .IR TIFFCheckpointDirectory
  74. does not free up the directory data structures in memory, so they can be
  75. updated (as strips/tiles are written) and written again. Reading such
  76. a partial file you will at worst get a tiff read error for the first
  77. strip/tile encountered that is incomplete, but you will at least get
  78. all the valid data in the file before that. When the file is complete,
  79. just use
  80. .IR TIFFWriteDirectory
  81. as usual to finish it off cleanly.
  82. .SH "RETURN VALUES"
  83. 1 is returned when the contents are successfully written to the file.
  84. Otherwise, 0 is returned if an error was encountered when writing
  85. the directory contents.
  86. .SH DIAGNOSTICS
  87. All error messages are directed to the
  88. .IR TIFFError (3TIFF)
  89. routine.
  90. .PP
  91. .BR "Error post-encoding before directory write" .
  92. Before writing the contents of the current directory, any pending data are
  93. flushed. This message indicates that an error occurred while doing this.
  94. .PP
  95. .BR "Error flushing data before directory write" .
  96. Before writing the contents of the current directory, any pending data are
  97. flushed. This message indicates that an error occurred while doing this.
  98. .PP
  99. .BR "Cannot write directory, out of space" .
  100. There was not enough space to allocate a temporary area for the directory that
  101. was to be written.
  102. .PP
  103. .BR "Error writing directory count" .
  104. A write error occurred when writing the count of fields in the directory.
  105. .PP
  106. .BR "Error writing directory contents" .
  107. A write error occurred when writing the directory fields.
  108. .PP
  109. .BR "Error writing directory link" .
  110. A write error occurred when writing the link to the next directory.
  111. .PP
  112. \fBError writing data for field "%s"\fP.
  113. A write error occurred when writing indirect data for the specified field.
  114. .PP
  115. .BR "Error writing TIFF header" .
  116. A write error occurred when re-writing header at the front of the file.
  117. .PP
  118. .BR "Error fetching directory count" .
  119. A read error occurred when fetching the directory count field for
  120. a previous directory.
  121. This can occur when setting up a link to the directory that is being
  122. written.
  123. .PP
  124. .BR "Error fetching directory link" .
  125. A read error occurred when fetching the directory link field for
  126. a previous directory.
  127. This can occur when setting up a link to the directory that is being
  128. written.
  129. .SH "SEE ALSO"
  130. .BR TIFFOpen (3TIFF),
  131. .BR TIFFError (3TIFF),
  132. .BR TIFFReadDirectory (3TIFF),
  133. .BR TIFFSetDirectory (3TIFF),
  134. .BR libtiff (3TIFF)
  135. .PP
  136. Libtiff library home page:
  137. .BR http://www.simplesystems.org/libtiff/