TIFFWriteScanline.3tiff 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 TIFFWriteScanline 3TIFF "December 16, 1991" "libtiff"
  26. .SH NAME
  27. TIFFWriteScanline \- write a scanline to an open
  28. .SM TIFF
  29. file
  30. .SH SYNOPSIS
  31. .B "#include <tiffio.h>"
  32. .sp
  33. .BI "int TIFFWriteScanline(TIFF *" tif ", tdata_t " buf ", uint32_t " row ", tsample_t " sample ")"
  34. .SH DESCRIPTION
  35. Write data to a file at the specified row. The
  36. .I sample
  37. parameter is used only if data are organized in separate planes (\c
  38. .IR PlanarConfiguration =2).
  39. The data are assumed to be uncompressed and in the native bit- and byte-order
  40. of the host machine. The data written to the file is compressed according to
  41. the compression scheme of the current
  42. .SM TIFF
  43. directory (see further below). If the current scanline is past the end of the
  44. current subfile, the
  45. .I ImageLength
  46. field is automatically increased to include the scanline (except
  47. for
  48. .IR PlanarConfiguration =2,
  49. where the
  50. .I ImageLength
  51. cannot be changed once the first data are written). If the
  52. .I ImageLength
  53. is increased, the
  54. .I StripOffsets
  55. and
  56. .I StripByteCounts
  57. fields are similarly enlarged to reflect data written past the previous end of
  58. image.
  59. .SH NOTES
  60. The library writes encoded data using the native machine byte order. Correctly
  61. implemented
  62. .SM TIFF
  63. readers are expected to do any necessary byte-swapping to correctly process
  64. image data with BitsPerSample greater than 8. The library attempts to hide
  65. bit-ordering differences between the image and the native machine by
  66. converting data from the native machine order.
  67. .PP
  68. In C++ the
  69. .I sample
  70. parameter defaults to 0.
  71. .PP
  72. Once data are written to a file for the current directory, the values of
  73. certain tags may not be altered; see
  74. .IR TIFFSetField (3TIFF)
  75. for more information.
  76. .PP
  77. It is not possible to write scanlines to a file that uses a tiled
  78. organization. The routine
  79. .IR TIFFIsTiled
  80. can be used to determine if the file is organized as tiles or strips.
  81. .SH "RETURN VALUES"
  82. .IR TIFFWriteScanline
  83. returns \-1 if it immediately detects an error and 1 for a successful write.
  84. .SH DIAGNOSTICS
  85. All error messages are directed to the
  86. .IR TIFFError (3TIFF)
  87. routine.
  88. .PP
  89. .BR "%s: File not open for writing .
  90. The file was opened for reading, not writing.
  91. .PP
  92. .BR "Can not write scanlines to a tiled image" .
  93. An attempt was made to write a scanline to a tiled image. The image is assumed
  94. to be organized in tiles because the
  95. .I TileWidth
  96. and
  97. .I TileLength
  98. tags have been set with
  99. .IR TIFFSetField (3TIFF).
  100. .PP
  101. .BR "Compression algorithm does not support random access" .
  102. Data was written in a non-sequential order to a file that uses a compression
  103. algorithm and that has
  104. .I RowsPerStrip
  105. greater than one. That is, data in the image is to be stored in a compressed
  106. form, and with multiple rows packed into a strip. In this case, the library
  107. does not support random access to the data. The data should either be written
  108. as entire strips, sequentially by rows, or the value of
  109. .I RowsPerStrip
  110. should be set to one.
  111. .PP
  112. \fB%s: Must set "ImageWidth" before writing data\fP.
  113. The image's width has not be set before the first write.
  114. See
  115. .BR TIFFSetField (3TIFF)
  116. for information on how to do this.
  117. .PP
  118. \fB%s: Must set "PlanarConfiguration" before writing data\fP.
  119. The organization of data has not be defined before the first write.
  120. See
  121. .BR TIFFSetField (3TIFF)
  122. for information on how to do this.
  123. .PP
  124. \fBCan not change "ImageLength" when using separate planes\fP. Separate image
  125. planes are being used (\c
  126. .IR PlanarConfiguration =2),
  127. but the number of rows has not been specified before the first write. The
  128. library supports the dynamic growth of an image only when data are organized
  129. in a contiguous manner (\c
  130. .IR PlanarConfiguration =1).
  131. .PP
  132. .BR "%d: Sample out of range, max %d" .
  133. The
  134. .I sample
  135. parameter was greater than the value of the SamplesPerPixel tag.
  136. .PP
  137. .BR "%s: No space for strip arrays .
  138. There was not enough space for the arrays that hold strip offsets and byte
  139. counts.
  140. .SH BUGS
  141. Writing subsampled YCbCR data does not work correctly because, for
  142. .IR PlanarConfiguration =2
  143. the size of a scanline is not calculated on a per-sample basis, and for
  144. .IR PlanarConfiguration =1
  145. the library does not pack the block-interleaved samples.
  146. .SH "SEE ALSO"
  147. .BR TIFFOpen (3TIFF),
  148. .BR TIFFWriteEncodedStrip (3TIFF),
  149. .BR TIFFWriteRawStrip (3TIFF),
  150. .BR libtiff (3TIFF)
  151. .PP
  152. Libtiff library home page:
  153. .BR http://www.simplesystems.org/libtiff/