|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Encode scanlines and striles or append stored payload bytes. More...
Functions | |
| int | TIFFWriteScanline (TIFF *tif, void *buf, uint32_t row, uint16_t sample) |
| Encode and buffer one image scanline. | |
| tmsize_t | TIFFWriteTile (TIFF *tif, void *buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s) |
| Encode the tile containing image coordinates. | |
| tmsize_t | TIFFWriteEncodedStrip (TIFF *tif, uint32_t strip, void *data, tmsize_t cc) |
| Write encoded samples to one strip. | |
| tmsize_t | TIFFWriteRawStrip (TIFF *tif, uint32_t strip, void *data, tmsize_t cc) |
| Write raw stored bytes to one strip. | |
| tmsize_t | TIFFWriteEncodedTile (TIFF *tif, uint32_t tile, void *data, tmsize_t cc) |
| Write encoded samples to one tile. | |
| tmsize_t | TIFFWriteRawTile (TIFF *tif, uint32_t tile, void *data, tmsize_t cc) |
| Write raw stored bytes to one tile. | |
| void | TIFFSetWriteOffset (TIFF *tif, toff_t off) |
| Change the cached next payload write offset. | |
Encode scanlines and striles or append stored payload bytes.
Change the cached next payload write offset.
Assigns the cached continuation offset (tif_curoff) and clears the saved reusable-extent boundary without seeking, validating file layout, writing, allocating, or diagnosing. The offset only matters when further data is appended to a strile that already has an offset: it is then taken as the current write position for size and boundary bookkeeping, but no seek to it is performed. It does not choose the location of a new strile: for a strile with no offset, or after the offset is reset to zero, the next append reuses the strile's existing on-disk slot when the new data fits and otherwise appends at EOF, ignoring any nonzero value. TIFFWriteEncodedStrip() and TIFFWriteEncodedTile() reset the offset to zero on entry, and TIFFWriteScanline() and TIFFWriteRawStrip() reset it when the strip changes. Does not set IFD metadata offsets, prevent overlap, flush buffers, or transfer ownership.
| [in,out] | tif | Non-NULL live handle; serialise access externally. |
| [in] | off | Continuation offset in file bytes for the strile being written; zero lets the next append choose the strile location. |
Definition at line 1244 of file tif_write.c.
References tiff::tif_curoff, and tiff::tif_lastvalidoff.
Referenced by TIFFCheckpointDirectory().
Write encoded samples to one strip.
Encodes supplied host-order samples. The source is writable because postdecode swapping runs in place before encoding; uncompressed paths can additionally reverse its bits. Mutation is not undone on failure. Compressed output may be buffered/appended through codec hooks. cc must be a nonnegative representable input extent; encoded strips do not interpret minus one as a full-strip sentinel. Strip writers can grow contiguous strile arrays only at the immediately following index; separate-plane arrays cannot grow this way. Establish ImageLength before strile writes; array growth is not a general image-height update. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and write client I/O, and invoke codec/tag/diagnostic callbacks. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, file position, or file bytes can already have changed, and data already written is not removed. No errno, rollback, or durability guarantee. See Image transfers and buffers.
Codec encode callbacks are tested for nonzero here; negative callback errors, such as the fallback encoder used for unknown schemes, can therefore be accepted as success. A positive public status can accompany error diagnostics with no data stored.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in] | strip | Zero-based strip index including separate sample planes. |
| [in,out] | data | Caller-owned input of cc bytes; may be byte-swapped or bit-reversed in place before encoding. |
| [in] | cc | Nonnegative input byte count. |
Definition at line 331 of file tif_write.c.
References _TIFFCheckPostDecodeLength(), _TIFFReserveLargeEnoughWriteBuffer(), BUFFERCHECK, COMPRESSION_NONE, isFillOrder, PLANARCONFIG_SEPARATE, TIFFDirectory::td_curstrip, TIFFDirectory::td_row, tiff::tif_curoff, tiff::tif_dir, tiff::tif_encodestrip, tiff::tif_flags, tiff::tif_postdecode, tiff::tif_postencode, tiff::tif_preencode, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdata, tiff::tif_setupencode, TIFF_BUF4WRITE, TIFF_CODERSETUP, TIFF_NOBITREV, TIFFAppendToStrip(), TIFFErrorExtR(), TIFFGrowStrips(), TIFFhowmany_32, TIFFReverseBits(), TIFFSafeModMul32, and WRITECHECKSTRIPS.
Write encoded samples to one tile.
Encodes supplied host-order samples. The source is writable because postdecode swapping runs in place before encoding; uncompressed paths can additionally reverse its bits. Mutation is not undone on failure. Compressed output may be buffered/appended through codec hooks. Encoded tiles clamp cc<1 or cc above the cached decoded tile size to a full tile, including minus one. The caller must therefore supply the full extent even for a zero/negative request. Requires an existing in-range tile and established image/tile geometry; cannot grow the image. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and write client I/O, and invoke codec/tag/diagnostic callbacks. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, file position, or file bytes can already have changed, and data already written is not removed. No errno, rollback, or durability guarantee. See Image transfers and buffers.
Codec encode callbacks are tested for nonzero here; negative callback errors, such as the fallback encoder used for unknown schemes, can therefore be accepted as success. A positive public status can accompany error diagnostics with no data stored.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in] | tile | Zero-based tile index including separate sample planes. |
| [in,out] | data | Caller-owned input of the effective cc bytes; may be byte-swapped or bit-reversed in place before encoding. |
| [in] | cc | Input byte count; values below one or above the decoded tile size select the full tile. |
Definition at line 565 of file tif_write.c.
References _TIFFCheckPostDecodeLength(), _TIFFReserveLargeEnoughWriteBuffer(), BUFFERCHECK, COMPRESSION_NONE, isFillOrder, TIFFDirectory::td_col, TIFFDirectory::td_curtile, TIFFDirectory::td_row, TIFFDirectory::td_tilesize, tiff::tif_curoff, tiff::tif_dir, tiff::tif_encodetile, tiff::tif_flags, tiff::tif_postdecode, tiff::tif_postencode, tiff::tif_preencode, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdata, tiff::tif_setupencode, TIFF_BUF4WRITE, TIFF_CODERSETUP, TIFF_NOBITREV, TIFFAppendToStrip(), TIFFErrorExtR(), TIFFhowmany_32, TIFFReverseBits(), TIFFSafeModMul32, and WRITECHECKTILES.
Referenced by TIFFWriteTile().
Write raw stored bytes to one strip.
Appends already encoded/file-order bytes without sample conversion or compression; supply the representation expected by the selected codec/directory. Does not inspect payload correctness or generally prevent overlapping file regions. cc must be a nonnegative representable input extent; a negative cc, including minus one, is diagnosed and rejected rather than treated as a full-strip sentinel. Strip writers can grow contiguous strile arrays only at the immediately following index; separate-plane arrays cannot grow this way. Establish ImageLength before strile writes; array growth is not a general image-height update. May allocate handle-owned strile arrays, load deferred metadata, seek and write client I/O, and invoke tag/diagnostic callbacks; no codec callbacks run. No handle or caller-buffer ownership transfers. Failure is not transactional: strile arrays, flags, file position, or file bytes can already have changed, and data already written is not removed. No errno, rollback, or durability 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 strip index including separate sample planes. |
| [in] | data | Readable caller-owned stored bytes of cc bytes; not modified by this call. |
| [in] | cc | Nonnegative count of stored bytes to append. |
Definition at line 458 of file tif_write.c.
References PLANARCONFIG_SEPARATE, TIFFDirectory::td_curstrip, TIFFDirectory::td_row, tiff::tif_curoff, tiff::tif_dir, TIFF_SSIZE_FORMAT, TIFFAppendToStrip(), TIFFErrorExtR(), TIFFGrowStrips(), TIFFhowmany_32, TIFFSafeModMul32, and WRITECHECKSTRIPS.
Write raw stored bytes to one tile.
Appends already encoded/file-order bytes without sample conversion or compression; supply the representation expected by the selected codec/directory. Does not inspect payload correctness or generally prevent overlapping file regions. cc must be a nonnegative representable input extent; unlike TIFFWriteEncodedTile(), a negative cc, including minus one, is diagnosed and rejected rather than treated as a full tile. Requires an existing in-range tile and established image/tile geometry; cannot grow the image. May allocate handle-owned strile arrays, load deferred metadata, seek and write client I/O, and invoke tag/diagnostic callbacks; no codec callbacks run. No handle or caller-buffer ownership transfers. Failure is not transactional: strile arrays, flags, file position, or file bytes can already have changed, and data already written is not removed. No errno, rollback, or durability 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 tile index including separate sample planes. |
| [in] | data | Readable caller-owned stored bytes of cc bytes; not modified by this call. |
| [in] | cc | Nonnegative count of stored bytes to append. |
Definition at line 692 of file tif_write.c.
References TIFFDirectory::td_nstrips, tiff::tif_dir, TIFF_SSIZE_FORMAT, TIFFAppendToStrip(), TIFFErrorExtR(), and WRITECHECKTILES.
|
extern |
Encode and buffer one image scanline.
Requires strip organisation and a writable handle. Can extend ImageLength for contiguous storage, not separate planes; skipped/backward rows depend on codec seek support. Performs in-place postdecode byte swapping on the input before encoding and does not restore it. Rejects a byte count that is not a multiple of the effective swap width before swapping or encoding. Does not by itself persist the IFD or guarantee all compressed data has reached the file. Row advances to row+1 after encoder dispatch even when it fails. C++ defaults sample to zero. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and write client I/O, and invoke codec/tag/diagnostic callbacks. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, file position, or file bytes can already have changed, and data already written is not removed. No errno, rollback, or durability guarantee. See Image transfers and buffers.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in,out] | buf | Caller-owned scanline of at least TIFFScanlineSize() bytes; may be byte-swapped in place before encoding. |
| [in] | row | Zero-based row; for contiguous storage a row at or beyond ImageLength extends it to row+1. |
| [in] | sample | Separate sample plane; ordinary contiguous access uses zero. |
Definition at line 99 of file tif_write.c.
References _TIFFAdd64(), _TIFFCastUInt64ToUInt32(), _TIFFCheckPostDecodeLength(), _TIFFMultiply64(), BUFFERCHECK, PLANARCONFIG_SEPARATE, TIFFDirectory::td_curstrip, TIFFDirectory::td_row, TIFFDirectory::td_scanlinesize, tiff::tif_curoff, tiff::tif_dir, tiff::tif_encoderow, tiff::tif_flags, tiff::tif_postdecode, tiff::tif_preencode, tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdata, tiff::tif_seek, tiff::tif_setupencode, TIFF_BUF4WRITE, TIFF_CODERSETUP, TIFF_POSTENCODE, TIFFErrorExtR(), TIFFFlushData(), TIFFGrowStrips(), TIFFhowmany_32, TIFFSafeModMul32, and WRITECHECKSTRIPS.
|
extern |
Encode the tile containing image coordinates.
Checks coordinate bounds, computes the tile index, then delegates to TIFFWriteEncodedTile() 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. Input can be changed by swapping/bit reversal. May allocate or replace handle-owned raw/strile buffers, load deferred metadata, seek and write client I/O, and invoke codec/tag/diagnostic callbacks. No handle or caller-buffer ownership transfers. Failure is not transactional: buffers, codec progress, indices, flags, metadata, file position, or file bytes can already have changed, and data already written is not removed. No errno, rollback, or durability guarantee. See Image transfers and buffers.
The delegated TIFFWriteEncodedTile() tests encode callbacks for nonzero; negative callback errors, such as the fallback encoder used for unknown schemes, can therefore be accepted as success. A positive public status can accompany error diagnostics with no data stored.
| [in,out] | tif | Non-NULL live handle with matching current geometry and codec methods; serialise access externally. |
| [in,out] | buf | Caller-owned full decoded tile of TIFFTileSize() bytes; may be byte-swapped or bit-reversed in place before encoding. |
| [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 532 of file tif_write.c.
References _TIFFComputeTileExt(), TIFFCheckTile(), and TIFFWriteEncodedTile().