|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Read supported image layouts into associated eight-bit RGBA rasters. More...
Typedefs | |
| typedef void(* | tileContigRoutine) (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp) |
| Convert a decoded contiguous region through a caller-selectable packer. | |
| typedef void(* | tileSeparateRoutine) (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) |
| Convert a decoded separate-plane region through a caller-selectable packer. | |
Functions | |
| int | TIFFReadRGBAImage (TIFF *tif, uint32_t rwidth, uint32_t rheight, uint32_t *raster, int stop) |
| Read the current image into a packed RGBA raster. | |
| int | TIFFReadRGBAImageOriented (TIFF *tif, uint32_t rwidth, uint32_t rheight, uint32_t *raster, int orientation, int stop) |
| Read the current image into a packed RGBA raster. | |
| int | TIFFReadRGBAStrip (TIFF *tif, uint32_t row, uint32_t *raster) |
| Read and convert one whole strip to packed RGBA. | |
| int | TIFFReadRGBATile (TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster) |
| Read and convert one whole tile to packed RGBA. | |
| int | TIFFReadRGBAStripExt (TIFF *tif, uint32_t row, uint32_t *raster, int stop_on_error) |
| Read and convert one whole strip to packed RGBA. | |
| int | TIFFReadRGBATileExt (TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster, int stop_on_error) |
| Read and convert one whole tile to packed RGBA. | |
| int | TIFFRGBAImageOK (TIFF *tif, char emsg[1024]) |
| Check preliminary RGBA compatibility of the current directory. | |
| int | TIFFRGBAImageBegin (TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[1024]) |
| Initialise an RGBA reader and select conversion methods. | |
| int | TIFFRGBAImageGet (TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight) |
| Read and convert a selected image area through installed callbacks. | |
| void | TIFFRGBAImageEnd (TIFFRGBAImage *img) |
| Release RGBA conversion tables and copied colormaps. | |
Read supported image layouts into associated eight-bit RGBA rasters.
| typedef void(* tileContigRoutine) (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp) |
Convert a decoded contiguous region through a caller-selectable packer.
Invoked synchronously by RGBA getters. Default callbacks produce numeric 0xAABBGGRR pixels, normally with associated alpha; see TIFFRGBAImageGet() for the grayscale exception. Custom callbacks define their output interpretation while respecting supplied capacities and row steps. No pointers or ownership transfer. Input is temporary decoded storage and must not be retained; state/handle and callback code must remain live during dispatch. There is no status return; report errors through an application-defined mechanism without closing or recursively decoding the active handle.
| [in,out] | img | Borrowed reader state; default packers read conversion maps without changing them. |
| [out] | cp | Borrowed destination region; valid for all requested rows and signed row steps. |
| [in] | x | Horizontal coordinate within the copied image rectangle, excluding the rectangle's placement offset in the destination raster (cp already includes it); zero for strip getters. |
| [in] | y | Destination row, within the copied image rectangle, of the first decoded row, with any vertical flip applied but excluding the placement offset. The getter's horizontal flip runs after the callbacks, so x and y are not final raster positions. |
| [in] | w | Visible row width in pixels. |
| [in] | h | Visible row count. |
| [in] | fromskew | Source-row skip in pixels; callback scales it for its format. |
| [in] | toskew | Signed output-row adjustment after w pixels, in uint32_t elements. |
| [in] | pp | Borrowed contiguous decoded samples with selected-format padding/alignment. |
| typedef void(* tileSeparateRoutine) (TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) |
Convert a decoded separate-plane region through a caller-selectable packer.
Invoked synchronously by RGBA getters. Default callbacks produce associated numeric 0xAABBGGRR pixels; custom callbacks define their output interpretation while respecting supplied capacities and row steps. No pointers or ownership transfer. Input is temporary decoded storage and must not be retained; state/handle and callback code must remain live during dispatch. There is no status return; report errors through an application-defined mechanism without closing or recursively decoding the active handle.
| [in,out] | img | Borrowed reader state; default packers read conversion maps without changing them. |
| [out] | cp | Borrowed destination region; valid for all requested rows and signed row steps. |
| [in] | x | Horizontal coordinate within the copied image rectangle, excluding the rectangle's placement offset in the destination raster (cp already includes it); zero for strip getters. |
| [in] | y | Destination row, within the copied image rectangle, of the first decoded row, with any vertical flip applied but excluding the placement offset. The getter's horizontal flip runs after the callbacks, so x and y are not final raster positions. |
| [in] | w | Visible row width in pixels. |
| [in] | h | Visible row count. |
| [in] | fromskew | Source-row skip in pixels; callback scales it for its format. |
| [in] | toskew | Signed output-row adjustment after w pixels, in uint32_t elements. |
| [in] | r | Borrowed non-NULL first decoded plane. |
| [in] | g | Borrowed non-NULL second decoded plane; for one-channel images it aliases r. |
| [in] | b | Borrowed non-NULL third decoded plane; for one-channel images it aliases r. |
| [in] | a | Borrowed fourth decoded plane (alpha, or black for 8-bit CMYK) when present, otherwise NULL. |
|
extern |
Read the current image into a packed RGBA raster.
Runs Begin/Get/End, reporting Begin reason text through TIFFErrorExtR(). Requests bottom-left raster origin. Clipping, untouched excess raster area, alpha interpretation and failure-state semantics follow TIFFRGBAImageGet(). Borrows the handle and raster; does not close the handle or acquire raster ownership. May allocate conversion/raw buffers, invoke tag/codec/diagnostic callbacks and perform client reads/seeks. Failure can leave partial raster and changed handle/codec state; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | tif | Non-NULL readable live handle; keep its current directory and codec live throughout conversion and serialise access. |
| [in] | rwidth | Positive raster row stride in pixels. |
| [in] | rheight | Positive raster height; allocation product must be representable. |
| [out] | raster | Caller-owned writable array of at least rwidth*rheight packed pixels. |
| [in] | stop | Nonzero stops on detected decode errors; zero permits selected recovery paths; C++ default is zero. |
Definition at line 723 of file tif_getimage.c.
References ORIENTATION_BOTLEFT, and TIFFReadRGBAImageOriented().
|
extern |
Read the current image into a packed RGBA raster.
Runs Begin/Get/End, reporting Begin reason text through TIFFErrorExtR(). Uses the requested orientation; C++ defaults to bottom-left. Clipping, untouched excess raster area, alpha interpretation and failure-state semantics follow TIFFRGBAImageGet(). Borrows the handle and raster; does not close the handle or acquire raster ownership. May allocate conversion/raw buffers, invoke tag/codec/diagnostic callbacks and perform client reads/seeks. Failure can leave partial raster and changed handle/codec state; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | tif | Non-NULL readable live handle; keep its current directory and codec live throughout conversion and serialise access. |
| [in] | rwidth | Positive raster row stride in pixels. |
| [in] | rheight | Positive raster height; allocation product must be representable. |
| [out] | raster | Caller-owned writable array of at least rwidth*rheight packed pixels. |
| [in] | orientation | Requested TIFF orientation 1..8; default implementation flips without transposition, invalid values fall back to bottom-left with a warning. |
| [in] | stop | Nonzero stops on detected decode errors; zero permits selected recovery paths; C++ default is zero. |
Definition at line 698 of file tif_getimage.c.
References EMSG_BUF_SIZE, _TIFFRGBAImage::req_orientation, TIFFErrorExtR(), TIFFFileName(), TIFFRGBAImageBegin(), TIFFRGBAImageEnd(), and TIFFRGBAImageGet().
Referenced by TIFFReadRGBAImage().
|
extern |
Read and convert one whole strip to packed RGBA.
Requires matching organisation and boundary-aligned coordinates. Initialises/ends a temporary RGBA reader. Output is bottom-to-top with alpha interpretation as in TIFFRGBAImageGet(). The last strip returns only rows inside ImageLength. Delegates to the Ext interface with stop_on_error zero. Borrows the handle and raster; does not close the handle or acquire raster ownership. May allocate conversion/raw buffers, invoke tag/codec/diagnostic callbacks and perform client reads/seeks. Failure can leave partial raster and changed handle/codec state; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | tif | Non-NULL readable live handle; keep its current directory and codec live throughout conversion and serialise access. |
| [in] | row | Zero-based row at a strip boundary; inside the image and representable by int. |
| [out] | raster | Writable caller-owned ImageWidth times effective strip rows packed pixels; allocation product must be representable. |
Definition at line 5300 of file tif_getimage.c.
References TIFFReadRGBAStripExt().
|
extern |
Read and convert one whole strip to packed RGBA.
Requires matching organisation and boundary-aligned coordinates. Initialises/ends a temporary RGBA reader. Output is bottom-to-top with alpha interpretation as in TIFFRGBAImageGet(). The last strip returns only rows inside ImageLength. Uses the specified error policy. Borrows the handle and raster; does not close the handle or acquire raster ownership. May allocate conversion/raw buffers, invoke tag/codec/diagnostic callbacks and perform client reads/seeks. Failure can leave partial raster and changed handle/codec state; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | tif | Non-NULL readable live handle; keep its current directory and codec live throughout conversion and serialise access. |
| [in] | row | Zero-based row at a strip boundary; inside the image and representable by int. |
| [out] | raster | Writable caller-owned ImageWidth times effective strip rows packed pixels; allocation product must be representable. |
| [in] | stop_on_error | Nonzero stops on detected decode errors; zero permits selected recovery. |
Definition at line 5306 of file tif_getimage.c.
References _TIFFRGBAImage::col_offset, EMSG_BUF_SIZE, _TIFFRGBAImage::height, _TIFFRGBAImage::row_offset, TIFFErrorExtR(), TIFFFileName(), TIFFGetFieldDefaulted(), TIFFIsTiled(), TIFFRGBAImageBegin(), TIFFRGBAImageEnd(), TIFFRGBAImageGet(), TIFFTAG_ROWSPERSTRIP, and _TIFFRGBAImage::width.
Referenced by TIFFReadRGBAStrip().
|
extern |
Read and convert one whole tile to packed RGBA.
Requires matching organisation and boundary-aligned coordinates. Initialises/ends a temporary RGBA reader. Output is bottom-to-top with alpha interpretation as in TIFFRGBAImageGet(). Edge tiles shift visible pixels into a full tile and zero padding, even after a failed Get; this does not validate other failed output. Delegates to the Ext interface with stop_on_error zero. Borrows the handle and raster; does not close the handle or acquire raster ownership. May allocate conversion/raw buffers, invoke tag/codec/diagnostic callbacks and perform client reads/seeks. Failure can leave partial raster and changed handle/codec state; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | tif | Non-NULL readable live handle; keep its current directory and codec live throughout conversion and serialise access. |
| [in] | col | Zero-based pixel column at a tile boundary; inside the image and representable by int. |
| [in] | row | Zero-based row at a tile boundary; inside the image and representable by int. |
| [out] | raster | Writable caller-owned TileWidth times TileLength packed pixels; allocation product must be representable. |
Definition at line 5375 of file tif_getimage.c.
References TIFFReadRGBATileExt().
|
extern |
Read and convert one whole tile to packed RGBA.
Requires matching organisation and boundary-aligned coordinates. Initialises/ends a temporary RGBA reader. Output is bottom-to-top with alpha interpretation as in TIFFRGBAImageGet(). Edge tiles shift visible pixels into a full tile and zero padding, even after a failed Get; this does not validate other failed output. Uses the specified error policy. Borrows the handle and raster; does not close the handle or acquire raster ownership. May allocate conversion/raw buffers, invoke tag/codec/diagnostic callbacks and perform client reads/seeks. Failure can leave partial raster and changed handle/codec state; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | tif | Non-NULL readable live handle; keep its current directory and codec live throughout conversion and serialise access. |
| [in] | col | Zero-based pixel column at a tile boundary; inside the image and representable by int. |
| [in] | row | Zero-based row at a tile boundary; inside the image and representable by int. |
| [out] | raster | Writable caller-owned TileWidth times TileLength packed pixels; allocation product must be representable. |
| [in] | stop_on_error | Nonzero stops on detected decode errors; zero permits selected recovery. |
Definition at line 5381 of file tif_getimage.c.
References _TIFFmemset(), _TIFFRGBAImage::col_offset, EMSG_BUF_SIZE, _TIFFRGBAImage::height, _TIFFRGBAImage::row_offset, TIFFErrorExtR(), TIFFFileName(), TIFFGetFieldDefaulted(), TIFFIsTiled(), TIFFRGBAImageBegin(), TIFFRGBAImageEnd(), TIFFRGBAImageGet(), TIFFTAG_TILELENGTH, TIFFTAG_TILEWIDTH, and _TIFFRGBAImage::width.
Referenced by TIFFReadRGBATile().
|
extern |
Initialise an RGBA reader and select conversion methods.
First performs TIFFRGBAImageOK(); that early rejection leaves img untouched. Thereafter initialises owned pointers, copies palettes, builds tables and selects callbacks. Requires fresh state: reusing an active state leaks its old allocations. Successful state must be released with TIFFRGBAImageEnd() before closing tif. Later setup failures normally release conversion allocations. JPEG colour mode or SGILog data-format pseudo-tags can be changed and are not restored by End. The caller may customise callbacks and offsets only under their documented preconditions. Borrows tif, stored in img, without closing it or taking ownership. Allocates conversion tables owned by img and invokes tag/codec/diagnostic callbacks; codec tag getters (OJPEG) can read the file, but no pixel data is read. No errno contract. See RGBA readers and packing.
| [in,out] | img | Non-NULL caller-owned RGBA state; its borrowed handle must remain live. |
| [in,out] | tif | Non-NULL readable live handle; keep its current directory and codec live throughout conversion and serialise access. |
| [in] | stop | Nonzero to stop on detected decode errors; zero allows some failed striles to be converted from retained/partial data. |
| [out] | emsg | Non-NULL caller-owned buffer of at least 1024 bytes; reason text on rejection, contents not defined on success. |
Definition at line 395 of file tif_getimage.c.
References _TIFFmallocExt(), _TIFFmemcpy(), _TIFFRGBAImage::alpha, _TIFFRGBAImage::Bitdepth16To8, _TIFFRGBAImage::bitspersample, _TIFFRGBAImage::bluecmap, _TIFFRGBAImage::BWmap, _TIFFRGBAImage::cielab, _TIFFRGBAImage::col_offset, COMPRESSION_JPEG, COMPRESSION_SGILOG, COMPRESSION_SGILOG24, EMSG_BUF_SIZE, EXTRASAMPLE_ASSOCALPHA, EXTRASAMPLE_UNASSALPHA, EXTRASAMPLE_UNSPECIFIED, _TIFFRGBAImage::greencmap, _TIFFRGBAImage::height, INKSET_CMYK, isCCITTCompression(), _TIFFRGBAImage::isContig, JPEGCOLORMODE_RGB, _TIFFRGBAImage::Map, _TIFFRGBAImage::orientation, ORIENTATION_BOTLEFT, _TIFFRGBAImage::PALmap, _TIFFRGBAImage::photometric, PHOTOMETRIC_CIELAB, PHOTOMETRIC_LOGL, PHOTOMETRIC_LOGLUV, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_PALETTE, PHOTOMETRIC_RGB, PHOTOMETRIC_SEPARATED, PHOTOMETRIC_YCBCR, photoTag, PickContigCase(), PickSeparateCase(), PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, _TIFFRGBAImage::redcmap, _TIFFRGBAImage::req_orientation, _TIFFRGBAImage::row_offset, _TIFFRGBAImage::samplesperpixel, SGILOGDATAFMT_8BIT, _TIFFRGBAImage::stoponerr, TIFFDirectory::td_colormap_count, _TIFFRGBAImage::tif, tiff::tif_dir, TIFFGetField(), TIFFGetFieldDefaulted(), TIFFRGBAImageEnd(), TIFFRGBAImageOK(), TIFFSetField(), TIFFTAG_BITSPERSAMPLE, TIFFTAG_COLORMAP, TIFFTAG_COMPRESSION, TIFFTAG_EXTRASAMPLES, TIFFTAG_IMAGELENGTH, TIFFTAG_IMAGEWIDTH, TIFFTAG_INKSET, TIFFTAG_JPEGCOLORMODE, TIFFTAG_ORIENTATION, TIFFTAG_PHOTOMETRIC, TIFFTAG_PLANARCONFIG, TIFFTAG_SAMPLESPERPIXEL, TIFFTAG_SGILOGDATAFMT, _TIFFRGBAImage::UaToAa, _TIFFRGBAImage::width, and _TIFFRGBAImage::ycbcr.
Referenced by TIFFReadRGBAImageOriented(), TIFFReadRGBAStripExt(), and TIFFReadRGBATileExt().
|
extern |
Release RGBA conversion tables and copied colormaps.
Requires successfully begun state, or a state whose owned pointers and tif have been initialised equivalently. Releases Ext allocations and clears their pointers; does not free img, close tif, restore changed codec pseudo-tags, clear callbacks, or free raster storage. Do not use the released tables or decode again without a new Begin. No pixel I/O or separate error status.
| [in,out] | img | Non-NULL caller-owned RGBA state; its borrowed handle must remain live. |
Definition at line 327 of file tif_getimage.c.
References _TIFFfreeExt(), _TIFFRGBAImage::Bitdepth16To8, _TIFFRGBAImage::bluecmap, _TIFFRGBAImage::BWmap, _TIFFRGBAImage::cielab, _TIFFRGBAImage::greencmap, _TIFFRGBAImage::Map, _TIFFRGBAImage::PALmap, _TIFFRGBAImage::redcmap, _TIFFRGBAImage::tif, _TIFFRGBAImage::UaToAa, and _TIFFRGBAImage::ycbcr.
Referenced by TIFFReadRGBAImageOriented(), TIFFReadRGBAStripExt(), TIFFReadRGBATileExt(), and TIFFRGBAImageBegin().
|
extern |
Read and convert a selected image area through installed callbacks.
Requires successful Begin and positive raster dimensions with a representable rwidth*rheight allocation. Checks get/put availability then invokes get synchronously. Default getters clip to available image dimensions after nonnegative in-range offsets, reject sub-byte column offsets not aligned to bytes, and place pixels at the requested raster corner. Raster areas outside the copied rectangle remain unchanged. Default orientation handling flips but does not transpose; orientations 5..8 can warn about unavailable rotation. Output words contain associated RGB in low bytes and alpha in the high byte, except that the default eight-bit two-sample grayscale packer copies gray and alpha without premultiplying an unassociated gray sample. Such input retains unassociated colour values; see RGBA readers and packing. Borrows the handle and raster; does not close the handle or acquire raster ownership. May allocate conversion/raw buffers, invoke tag/codec/diagnostic callbacks and perform client reads/seeks. Failure can leave partial raster and changed handle/codec state; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | img | Non-NULL caller-owned RGBA state; its borrowed handle must remain live. |
| [out] | raster | Borrowed writable array of at least rwidth*rheight uint32_t pixels; disjoint from state and decode buffers. |
| [in] | rwidth | Positive output row stride in pixels. |
| [in] | rheight | Positive output row count. |
Definition at line 674 of file tif_getimage.c.
References _TIFFRGBAImage::any, _TIFFRGBAImage::get, _TIFFRGBAImage::put, _TIFFRGBAImage::tif, TIFFErrorExtR(), and TIFFFileName().
Referenced by TIFFReadRGBAImageOriented(), TIFFReadRGBAStripExt(), and TIFFReadRGBATileExt().
|
extern |
Check preliminary RGBA compatibility of the current directory.
Examines compression availability, bit/sample formats, photometric interpretation, and selected channel/layout constraints. A positive result does not guarantee that Begin/Get will support the complete conversion or allocate successfully. No pixel reads, allocation, or conversion state. Borrows the handle without ownership transfer; tag getters may invoke codec callbacks (OJPEG getters can read the file). Writes emsg only on rejection; no rollback or errno contract. See RGBA readers and packing.
| [in,out] | tif | Non-NULL live handle whose current directory tags are queried; tag lookup can update field caches. Serialise access. |
| [out] | emsg | Non-NULL caller-owned buffer of at least 1024 bytes; reason text on rejection, contents not defined on success. |
Definition at line 157 of file tif_getimage.c.
References COMPRESSION_SGILOG, COMPRESSION_SGILOG24, EMSG_BUF_SIZE, INKSET_CMYK, PHOTOMETRIC_CIELAB, PHOTOMETRIC_LOGL, PHOTOMETRIC_LOGLUV, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_PALETTE, PHOTOMETRIC_RGB, PHOTOMETRIC_SEPARATED, PHOTOMETRIC_YCBCR, photoTag, PLANARCONFIG_CONTIG, SAMPLEFORMAT_IEEEFP, TIFFDirectory::td_bitspersample, TIFFDirectory::td_compression, TIFFDirectory::td_extrasamples, TIFFDirectory::td_planarconfig, TIFFDirectory::td_sampleformat, TIFFDirectory::td_samplesperpixel, tiff::tif_decodestatus, tiff::tif_dir, TIFFGetField(), TIFFGetFieldDefaulted(), TIFFTAG_INKSET, and TIFFTAG_PHOTOMETRIC.
Referenced by TIFFRGBAImageBegin().