Debian Codegraph @

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

raw
1 TIFFReadScanline
2 ================
3
4 Synopsis
5 --------
6
7 .. highlight:: c
8
9 ::
10
11 #include <tiffio.h>
12
13 .. c:function:: int TIFFReadScanline(TIFF* tif, tdata_t buf, uint32_t row, tsample_t sample)
14
15 Description
16 -----------
17
18 Read the data for the specified row into the (user supplied) data buffer
19 *buf*. The data are returned decompressed and, in the native byte- and
20 bit-ordering, but are otherwise packed (see further below). The buffer
21 must be large enough to hold an entire scanline of data. Applications
22 should call the routine :c:func:`TIFFScanlineSize` to find out the size
23 (in bytes) of a scanline buffer.
24 The *row* parameter is always used by :c:func:`TIFFReadScanline`; the
25 *sample* parameter is used only if data are organized in separate planes
26 (``PlanarConfiguration`` = 2).
27
28 Notes
29 -----
30
31 The library attempts to hide bit- and byte-ordering differences between the
32 image and the native machine by converting data to the native machine order.
33 Bit reversal is done if the ``FillOrder`` tag is opposite to the native
34 machine bit order. 16- and 32-bit samples are automatically byte-swapped if
35 the file was written with a byte order opposite to the native machine byte
36 order,
37
38 In C++ the *sample* parameter defaults to 0.
39
40 Return values
41 -------------
42
43 :c:func:`TIFFReadScanline` returns -1 if it detects an error; otherwise 1 is
44 returned.
45
46 Diagnostics
47 -----------
48
49 All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
50
51 ``"Compression algorithm does not support random access"``:
52
53 Data was requested in a non-sequential order from a file that uses a
54 compression algorithm and that has ``RowsPerStrip`` greater than one.
55 That is, data in the image is stored in a compressed form, and with multiple
56 rows packed into a strip. In this case, the library does not support random
57 access to the data. The data should either be accessed sequentially, or the
58 file should be converted so that each strip is made up of one row of data.
59
60 Bugs
61 ----
62
63 Reading subsampled YCbCR data does not work correctly because, for
64 ``PlanarConfiguration`` = 2, the size of a scanline is not calculated on a
65 per-sample basis, and for ``PlanarConfiguration`` = 1, the library does not
66 unpack the block-interleaved samples; use the strip- and
67 tile-based interfaces to read these formats.
68
69 See also
70 --------
71
72 :doc:`TIFFOpen` (3tiff),
73 :doc:`TIFFReadEncodedStrip` (3tiff),
74 :doc:`TIFFReadRawStrip` (3tiff),
75 :doc:`libtiff` (3tiff)