Debian Codegraph @

texk/xdvipsk/thirdparty/libtiff/doc/functions/TIFFReadRGBATile.rst

raw
1 TIFFReadRGBATile
2 ================
3
4 Synopsis
5 --------
6
7 .. highlight:: c
8
9 ::
10
11 #include <tiffio.h>
12
13 .. c:function:: int TIFFReadRGBATile(TIFF* tif, uint32_t x, uint32_t y, uint32_t* raster)
14
15 .. c:function:: int TIFFReadRGBATileExt(TIFF* tif, uint32_t col, uint32_t row, uint32_t * raster, int stop_on_error)
16
17 Description
18 -----------
19
20 :c:func:`TIFFReadRGBATile` reads a single tile of a tile-based image into
21 memory, storing the result in the user supplied RGBA *raster*.
22 The raster is assumed to be an array of ``TileWidth`` × ``TileLength``
23 32-bit entries, where ``TileWidth`` is the width of a tile
24 (:c:macro:`TIFFTAG_TILEWIDTH`) and ``TileLength`` is the height of a
25 tile (:c:macro:`TIFFTAG_TILELENGTH`).
26
27 :c:func:`TIFFReadRGBATileExt` provides the parameter `stop_on_error`.
28 Its behaviour is described at :doc:`TIFFReadRGBAImage`.
29
30 The *x* and *y* values are the offsets from the top left corner to the top
31 left corner of the tile to be read. They must be an exact multiple of the
32 tile width and length.
33
34 Note that the raster is assume to be organized such that the pixel at
35 location
36 (*x*, *y*) is *raster* [ *y* × *width* + *x* ]; with the raster origin
37 in the *lower-left hand corner* of the tile. That is bottom to top
38 organization. Edge tiles which partly fall off the image will be filled
39 out with appropriate zeroed areas.
40
41 Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros
42 :c:macro:`TIFFGetR`, :c:macro:`TIFFGetG`, :c:macro:`TIFFGetB`, and
43 :c:macro:`TIFFGetA` should be used to access individual samples. Images
44 without Associated Alpha matting information have a constant Alpha of 1.0
45 (255).
46
47 See the :doc:`TIFFRGBAImage` page for more details on how various image
48 types are converted to RGBA values.
49
50 Notes
51 -----
52
53 Samples must be either 1, 2, 4, 8, or 16 bits.
54 Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
55 ``SamplesPerPixel`` - ``ExtraSamples``).
56
57 Palette image colormaps that appear to be incorrectly written as 8-bit
58 values are automatically scaled to 16-bits.
59
60 :c:func:`TIFFReadRGBATile` is just a wrapper around the more general
61 :doc:`TIFFRGBAImage` facilities. It's main advantage over the similar
62 :c:func:`TIFFReadRGBAImage` function is that for large images a single
63 buffer capable of holding the whole image doesn't need to be allocated,
64 only enough for one tile. The :c:func:`TIFFReadRGBAStrip` function
65 does a similar operation for stripped images.
66
67 Return values
68 -------------
69
70 1 is returned if the image was successfully read and converted.
71 Otherwise, 0 is returned if an error was encountered.
72
73 Diagnostics
74 -----------
75
76 All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
77
78 ``"Sorry, can not handle %d-bit pictures"``:
79
80 The image had ``BitsPerSample`` other than 1, 2, 4, 8, or 16.
81
82 ``"Sorry, can not handle %d-channel images"``:
83
84 The image had ``SamplesPerPixel`` other than 1, 3, or 4.
85
86 ``Missing needed "PhotometricInterpretation" tag``:
87
88 The image did not have a tag that describes how to display the data.
89
90 ``No "PhotometricInterpretation" tag, assuming RGB``:
91
92 The image was missing a tag that describes how to display it, but because it
93 has 3 or 4 samples/pixel, it is assumed to be RGB.
94
95 ``No "PhotometricInterpretation" tag, assuming min-is-black``:
96
97 The image was missing a tag that describes how to display it,
98 but because it has 1 sample/pixel, it is assumed to be a grayscale
99 or bilevel image.
100
101 ``"No space for photometric conversion table"``:
102
103 There was insufficient memory for a table used to convert
104 image samples to 8-bit RGB.
105
106 ``Missing required "Colormap" tag``:
107
108 A Palette image did not have a required ``Colormap`` tag.
109
110 ``"No space for tile buffer"``:
111
112 There was insufficient memory to allocate an i/o buffer.
113
114 ``"No space for strip buffer"``:
115
116 There was insufficient memory to allocate an i/o buffer.
117
118 ``"Can not handle format"``:
119
120 The image has a format (combination of ``BitsPerSample``,
121 ``SamplesPerPixel``, and ``PhotometricInterpretation``)
122 that :c:func:`TIFFReadRGBAImage` can not handle.
123
124 ``"No space for B&W mapping table"``:
125
126 There was insufficient memory to allocate a table used to map
127 grayscale data to RGB.
128
129 ``"No space for Palette mapping table"``:
130
131 There was insufficient memory to allocate a table used to map data to 8-bit
132 RGB.
133
134 See also
135 --------
136
137 :doc:`TIFFOpen` (3tiff),
138 :doc:`TIFFRGBAImage` (3tiff),
139 :doc:`TIFFReadRGBAImage` (3tiff),
140 :doc:`TIFFReadRGBAStrip` (3tiff),
141 :doc:`libtiff` (3tiff)