jpayne@69: /* jpayne@69: * Copyright (c) 1988-1997 Sam Leffler jpayne@69: * Copyright (c) 1991-1997 Silicon Graphics, Inc. jpayne@69: * jpayne@69: * Permission to use, copy, modify, distribute, and sell this software and jpayne@69: * its documentation for any purpose is hereby granted without fee, provided jpayne@69: * that (i) the above copyright notices and this permission notice appear in jpayne@69: * all copies of the software and related documentation, and (ii) the names of jpayne@69: * Sam Leffler and Silicon Graphics may not be used in any advertising or jpayne@69: * publicity relating to the software without the specific, prior written jpayne@69: * permission of Sam Leffler and Silicon Graphics. jpayne@69: * jpayne@69: * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, jpayne@69: * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY jpayne@69: * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. jpayne@69: * jpayne@69: * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR jpayne@69: * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, jpayne@69: * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, jpayne@69: * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF jpayne@69: * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE jpayne@69: * OF THIS SOFTWARE. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TIFFIO_ jpayne@69: #define _TIFFIO_ jpayne@69: jpayne@69: /* jpayne@69: * TIFF I/O Library Definitions. jpayne@69: */ jpayne@69: #include "tiff.h" jpayne@69: #include "tiffvers.h" jpayne@69: jpayne@69: /* jpayne@69: * TIFF is defined as an incomplete type to hide the jpayne@69: * library's internal data structures from clients. jpayne@69: */ jpayne@69: typedef struct tiff TIFF; jpayne@69: jpayne@69: /* jpayne@69: * The following typedefs define the intrinsic size of jpayne@69: * data types used in the *exported* interfaces. These jpayne@69: * definitions depend on the proper definition of types jpayne@69: * in tiff.h. Note also that the varargs interface used jpayne@69: * to pass tag types and values uses the types defined in jpayne@69: * tiff.h directly. jpayne@69: * jpayne@69: * NB: ttag_t is unsigned int and not unsigned short because jpayne@69: * ANSI C requires that the type before the ellipsis be a jpayne@69: * promoted type (i.e. one of int, unsigned int, pointer, jpayne@69: * or double) and because we defined pseudo-tags that are jpayne@69: * outside the range of legal Aldus-assigned tags. jpayne@69: * NB: tsize_t is signed and not unsigned because some functions jpayne@69: * return -1. jpayne@69: * NB: toff_t is not off_t for many reasons; TIFFs max out at jpayne@69: * 32-bit file offsets, and BigTIFF maxes out at 64-bit jpayne@69: * offsets being the most important, and to ensure use of jpayne@69: * a consistently unsigned type across architectures. jpayne@69: * Prior to libtiff 4.0, this was an unsigned 32 bit type. jpayne@69: */ jpayne@69: /* jpayne@69: * this is the machine addressing size type, only it's signed, so make it jpayne@69: * int32_t on 32bit machines, int64_t on 64bit machines jpayne@69: */ jpayne@69: typedef TIFF_SSIZE_T tmsize_t; jpayne@69: #define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1) jpayne@69: jpayne@69: typedef uint64_t toff_t; /* file offset */ jpayne@69: /* the following are deprecated and should be replaced by their defining jpayne@69: counterparts */ jpayne@69: typedef uint32_t ttag_t; /* directory tag */ jpayne@69: typedef uint32_t tdir_t; /* directory index */ jpayne@69: typedef uint16_t tsample_t; /* sample number */ jpayne@69: typedef uint32_t tstrile_t; /* strip or tile number */ jpayne@69: typedef tstrile_t tstrip_t; /* strip number */ jpayne@69: typedef tstrile_t ttile_t; /* tile number */ jpayne@69: typedef tmsize_t tsize_t; /* i/o size in bytes */ jpayne@69: typedef void *tdata_t; /* image data ref */ jpayne@69: jpayne@69: #if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32)) jpayne@69: #define __WIN32__ jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c jpayne@69: * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c). jpayne@69: * jpayne@69: * By default tif_unix.c is assumed. jpayne@69: */ jpayne@69: jpayne@69: #if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) jpayne@69: #if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && \ jpayne@69: !defined(USE_WIN32_FILEIO) jpayne@69: #define AVOID_WIN32_FILEIO jpayne@69: #endif jpayne@69: #endif jpayne@69: jpayne@69: #if defined(USE_WIN32_FILEIO) jpayne@69: #define VC_EXTRALEAN jpayne@69: #include jpayne@69: #ifdef __WIN32__ jpayne@69: DECLARE_HANDLE(thandle_t); /* Win32 file handle */ jpayne@69: #else jpayne@69: typedef HFILE thandle_t; /* client data handle */ jpayne@69: #endif /* __WIN32__ */ jpayne@69: #else jpayne@69: typedef void *thandle_t; /* client data handle */ jpayne@69: #endif /* USE_WIN32_FILEIO */ jpayne@69: jpayne@69: /* jpayne@69: * Flags to pass to TIFFPrintDirectory to control jpayne@69: * printing of data structures that are potentially jpayne@69: * very large. Bit-or these flags to enable printing jpayne@69: * multiple items. jpayne@69: */ jpayne@69: #define TIFFPRINT_NONE 0x0 /* no extra info */ jpayne@69: #define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ jpayne@69: #define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ jpayne@69: #define TIFFPRINT_COLORMAP 0x4 /* colormap */ jpayne@69: #define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ jpayne@69: #define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ jpayne@69: #define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ jpayne@69: jpayne@69: /* jpayne@69: * Colour conversion stuff jpayne@69: */ jpayne@69: jpayne@69: /* reference white */ jpayne@69: #define D65_X0 (95.0470F) jpayne@69: #define D65_Y0 (100.0F) jpayne@69: #define D65_Z0 (108.8827F) jpayne@69: jpayne@69: #define D50_X0 (96.4250F) jpayne@69: #define D50_Y0 (100.0F) jpayne@69: #define D50_Z0 (82.4680F) jpayne@69: jpayne@69: /* Structure for holding information about a display device. */ jpayne@69: jpayne@69: typedef unsigned char TIFFRGBValue; /* 8-bit samples */ jpayne@69: jpayne@69: typedef struct jpayne@69: { jpayne@69: float d_mat[3][3]; /* XYZ -> luminance matrix */ jpayne@69: float d_YCR; /* Light o/p for reference white */ jpayne@69: float d_YCG; jpayne@69: float d_YCB; jpayne@69: uint32_t d_Vrwr; /* Pixel values for ref. white */ jpayne@69: uint32_t d_Vrwg; jpayne@69: uint32_t d_Vrwb; jpayne@69: float d_Y0R; /* Residual light for black pixel */ jpayne@69: float d_Y0G; jpayne@69: float d_Y0B; jpayne@69: float d_gammaR; /* Gamma values for the three guns */ jpayne@69: float d_gammaG; jpayne@69: float d_gammaB; jpayne@69: } TIFFDisplay; jpayne@69: jpayne@69: typedef struct jpayne@69: { /* YCbCr->RGB support */ jpayne@69: TIFFRGBValue *clamptab; /* range clamping table */ jpayne@69: int *Cr_r_tab; jpayne@69: int *Cb_b_tab; jpayne@69: int32_t *Cr_g_tab; jpayne@69: int32_t *Cb_g_tab; jpayne@69: int32_t *Y_tab; jpayne@69: } TIFFYCbCrToRGB; jpayne@69: jpayne@69: typedef struct jpayne@69: { /* CIE Lab 1976->RGB support */ jpayne@69: int range; /* Size of conversion table */ jpayne@69: #define CIELABTORGB_TABLE_RANGE 1500 jpayne@69: float rstep, gstep, bstep; jpayne@69: float X0, Y0, Z0; /* Reference white point */ jpayne@69: TIFFDisplay display; jpayne@69: float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */ jpayne@69: float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */ jpayne@69: float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */ jpayne@69: } TIFFCIELabToRGB; jpayne@69: jpayne@69: /* jpayne@69: * RGBA-style image support. jpayne@69: */ jpayne@69: typedef struct _TIFFRGBAImage TIFFRGBAImage; jpayne@69: /* jpayne@69: * The image reading and conversion routines invoke jpayne@69: * ``put routines'' to copy/image/whatever tiles of jpayne@69: * raw image data. A default set of routines are jpayne@69: * provided to convert/copy raw image data to 8-bit jpayne@69: * packed ABGR format rasters. Applications can supply jpayne@69: * alternate routines that unpack the data into a jpayne@69: * different format or, for example, unpack the data jpayne@69: * and draw the unpacked raster on the display. jpayne@69: */ jpayne@69: typedef void (*tileContigRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t, jpayne@69: uint32_t, uint32_t, uint32_t, int32_t, jpayne@69: int32_t, unsigned char *); jpayne@69: typedef void (*tileSeparateRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t, jpayne@69: uint32_t, uint32_t, uint32_t, int32_t, jpayne@69: int32_t, unsigned char *, unsigned char *, jpayne@69: unsigned char *, unsigned char *); jpayne@69: /* jpayne@69: * RGBA-reader state. jpayne@69: */ jpayne@69: struct _TIFFRGBAImage jpayne@69: { jpayne@69: TIFF *tif; /* image handle */ jpayne@69: int stoponerr; /* stop on read error */ jpayne@69: int isContig; /* data is packed/separate */ jpayne@69: int alpha; /* type of alpha data present */ jpayne@69: uint32_t width; /* image width */ jpayne@69: uint32_t height; /* image height */ jpayne@69: uint16_t bitspersample; /* image bits/sample */ jpayne@69: uint16_t samplesperpixel; /* image samples/pixel */ jpayne@69: uint16_t orientation; /* image orientation */ jpayne@69: uint16_t req_orientation; /* requested orientation */ jpayne@69: uint16_t photometric; /* image photometric interp */ jpayne@69: uint16_t *redcmap; /* colormap palette */ jpayne@69: uint16_t *greencmap; jpayne@69: uint16_t *bluecmap; jpayne@69: /* get image data routine */ jpayne@69: int (*get)(TIFFRGBAImage *, uint32_t *, uint32_t, uint32_t); jpayne@69: /* put decoded strip/tile */ jpayne@69: union jpayne@69: { jpayne@69: void (*any)(TIFFRGBAImage *); jpayne@69: tileContigRoutine contig; jpayne@69: tileSeparateRoutine separate; jpayne@69: } put; jpayne@69: TIFFRGBValue *Map; /* sample mapping array */ jpayne@69: uint32_t **BWmap; /* black&white map */ jpayne@69: uint32_t **PALmap; /* palette image map */ jpayne@69: TIFFYCbCrToRGB *ycbcr; /* YCbCr conversion state */ jpayne@69: TIFFCIELabToRGB *cielab; /* CIE L*a*b conversion state */ jpayne@69: jpayne@69: uint8_t *UaToAa; /* Unassociated alpha to associated alpha conversion LUT */ jpayne@69: uint8_t *Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */ jpayne@69: jpayne@69: int row_offset; jpayne@69: int col_offset; jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: * Macros for extracting components from the jpayne@69: * packed ABGR form returned by TIFFReadRGBAImage. jpayne@69: */ jpayne@69: #define TIFFGetR(abgr) ((abgr)&0xff) jpayne@69: #define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) jpayne@69: #define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) jpayne@69: #define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) jpayne@69: jpayne@69: /* jpayne@69: * A CODEC is a software package that implements decoding, jpayne@69: * encoding, or decoding+encoding of a compression algorithm. jpayne@69: * The library provides a collection of builtin codecs. jpayne@69: * More codecs may be registered through calls to the library jpayne@69: * and/or the builtin implementations may be overridden. jpayne@69: */ jpayne@69: typedef int (*TIFFInitMethod)(TIFF *, int); jpayne@69: typedef struct jpayne@69: { jpayne@69: char *name; jpayne@69: uint16_t scheme; jpayne@69: TIFFInitMethod init; jpayne@69: } TIFFCodec; jpayne@69: jpayne@69: #include jpayne@69: #include jpayne@69: jpayne@69: /* share internal LogLuv conversion routines? */ jpayne@69: #ifndef LOGLUV_PUBLIC jpayne@69: #define LOGLUV_PUBLIC 1 jpayne@69: #endif jpayne@69: jpayne@69: #if defined(__GNUC__) || defined(__attribute__) jpayne@69: #define TIFF_ATTRIBUTE(x) __attribute__(x) jpayne@69: #else jpayne@69: #define TIFF_ATTRIBUTE(x) /*nothing*/ jpayne@69: #endif jpayne@69: jpayne@69: #if defined(c_plusplus) || defined(__cplusplus) jpayne@69: extern "C" jpayne@69: { jpayne@69: #endif jpayne@69: typedef void (*TIFFErrorHandler)(const char *, const char *, va_list); jpayne@69: typedef void (*TIFFErrorHandlerExt)(thandle_t, const char *, const char *, jpayne@69: va_list); jpayne@69: typedef int (*TIFFErrorHandlerExtR)(TIFF *, void *user_data, const char *, jpayne@69: const char *, va_list); jpayne@69: typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void *, tmsize_t); jpayne@69: typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int); jpayne@69: typedef int (*TIFFCloseProc)(thandle_t); jpayne@69: typedef toff_t (*TIFFSizeProc)(thandle_t); jpayne@69: typedef int (*TIFFMapFileProc)(thandle_t, void **base, toff_t *size); jpayne@69: typedef void (*TIFFUnmapFileProc)(thandle_t, void *base, toff_t size); jpayne@69: typedef void (*TIFFExtendProc)(TIFF *); jpayne@69: jpayne@69: extern const char *TIFFGetVersion(void); jpayne@69: jpayne@69: extern const TIFFCodec *TIFFFindCODEC(uint16_t); jpayne@69: extern TIFFCodec *TIFFRegisterCODEC(uint16_t, const char *, TIFFInitMethod); jpayne@69: extern void TIFFUnRegisterCODEC(TIFFCodec *); jpayne@69: extern int TIFFIsCODECConfigured(uint16_t); jpayne@69: extern TIFFCodec *TIFFGetConfiguredCODECs(void); jpayne@69: jpayne@69: /* jpayne@69: * Auxiliary functions. jpayne@69: */ jpayne@69: jpayne@69: extern void *_TIFFmalloc(tmsize_t s); jpayne@69: extern void *_TIFFcalloc(tmsize_t nmemb, tmsize_t siz); jpayne@69: extern void *_TIFFrealloc(void *p, tmsize_t s); jpayne@69: extern void _TIFFmemset(void *p, int v, tmsize_t c); jpayne@69: extern void _TIFFmemcpy(void *d, const void *s, tmsize_t c); jpayne@69: extern int _TIFFmemcmp(const void *p1, const void *p2, tmsize_t c); jpayne@69: extern void _TIFFfree(void *p); jpayne@69: jpayne@69: /* jpayne@69: ** Stuff, related to tag handling and creating custom tags. jpayne@69: */ jpayne@69: extern int TIFFGetTagListCount(TIFF *); jpayne@69: extern uint32_t TIFFGetTagListEntry(TIFF *, int tag_index); jpayne@69: jpayne@69: #define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ jpayne@69: #define TIFF_VARIABLE -1 /* marker for variable length tags */ jpayne@69: #define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ jpayne@69: #define TIFF_VARIABLE2 -3 /* marker for uint32_t var-length tags */ jpayne@69: jpayne@69: #define FIELD_CUSTOM 65 jpayne@69: jpayne@69: typedef struct _TIFFField TIFFField; jpayne@69: typedef struct _TIFFFieldArray TIFFFieldArray; jpayne@69: jpayne@69: extern const TIFFField *TIFFFindField(TIFF *, uint32_t, TIFFDataType); jpayne@69: extern const TIFFField *TIFFFieldWithTag(TIFF *, uint32_t); jpayne@69: extern const TIFFField *TIFFFieldWithName(TIFF *, const char *); jpayne@69: jpayne@69: extern uint32_t TIFFFieldTag(const TIFFField *); jpayne@69: extern const char *TIFFFieldName(const TIFFField *); jpayne@69: extern TIFFDataType TIFFFieldDataType(const TIFFField *); jpayne@69: extern int TIFFFieldPassCount(const TIFFField *); jpayne@69: extern int TIFFFieldReadCount(const TIFFField *); jpayne@69: extern int TIFFFieldWriteCount(const TIFFField *); jpayne@69: extern int jpayne@69: TIFFFieldSetGetSize(const TIFFField *); /* returns internal storage size of jpayne@69: TIFFSetGetFieldType in bytes. */ jpayne@69: extern int TIFFFieldSetGetCountSize( jpayne@69: const TIFFField *); /* returns size of count parameter 0=none, jpayne@69: 2=uint16_t, 4=uint32_t */ jpayne@69: extern int TIFFFieldIsAnonymous(const TIFFField *); jpayne@69: jpayne@69: typedef int (*TIFFVSetMethod)(TIFF *, uint32_t, va_list); jpayne@69: typedef int (*TIFFVGetMethod)(TIFF *, uint32_t, va_list); jpayne@69: typedef void (*TIFFPrintMethod)(TIFF *, FILE *, long); jpayne@69: jpayne@69: typedef struct jpayne@69: { jpayne@69: TIFFVSetMethod vsetfield; /* tag set routine */ jpayne@69: TIFFVGetMethod vgetfield; /* tag get routine */ jpayne@69: TIFFPrintMethod printdir; /* directory print routine */ jpayne@69: } TIFFTagMethods; jpayne@69: jpayne@69: extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *); jpayne@69: extern void *TIFFGetClientInfo(TIFF *, const char *); jpayne@69: extern void TIFFSetClientInfo(TIFF *, void *, const char *); jpayne@69: jpayne@69: extern void TIFFCleanup(TIFF *tif); jpayne@69: extern void TIFFClose(TIFF *tif); jpayne@69: extern int TIFFFlush(TIFF *tif); jpayne@69: extern int TIFFFlushData(TIFF *tif); jpayne@69: extern int TIFFGetField(TIFF *tif, uint32_t tag, ...); jpayne@69: extern int TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap); jpayne@69: extern int TIFFGetFieldDefaulted(TIFF *tif, uint32_t tag, ...); jpayne@69: extern int TIFFVGetFieldDefaulted(TIFF *tif, uint32_t tag, va_list ap); jpayne@69: extern int TIFFReadDirectory(TIFF *tif); jpayne@69: extern int TIFFReadCustomDirectory(TIFF *tif, toff_t diroff, jpayne@69: const TIFFFieldArray *infoarray); jpayne@69: extern int TIFFReadEXIFDirectory(TIFF *tif, toff_t diroff); jpayne@69: extern int TIFFReadGPSDirectory(TIFF *tif, toff_t diroff); jpayne@69: extern uint64_t TIFFScanlineSize64(TIFF *tif); jpayne@69: extern tmsize_t TIFFScanlineSize(TIFF *tif); jpayne@69: extern uint64_t TIFFRasterScanlineSize64(TIFF *tif); jpayne@69: extern tmsize_t TIFFRasterScanlineSize(TIFF *tif); jpayne@69: extern uint64_t TIFFStripSize64(TIFF *tif); jpayne@69: extern tmsize_t TIFFStripSize(TIFF *tif); jpayne@69: extern uint64_t TIFFRawStripSize64(TIFF *tif, uint32_t strip); jpayne@69: extern tmsize_t TIFFRawStripSize(TIFF *tif, uint32_t strip); jpayne@69: extern uint64_t TIFFVStripSize64(TIFF *tif, uint32_t nrows); jpayne@69: extern tmsize_t TIFFVStripSize(TIFF *tif, uint32_t nrows); jpayne@69: extern uint64_t TIFFTileRowSize64(TIFF *tif); jpayne@69: extern tmsize_t TIFFTileRowSize(TIFF *tif); jpayne@69: extern uint64_t TIFFTileSize64(TIFF *tif); jpayne@69: extern tmsize_t TIFFTileSize(TIFF *tif); jpayne@69: extern uint64_t TIFFVTileSize64(TIFF *tif, uint32_t nrows); jpayne@69: extern tmsize_t TIFFVTileSize(TIFF *tif, uint32_t nrows); jpayne@69: extern uint32_t TIFFDefaultStripSize(TIFF *tif, uint32_t request); jpayne@69: extern void TIFFDefaultTileSize(TIFF *, uint32_t *, uint32_t *); jpayne@69: extern int TIFFFileno(TIFF *); jpayne@69: extern int TIFFSetFileno(TIFF *, int); jpayne@69: extern thandle_t TIFFClientdata(TIFF *); jpayne@69: extern thandle_t TIFFSetClientdata(TIFF *, thandle_t); jpayne@69: extern int TIFFGetMode(TIFF *); jpayne@69: extern int TIFFSetMode(TIFF *, int); jpayne@69: extern int TIFFIsTiled(TIFF *); jpayne@69: extern int TIFFIsByteSwapped(TIFF *); jpayne@69: extern int TIFFIsUpSampled(TIFF *); jpayne@69: extern int TIFFIsMSB2LSB(TIFF *); jpayne@69: extern int TIFFIsBigEndian(TIFF *); jpayne@69: extern int TIFFIsBigTIFF(TIFF *); jpayne@69: extern TIFFReadWriteProc TIFFGetReadProc(TIFF *); jpayne@69: extern TIFFReadWriteProc TIFFGetWriteProc(TIFF *); jpayne@69: extern TIFFSeekProc TIFFGetSeekProc(TIFF *); jpayne@69: extern TIFFCloseProc TIFFGetCloseProc(TIFF *); jpayne@69: extern TIFFSizeProc TIFFGetSizeProc(TIFF *); jpayne@69: extern TIFFMapFileProc TIFFGetMapFileProc(TIFF *); jpayne@69: extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF *); jpayne@69: extern uint32_t TIFFCurrentRow(TIFF *); jpayne@69: extern tdir_t TIFFCurrentDirectory(TIFF *); jpayne@69: extern tdir_t TIFFNumberOfDirectories(TIFF *); jpayne@69: extern uint64_t TIFFCurrentDirOffset(TIFF *); jpayne@69: extern uint32_t TIFFCurrentStrip(TIFF *); jpayne@69: extern uint32_t TIFFCurrentTile(TIFF *tif); jpayne@69: extern int TIFFReadBufferSetup(TIFF *tif, void *bp, tmsize_t size); jpayne@69: extern int TIFFWriteBufferSetup(TIFF *tif, void *bp, tmsize_t size); jpayne@69: extern int TIFFSetupStrips(TIFF *); jpayne@69: extern int TIFFWriteCheck(TIFF *, int, const char *); jpayne@69: extern void TIFFFreeDirectory(TIFF *); jpayne@69: extern int TIFFCreateDirectory(TIFF *); jpayne@69: extern int TIFFCreateCustomDirectory(TIFF *, const TIFFFieldArray *); jpayne@69: extern int TIFFCreateEXIFDirectory(TIFF *); jpayne@69: extern int TIFFCreateGPSDirectory(TIFF *); jpayne@69: extern int TIFFLastDirectory(TIFF *); jpayne@69: extern int TIFFSetDirectory(TIFF *, tdir_t); jpayne@69: extern int TIFFSetSubDirectory(TIFF *, uint64_t); jpayne@69: extern int TIFFUnlinkDirectory(TIFF *, tdir_t); jpayne@69: extern int TIFFSetField(TIFF *, uint32_t, ...); jpayne@69: extern int TIFFVSetField(TIFF *, uint32_t, va_list); jpayne@69: extern int TIFFUnsetField(TIFF *, uint32_t); jpayne@69: extern int TIFFWriteDirectory(TIFF *); jpayne@69: extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *); jpayne@69: extern int TIFFCheckpointDirectory(TIFF *); jpayne@69: extern int TIFFRewriteDirectory(TIFF *); jpayne@69: extern int TIFFDeferStrileArrayWriting(TIFF *); jpayne@69: extern int TIFFForceStrileArrayWriting(TIFF *); jpayne@69: jpayne@69: #if defined(c_plusplus) || defined(__cplusplus) jpayne@69: extern void TIFFPrintDirectory(TIFF *, FILE *, long = 0); jpayne@69: extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row, jpayne@69: uint16_t sample = 0); jpayne@69: extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row, jpayne@69: uint16_t sample = 0); jpayne@69: extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *, jpayne@69: int = 0); jpayne@69: extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *, jpayne@69: int = ORIENTATION_BOTLEFT, int = 0); jpayne@69: #else jpayne@69: extern void TIFFPrintDirectory(TIFF *, FILE *, long); jpayne@69: extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row, jpayne@69: uint16_t sample); jpayne@69: extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row, jpayne@69: uint16_t sample); jpayne@69: extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *, int); jpayne@69: extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *, jpayne@69: int, int); jpayne@69: #endif jpayne@69: jpayne@69: extern int TIFFReadRGBAStrip(TIFF *, uint32_t, uint32_t *); jpayne@69: extern int TIFFReadRGBATile(TIFF *, uint32_t, uint32_t, uint32_t *); jpayne@69: extern int TIFFReadRGBAStripExt(TIFF *, uint32_t, uint32_t *, jpayne@69: int stop_on_error); jpayne@69: extern int TIFFReadRGBATileExt(TIFF *, uint32_t, uint32_t, uint32_t *, jpayne@69: int stop_on_error); jpayne@69: extern int TIFFRGBAImageOK(TIFF *, char[1024]); jpayne@69: extern int TIFFRGBAImageBegin(TIFFRGBAImage *, TIFF *, int, char[1024]); jpayne@69: extern int TIFFRGBAImageGet(TIFFRGBAImage *, uint32_t *, uint32_t, jpayne@69: uint32_t); jpayne@69: extern void TIFFRGBAImageEnd(TIFFRGBAImage *); jpayne@69: jpayne@69: extern const char *TIFFFileName(TIFF *); jpayne@69: extern const char *TIFFSetFileName(TIFF *, const char *); jpayne@69: extern void TIFFError(const char *, const char *, ...) jpayne@69: TIFF_ATTRIBUTE((__format__(__printf__, 2, 3))); jpayne@69: extern void TIFFErrorExt(thandle_t, const char *, const char *, ...) jpayne@69: TIFF_ATTRIBUTE((__format__(__printf__, 3, 4))); jpayne@69: extern void TIFFWarning(const char *, const char *, ...) jpayne@69: TIFF_ATTRIBUTE((__format__(__printf__, 2, 3))); jpayne@69: extern void TIFFWarningExt(thandle_t, const char *, const char *, ...) jpayne@69: TIFF_ATTRIBUTE((__format__(__printf__, 3, 4))); jpayne@69: extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler); jpayne@69: extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt); jpayne@69: extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); jpayne@69: extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); jpayne@69: jpayne@69: extern void TIFFWarningExtR(TIFF *, const char *, const char *, ...) jpayne@69: TIFF_ATTRIBUTE((__format__(__printf__, 3, 4))); jpayne@69: extern void TIFFErrorExtR(TIFF *, const char *, const char *, ...) jpayne@69: TIFF_ATTRIBUTE((__format__(__printf__, 3, 4))); jpayne@69: jpayne@69: typedef struct TIFFOpenOptions TIFFOpenOptions; jpayne@69: extern TIFFOpenOptions *TIFFOpenOptionsAlloc(void); jpayne@69: extern void TIFFOpenOptionsFree(TIFFOpenOptions *); jpayne@69: extern void jpayne@69: TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts, jpayne@69: tmsize_t max_single_mem_alloc); jpayne@69: extern void jpayne@69: TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts, jpayne@69: TIFFErrorHandlerExtR handler, jpayne@69: void *errorhandler_user_data); jpayne@69: extern void jpayne@69: TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions *opts, jpayne@69: TIFFErrorHandlerExtR handler, jpayne@69: void *warnhandler_user_data); jpayne@69: jpayne@69: extern TIFF *TIFFOpen(const char *, const char *); jpayne@69: extern TIFF *TIFFOpenExt(const char *, const char *, TIFFOpenOptions *opts); jpayne@69: #ifdef __WIN32__ jpayne@69: extern TIFF *TIFFOpenW(const wchar_t *, const char *); jpayne@69: extern TIFF *TIFFOpenWExt(const wchar_t *, const char *, jpayne@69: TIFFOpenOptions *opts); jpayne@69: #endif /* __WIN32__ */ jpayne@69: extern TIFF *TIFFFdOpen(int, const char *, const char *); jpayne@69: extern TIFF *TIFFFdOpenExt(int, const char *, const char *, jpayne@69: TIFFOpenOptions *opts); jpayne@69: extern TIFF *TIFFClientOpen(const char *, const char *, thandle_t, jpayne@69: TIFFReadWriteProc, TIFFReadWriteProc, jpayne@69: TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, jpayne@69: TIFFMapFileProc, TIFFUnmapFileProc); jpayne@69: extern TIFF *TIFFClientOpenExt(const char *, const char *, thandle_t, jpayne@69: TIFFReadWriteProc, TIFFReadWriteProc, jpayne@69: TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, jpayne@69: TIFFMapFileProc, TIFFUnmapFileProc, jpayne@69: TIFFOpenOptions *opts); jpayne@69: extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); jpayne@69: extern uint32_t TIFFComputeTile(TIFF *tif, uint32_t x, uint32_t y, jpayne@69: uint32_t z, uint16_t s); jpayne@69: extern int TIFFCheckTile(TIFF *tif, uint32_t x, uint32_t y, uint32_t z, jpayne@69: uint16_t s); jpayne@69: extern uint32_t TIFFNumberOfTiles(TIFF *); jpayne@69: extern tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32_t x, uint32_t y, jpayne@69: uint32_t z, uint16_t s); jpayne@69: extern tmsize_t TIFFWriteTile(TIFF *tif, void *buf, uint32_t x, uint32_t y, jpayne@69: uint32_t z, uint16_t s); jpayne@69: extern uint32_t TIFFComputeStrip(TIFF *, uint32_t, uint16_t); jpayne@69: extern uint32_t TIFFNumberOfStrips(TIFF *); jpayne@69: extern tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32_t strip, void *buf, jpayne@69: tmsize_t size); jpayne@69: extern tmsize_t TIFFReadRawStrip(TIFF *tif, uint32_t strip, void *buf, jpayne@69: tmsize_t size); jpayne@69: extern tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32_t tile, void *buf, jpayne@69: tmsize_t size); jpayne@69: extern tmsize_t TIFFReadRawTile(TIFF *tif, uint32_t tile, void *buf, jpayne@69: tmsize_t size); jpayne@69: extern int TIFFReadFromUserBuffer(TIFF *tif, uint32_t strile, void *inbuf, jpayne@69: tmsize_t insize, void *outbuf, jpayne@69: tmsize_t outsize); jpayne@69: extern tmsize_t TIFFWriteEncodedStrip(TIFF *tif, uint32_t strip, void *data, jpayne@69: tmsize_t cc); jpayne@69: extern tmsize_t TIFFWriteRawStrip(TIFF *tif, uint32_t strip, void *data, jpayne@69: tmsize_t cc); jpayne@69: extern tmsize_t TIFFWriteEncodedTile(TIFF *tif, uint32_t tile, void *data, jpayne@69: tmsize_t cc); jpayne@69: extern tmsize_t TIFFWriteRawTile(TIFF *tif, uint32_t tile, void *data, jpayne@69: tmsize_t cc); jpayne@69: extern int TIFFDataWidth( jpayne@69: TIFFDataType); /* table of tag datatype widths within TIFF file. */ jpayne@69: extern void TIFFSetWriteOffset(TIFF *tif, toff_t off); jpayne@69: extern void TIFFSwabShort(uint16_t *); jpayne@69: extern void TIFFSwabLong(uint32_t *); jpayne@69: extern void TIFFSwabLong8(uint64_t *); jpayne@69: extern void TIFFSwabFloat(float *); jpayne@69: extern void TIFFSwabDouble(double *); jpayne@69: extern void TIFFSwabArrayOfShort(uint16_t *wp, tmsize_t n); jpayne@69: extern void TIFFSwabArrayOfTriples(uint8_t *tp, tmsize_t n); jpayne@69: extern void TIFFSwabArrayOfLong(uint32_t *lp, tmsize_t n); jpayne@69: extern void TIFFSwabArrayOfLong8(uint64_t *lp, tmsize_t n); jpayne@69: extern void TIFFSwabArrayOfFloat(float *fp, tmsize_t n); jpayne@69: extern void TIFFSwabArrayOfDouble(double *dp, tmsize_t n); jpayne@69: extern void TIFFReverseBits(uint8_t *cp, tmsize_t n); jpayne@69: extern const unsigned char *TIFFGetBitRevTable(int); jpayne@69: jpayne@69: extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile); jpayne@69: extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile); jpayne@69: extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile, jpayne@69: int *pbErr); jpayne@69: extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile, jpayne@69: int *pbErr); jpayne@69: jpayne@69: #ifdef LOGLUV_PUBLIC jpayne@69: #define U_NEU 0.210526316 jpayne@69: #define V_NEU 0.473684211 jpayne@69: #define UVSCALE 410. jpayne@69: extern double LogL16toY(int); jpayne@69: extern double LogL10toY(int); jpayne@69: extern void XYZtoRGB24(float *, uint8_t *); jpayne@69: extern int uv_decode(double *, double *, int); jpayne@69: extern void LogLuv24toXYZ(uint32_t, float *); jpayne@69: extern void LogLuv32toXYZ(uint32_t, float *); jpayne@69: #if defined(c_plusplus) || defined(__cplusplus) jpayne@69: extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER); jpayne@69: extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER); jpayne@69: extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER); jpayne@69: extern uint32_t LogLuv24fromXYZ(float *, int = SGILOGENCODE_NODITHER); jpayne@69: extern uint32_t LogLuv32fromXYZ(float *, int = SGILOGENCODE_NODITHER); jpayne@69: #else jpayne@69: extern int LogL16fromY(double, int); jpayne@69: extern int LogL10fromY(double, int); jpayne@69: extern int uv_encode(double, double, int); jpayne@69: extern uint32_t LogLuv24fromXYZ(float *, int); jpayne@69: extern uint32_t LogLuv32fromXYZ(float *, int); jpayne@69: #endif jpayne@69: #endif /* LOGLUV_PUBLIC */ jpayne@69: jpayne@69: extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB *, const TIFFDisplay *, jpayne@69: float *); jpayne@69: extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32_t, int32_t, int32_t, jpayne@69: float *, float *, float *); jpayne@69: extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, uint32_t *, jpayne@69: uint32_t *, uint32_t *); jpayne@69: jpayne@69: extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *, float *, float *); jpayne@69: extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t, jpayne@69: uint32_t *, uint32_t *, uint32_t *); jpayne@69: jpayne@69: /**************************************************************************** jpayne@69: * O B S O L E T E D I N T E R F A C E S jpayne@69: * jpayne@69: * Don't use this stuff in your applications, it may be removed in the jpayne@69: *future libtiff versions. jpayne@69: ****************************************************************************/ jpayne@69: typedef struct jpayne@69: { jpayne@69: ttag_t field_tag; /* field's tag */ jpayne@69: short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */ jpayne@69: short field_writecount; /* write count/TIFF_VARIABLE */ jpayne@69: TIFFDataType field_type; /* type of associated data */ jpayne@69: unsigned short field_bit; /* bit in fieldsset bit vector */ jpayne@69: unsigned char field_oktochange; /* if true, can change while writing */ jpayne@69: unsigned char field_passcount; /* if true, pass dir count on set */ jpayne@69: char *field_name; /* ASCII name */ jpayne@69: } TIFFFieldInfo; jpayne@69: jpayne@69: extern int TIFFMergeFieldInfo(TIFF *, const TIFFFieldInfo[], uint32_t); jpayne@69: jpayne@69: #if defined(c_plusplus) || defined(__cplusplus) jpayne@69: } jpayne@69: #endif jpayne@69: jpayne@69: #endif /* _TIFFIO_ */