|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Decode scanlines and striles or copy stored payload bytes. More...
Functions | |
| int | TIFFReadScanline (TIFF *tif, void *buf, uint32_t row, uint16_t sample) |
| Decode one image scanline into caller storage. | |
| tmsize_t | TIFFReadTile (TIFF *tif, void *buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s) |
| Decode the tile containing image coordinates. | |
| tmsize_t | TIFFReadEncodedStrip (TIFF *tif, uint32_t strip, void *buf, tmsize_t size) |
| Read decoded samples from one strip. | |
| tmsize_t | TIFFReadRawStrip (TIFF *tif, uint32_t strip, void *buf, tmsize_t size) |
| Read stored bytes from one strip. | |
| tmsize_t | TIFFReadEncodedTile (TIFF *tif, uint32_t tile, void *buf, tmsize_t size) |
| Read decoded samples from one tile. | |
| tmsize_t | TIFFReadRawTile (TIFF *tif, uint32_t tile, void *buf, tmsize_t size) |
| Read stored bytes from one tile. | |
| int | TIFFReadFromUserBuffer (TIFF *tif, uint32_t strile, void *inbuf, tmsize_t insize, void *outbuf, tmsize_t outsize) |
| Decode one strile from caller-provided stored bytes. | |
Decode scanlines and striles or copy stored payload bytes.
Read decoded samples from one strip.
Decodes host-order samples, including postdecode conversion and configured fill order. Minus one requests the complete decoded strile; a nonnegative size limits the requested output, clipped to the decoded extent (the last strip can be shorter). Zero requests are not uniform success paths; prefer a positive count. Negative values other than minus one are diagnosed and rejected. An uncompressed direct-read shortcut bypasses decoder state transitions. Fill failure may zero the requested output; other failure paths need not. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and read client I/O, and invoke codec/tag/diagnostic callbacks; reading never writes to the file. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, or file position can already have changed; disregard partial decoded output unless a codec explicitly documents otherwise. No errno or rollback guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in] | strip | Zero-based strile index including separate sample planes. |
| [out] | buf | Caller-owned writable output with capacity for the effective byte count; do not alias mutable handle raw storage. |
| [in] | size | Minus one for full extent, otherwise a nonnegative decoded limit. |
Definition at line 708 of file tif_read.c.
References _TIFFCheckPostDecodeLength(), COMPRESSION_NONE, isFillOrder, isMapped, tiff::tif_decodestrip, tiff::tif_dir, tiff::tif_flags, tiff::tif_postdecode, TIFF_NOBITREV, TIFF_NOREADRAW, TIFF_SSIZE_FORMAT, TIFFErrorExtR(), TIFFFillStrip(), TIFFReadEncodedStripGetStripSize(), TIFFReadRawStrip1(), and TIFFReverseBits().
Referenced by _TIFFReadEncodedStripAndAllocBuffer(), and gtStripSeparate().
Read decoded samples from one tile.
Decodes host-order samples, including postdecode conversion and configured fill order. Minus one requests the complete decoded tile; a nonnegative size limits the requested output, clipped to the full decoded tile size (edge tiles include padding and are not shortened). Zero requests are not uniform success paths; prefer a positive count. Negative values other than minus one are diagnosed and rejected. An uncompressed direct-read shortcut bypasses decoder state transitions. Fill failure may zero the requested output; other failure paths need not. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and read client I/O, and invoke codec/tag/diagnostic callbacks; reading never writes to the file. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, or file position can already have changed; disregard partial decoded output unless a codec explicitly documents otherwise. No errno or rollback guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in] | tile | Zero-based strile index including separate sample planes. |
| [out] | buf | Caller-owned writable output with capacity for the effective byte count; do not alias mutable handle raw storage. |
| [in] | size | Minus one for full extent, otherwise a nonnegative decoded limit. |
Definition at line 1284 of file tif_read.c.
References _TIFFCheckPostDecodeLength(), COMPRESSION_NONE, isFillOrder, isMapped, TIFFDirectory::td_tilesize, tiff::tif_decodetile, tiff::tif_dir, tiff::tif_flags, tiff::tif_postdecode, TIFF_NOBITREV, TIFF_NOREADRAW, TIFF_SSIZE_FORMAT, TIFFCheckRead(), TIFFErrorExtR(), TIFFFillTile(), TIFFReadRawTile1(), and TIFFReverseBits().
Referenced by _TIFFReadEncodedTileAndAllocBuffer(), and TIFFReadTile().
|
extern |
Decode one strile from caller-provided stored bytes.
Borrows a writable input and caller output without reading the strile payload from the file. Intended for handles with readable data (the mode check only rejects O_WRONLY, which libtiff handles never use). Requires a raw-capable codec, valid strile and consistent nonzero per-plane geometry; it does not perform the ordinary public strile-index validation. Temporarily attaches inbuf, may reverse its bits before decode and reverses again afterwards under the then-current flags. Rejects a negative outsize or nonpositive insize. Restores old raw-data pointer/capacity and ownership/mapping bits, resets the raw cursor to the restored buffer with no bytes loaded, and forgets the current strip/tile, so no handle state refers into inbuf after return and the next ordinary read reloads its strile. Codec progress is not otherwise restored. No allocations are transferred. Startup failure can zero output; later failure can leave partial output. Other flags and codec effects survive. Codec setup and decode callbacks run and can allocate codec state; some codecs (OJPEG) also seek and read the file there. Never writes to the file. Failure is not transactional; disregard partial decoded output unless a codec explicitly documents otherwise. No errno or rollback guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in] | strile | Valid zero-based strip/tile index under current organisation. |
| [in,out] | inbuf | Borrowed mutable stored-byte buffer of insize bytes; separate from output and handle-owned storage. |
| [in] | insize | Positive valid raw input extent. |
| [out] | outbuf | Writable decoded destination of outsize bytes; NULL only with an explicitly compatible callback codec. |
| [in] | outsize | Nonnegative valid decoded extent accepted by the codec. |
Definition at line 2081 of file tif_read.c.
References _TIFFCheckPostDecodeLength(), isFillOrder, NOSTRIP, NOTILE, tiff::tif_decodestrip, tiff::tif_decodetile, tiff::tif_dir, tiff::tif_flags, tiff::tif_mode, tiff::tif_name, tiff::tif_postdecode, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdata, tiff::tif_rawdataloaded, tiff::tif_rawdataoff, tiff::tif_rawdatasize, TIFF_BUFFERMMAP, TIFF_MYBUFFER, TIFF_NOBITREV, TIFF_NOREADRAW, TIFF_SSIZE_FORMAT, TIFFErrorExtR(), TIFFhowmany_32_maxuint_compat, TIFFIsTiled(), TIFFReverseBits(), TIFFStartStrip(), and TIFFStartTile().
Read stored bytes from one strip.
Copies stored bytes without decoding, postdecode sample swapping, or fill-order reversal. Minus one requests the whole stored byte count; a positive size limits it to the available metadata count. Other negative sizes are diagnosed and rejected, and zero effective size fails. Requires raw access supported by the codec, valid index, matching organisation, and readable mode. Payload range is read/mapped and exact short reads fail; partial destination contents may remain. Loads deferred strile metadata when needed, then seeks and reads client I/O or copies from the file mapping; invokes no codec callbacks and never writes to the file. Allocates no intermediate pixel-data buffer, but deferred strile metadata queries can allocate or replace handle-owned offset/count arrays, with the allocation-failure and borrowed-view effects described for TIFFGetStrileOffset(). On failure the file position may have moved. No errno or rollback guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in] | strip | Zero-based strile index including separate sample planes. |
| [out] | buf | Caller-owned writable output with capacity for the effective byte count; do not alias mutable handle raw storage. |
| [in] | size | Minus one for all stored bytes, otherwise a positive raw byte limit. |
Definition at line 974 of file tif_read.c.
References _TIFFCastUInt64ToSSize(), tiff::tif_dir, tiff::tif_flags, TIFF_NOREADRAW, TIFF_SSIZE_FORMAT, TIFFCheckRead(), TIFFErrorExtR(), TIFFGetStrileByteCount(), and TIFFReadRawStrip1().
Read stored bytes from one tile.
Copies stored bytes without decoding, postdecode sample swapping, or fill-order reversal. Minus one requests the whole stored byte count; a positive size limits it to the available metadata count. Other negative sizes are diagnosed and rejected, and zero effective size fails. Requires raw access supported by the codec, valid index, matching organisation, and readable mode. Payload range is read/mapped and exact short reads fail; partial destination contents may remain. Loads deferred strile metadata when needed, then seeks and reads client I/O or copies from the file mapping; invokes no codec callbacks and never writes to the file. Allocates no intermediate pixel-data buffer, but deferred strile metadata queries can allocate or replace handle-owned offset/count arrays, with the allocation-failure and borrowed-view effects described for TIFFGetStrileOffset(). On failure the file position may have moved. No errno or rollback guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in] | tile | Zero-based strile index including separate sample planes. |
| [out] | buf | Caller-owned writable output with capacity for the effective byte count; do not alias mutable handle raw storage. |
| [in] | size | Minus one for all stored bytes, otherwise a positive raw byte limit. |
Definition at line 1549 of file tif_read.c.
References _TIFFCastUInt64ToSSize(), tiff::tif_dir, tiff::tif_flags, TIFF_NOREADRAW, TIFF_SSIZE_FORMAT, TIFFCheckRead(), TIFFErrorExtR(), TIFFGetStrileByteCount(), and TIFFReadRawTile1().
|
extern |
Decode one image scanline into caller storage.
Requires readable strip organisation; validates row and separate-plane sample through TIFFSeek(). A whole decoded scanline must fit in buf. Invokes the decoder, and postdecode only after positive decoder success and acceptance of the byte count for the effective byte-swapping method. After decoder dispatch caches row+1 even on failure. A failed seek can zero the output, while initial mode/organisation rejection or codec failure need not. NULL output is only supported by a specifically configured callback-based codec path, not generally. C++ defaults sample to zero. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and read client I/O, and invoke codec/tag/diagnostic callbacks; reading never writes to the file. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, or file position can already have changed; disregard partial decoded output unless a codec explicitly documents otherwise. No errno or rollback guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [out] | buf | Caller-owned writable output of at least TIFFScanlineSize() bytes. |
| [in] | row | Zero-based row below ImageLength. |
| [in] | sample | Separate sample plane; ordinary contiguous access uses zero. |
Definition at line 602 of file tif_read.c.
References _TIFFCheckPostDecodeLength(), TIFFDirectory::td_row, TIFFDirectory::td_scanlinesize, tiff::tif_decoderow, tiff::tif_dir, tiff::tif_postdecode, TIFFCheckRead(), and TIFFSeek().
|
extern |
Decode the tile containing image coordinates.
Checks coordinate bounds, computes the tile index, then delegates to TIFFReadEncodedTile() with the full-tile sentinel. Fails if the tile index overflows 32 bits. The buffer must cover the full decoded tile including edge padding, not just visible pixels. Output is valid only on success. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and read client I/O, and invoke codec/tag/diagnostic callbacks; reading never writes to the file. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, or file position can already have changed; disregard partial decoded output unless a codec explicitly documents otherwise. No errno or rollback guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [out] | buf | Caller-owned writable output of at least TIFFTileSize() bytes. |
| [in] | x | Pixel column inside the image. |
| [in] | y | Pixel row inside the image. |
| [in] | z | Depth slice inside the image. |
| [in] | s | Separate sample plane, zero for ordinary contiguous use. |
Definition at line 1265 of file tif_read.c.
References _TIFFComputeTileExt(), TIFFCheckRead(), TIFFCheckTile(), and TIFFReadEncodedTile().
Referenced by gtTileSeparate().