TIFFReadRGBATile.3tiff 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. .\" $Id: TIFFReadRGBATile.3tiff,v 1.2 2005-11-02 11:07:18 dron Exp $
  2. .\"
  3. .\" Copyright (c) 1991-1997 Sam Leffler
  4. .\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
  5. .\"
  6. .\" Permission to use, copy, modify, distribute, and sell this software and
  7. .\" its documentation for any purpose is hereby granted without fee, provided
  8. .\" that (i) the above copyright notices and this permission notice appear in
  9. .\" all copies of the software and related documentation, and (ii) the names of
  10. .\" Sam Leffler and Silicon Graphics may not be used in any advertising or
  11. .\" publicity relating to the software without the specific, prior written
  12. .\" permission of Sam Leffler and Silicon Graphics.
  13. .\"
  14. .\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  15. .\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  16. .\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  17. .\"
  18. .\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19. .\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20. .\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. .\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
  22. .\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  23. .\" OF THIS SOFTWARE.
  24. .\"
  25. .if n .po 0
  26. .TH TIFFReadRGBATile 3TIFF "December 10, 1998" "libtiff"
  27. .SH NAME
  28. TIFFReadRGBATile \- read and decode an image tile into a fixed-format raster
  29. .SH SYNOPSIS
  30. .B "#include <tiffio.h>"
  31. .sp
  32. .B "#define TIFFGetR(abgr) ((abgr) & 0xff)"
  33. .br
  34. .B "#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)"
  35. .br
  36. .B "#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)"
  37. .br
  38. .B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
  39. .sp
  40. .BI "int TIFFReadRGBATile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 *" raster ")"
  41. .SH DESCRIPTION
  42. .IR TIFFReadRGBATile
  43. reads a single tile of a tile-based image into memory, storing the result in
  44. the user supplied RGBA
  45. .IR raster .
  46. The raster is assumed to be an array of width times length 32-bit entries,
  47. where width is the width of a tile (TIFFTAG_TILEWIDTH) and length is the
  48. height of a tile (TIFFTAG_TILELENGTH).
  49. .PP
  50. The
  51. .IR x
  52. and
  53. .IR y
  54. values are the offsets from the top left corner to the top left corner of the
  55. tile to be read. They must be an exact multiple of the tile width and length.
  56. .PP
  57. Note that the raster is assume to be organized such that the pixel at location
  58. (\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP]; with the
  59. raster origin in the
  60. .I lower-left hand corner
  61. of the tile. That is bottom to top organization. Edge tiles which partly fall
  62. off the image will be filled out with appropriate zeroed areas.
  63. .PP
  64. Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros
  65. .IR TIFFGetR ,
  66. .IR TIFFGetG ,
  67. .IR TIFFGetB ,
  68. and
  69. .I TIFFGetA
  70. should be used to access individual samples. Images without Associated Alpha
  71. matting information have a constant Alpha of 1.0 (255).
  72. .PP
  73. See the
  74. .IR TIFFRGBAImage (3TIFF)
  75. page for more details on how various image types are converted to RGBA values.
  76. .SH NOTES
  77. Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must
  78. be either 1, 3, or 4 (i.e.
  79. .I SamplesPerPixel
  80. minus
  81. .IR ExtraSamples ).
  82. .PP
  83. Palette image colormaps that appear to be incorrectly written as 8-bit values
  84. are automatically scaled to 16-bits.
  85. .PP
  86. .I TIFFReadRGBATile
  87. is just a wrapper around the more general
  88. .IR TIFFRGBAImage (3TIFF)
  89. facilities. It's main advantage over the similar
  90. .IR TIFFReadRGBAImage()
  91. function is that for large images a single buffer capable of holding the whole
  92. image doesn't need to be allocated, only enough for one tile. The
  93. .IR TIFFReadRGBAStrip()
  94. function does a similar operation for stripped images.
  95. .SH "RETURN VALUES"
  96. 1 is returned if the image was successfully read and converted.
  97. Otherwise, 0 is returned if an error was encountered.
  98. .SH DIAGNOSTICS
  99. All error messages are directed to the
  100. .IR TIFFError (3TIFF)
  101. routine.
  102. .PP
  103. .BR "Sorry, can not handle %d-bit pictures" .
  104. The image had
  105. .I BitsPerSample
  106. other than 1, 2, 4, 8, or 16.
  107. .PP
  108. .BR "Sorry, can not handle %d-channel images" .
  109. The image had
  110. .I SamplesPerPixel
  111. other than 1, 3, or 4.
  112. .PP
  113. \fBMissing needed "PhotometricInterpretation" tag\fP.
  114. The image did not have a tag that describes how to display the data.
  115. .PP
  116. \fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
  117. The image was missing a tag that describes how to display it, but because it
  118. has 3 or 4 samples/pixel, it is assumed to be
  119. .SM RGB.
  120. .PP
  121. \fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
  122. The image was missing a tag that describes how to display it,
  123. but because it has 1 sample/pixel, it is assumed to be a grayscale
  124. or bilevel image.
  125. .PP
  126. .BR "No space for photometric conversion table" .
  127. There was insufficient memory for a table used to convert
  128. image samples to 8-bit
  129. .SM RGB.
  130. .PP
  131. \fBMissing required "Colormap" tag\fP.
  132. A Palette image did not have a required
  133. .I Colormap
  134. tag.
  135. .PP
  136. .BR "No space for tile buffer" .
  137. There was insufficient memory to allocate an i/o buffer.
  138. .PP
  139. .BR "No space for strip buffer" .
  140. There was insufficient memory to allocate an i/o buffer.
  141. .PP
  142. .BR "Can not handle format" .
  143. The image has a format (combination of
  144. .IR BitsPerSample ,
  145. .IR SamplesPerPixel ,
  146. and
  147. .IR PhotometricInterpretation )
  148. that
  149. .I TIFFReadRGBAImage
  150. can not handle.
  151. .PP
  152. .BR "No space for B&W mapping table" .
  153. There was insufficient memory to allocate a table used to map
  154. grayscale data to
  155. .SM RGB.
  156. .PP
  157. .BR "No space for Palette mapping table" .
  158. There was insufficient memory to allocate a table used to map data to 8-bit
  159. .SM RGB.
  160. .SH "SEE ALSO"
  161. .BR TIFFOpen (3TIFF),
  162. .BR TIFFRGBAImage (3TIFF),
  163. .BR TIFFReadRGBAImage (3TIFF),
  164. .BR TIFFReadRGBAStrip (3TIFF),
  165. .BR libtiff (3TIFF)
  166. .PP
  167. Libtiff library home page:
  168. .BR http://www.remotesensing.org/libtiff/