TIFFReadRGBATile.3tiff 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. .\"
  2. .\" Copyright (c) 1991-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 TIFFReadRGBATile 3TIFF "December 10, 1998" "libtiff"
  26. .SH NAME
  27. TIFFReadRGBATile \- read and decode an image tile into a fixed-format raster
  28. .SH SYNOPSIS
  29. .B "#include <tiffio.h>"
  30. .sp
  31. .B "#define TIFFGetR(abgr) ((abgr) & 0xff)"
  32. .br
  33. .B "#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)"
  34. .br
  35. .B "#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)"
  36. .br
  37. .B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
  38. .sp
  39. .BI "int TIFFReadRGBATile(TIFF *" tif ", uint32_t " x ", uint32_t " y ", uint32_t *" raster ")"
  40. .SH DESCRIPTION
  41. .IR TIFFReadRGBATile
  42. reads a single tile of a tile-based image into memory, storing the result in
  43. the user supplied RGBA
  44. .IR raster .
  45. The raster is assumed to be an array of width times length 32-bit entries,
  46. where width is the width of a tile (TIFFTAG_TILEWIDTH) and length is the
  47. height of a tile (TIFFTAG_TILELENGTH).
  48. .PP
  49. The
  50. .IR x
  51. and
  52. .IR y
  53. values are the offsets from the top left corner to the top left corner of the
  54. tile to be read. They must be an exact multiple of the tile width and length.
  55. .PP
  56. Note that the raster is assume to be organized such that the pixel at location
  57. (\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP]; with the
  58. raster origin in the
  59. .I lower-left hand corner
  60. of the tile. That is bottom to top organization. Edge tiles which partly fall
  61. off the image will be filled out with appropriate zeroed areas.
  62. .PP
  63. Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros
  64. .IR TIFFGetR ,
  65. .IR TIFFGetG ,
  66. .IR TIFFGetB ,
  67. and
  68. .I TIFFGetA
  69. should be used to access individual samples. Images without Associated Alpha
  70. matting information have a constant Alpha of 1.0 (255).
  71. .PP
  72. See the
  73. .IR TIFFRGBAImage (3TIFF)
  74. page for more details on how various image types are converted to RGBA values.
  75. .SH NOTES
  76. Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must
  77. be either 1, 3, or 4 (i.e.
  78. .I SamplesPerPixel
  79. minus
  80. .IR ExtraSamples ).
  81. .PP
  82. Palette image colormaps that appear to be incorrectly written as 8-bit values
  83. are automatically scaled to 16-bits.
  84. .PP
  85. .I TIFFReadRGBATile
  86. is just a wrapper around the more general
  87. .IR TIFFRGBAImage (3TIFF)
  88. facilities. It's main advantage over the similar
  89. .IR TIFFReadRGBAImage()
  90. function is that for large images a single buffer capable of holding the whole
  91. image doesn't need to be allocated, only enough for one tile. The
  92. .IR TIFFReadRGBAStrip()
  93. function does a similar operation for stripped images.
  94. .SH "RETURN VALUES"
  95. 1 is returned if the image was successfully read and converted.
  96. Otherwise, 0 is returned if an error was encountered.
  97. .SH DIAGNOSTICS
  98. All error messages are directed to the
  99. .IR TIFFError (3TIFF)
  100. routine.
  101. .PP
  102. .BR "Sorry, can not handle %d-bit pictures" .
  103. The image had
  104. .I BitsPerSample
  105. other than 1, 2, 4, 8, or 16.
  106. .PP
  107. .BR "Sorry, can not handle %d-channel images" .
  108. The image had
  109. .I SamplesPerPixel
  110. other than 1, 3, or 4.
  111. .PP
  112. \fBMissing needed "PhotometricInterpretation" tag\fP.
  113. The image did not have a tag that describes how to display the data.
  114. .PP
  115. \fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
  116. The image was missing a tag that describes how to display it, but because it
  117. has 3 or 4 samples/pixel, it is assumed to be
  118. .SM RGB.
  119. .PP
  120. \fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
  121. The image was missing a tag that describes how to display it,
  122. but because it has 1 sample/pixel, it is assumed to be a grayscale
  123. or bilevel image.
  124. .PP
  125. .BR "No space for photometric conversion table" .
  126. There was insufficient memory for a table used to convert
  127. image samples to 8-bit
  128. .SM RGB.
  129. .PP
  130. \fBMissing required "Colormap" tag\fP.
  131. A Palette image did not have a required
  132. .I Colormap
  133. tag.
  134. .PP
  135. .BR "No space for tile buffer" .
  136. There was insufficient memory to allocate an i/o buffer.
  137. .PP
  138. .BR "No space for strip buffer" .
  139. There was insufficient memory to allocate an i/o buffer.
  140. .PP
  141. .BR "Can not handle format" .
  142. The image has a format (combination of
  143. .IR BitsPerSample ,
  144. .IR SamplesPerPixel ,
  145. and
  146. .IR PhotometricInterpretation )
  147. that
  148. .I TIFFReadRGBAImage
  149. can not handle.
  150. .PP
  151. .BR "No space for B&W mapping table" .
  152. There was insufficient memory to allocate a table used to map
  153. grayscale data to
  154. .SM RGB.
  155. .PP
  156. .BR "No space for Palette mapping table" .
  157. There was insufficient memory to allocate a table used to map data to 8-bit
  158. .SM RGB.
  159. .SH "SEE ALSO"
  160. .BR TIFFOpen (3TIFF),
  161. .BR TIFFRGBAImage (3TIFF),
  162. .BR TIFFReadRGBAImage (3TIFF),
  163. .BR TIFFReadRGBAStrip (3TIFF),
  164. .BR libtiff (3TIFF)
  165. .PP
  166. Libtiff library home page:
  167. .BR http://www.simplesystems.org/libtiff/