1 /* 2 * Copyright (c) 1988-1997 Sam Leffler 3 * Copyright (c) 1991-1997 Silicon Graphics, Inc. 4 * 5 * Permission to use, copy, modify, distribute, and sell this software and 6 * its documentation for any purpose is hereby granted without fee, provided 7 * that (i) the above copyright notices and this permission notice appear in 8 * all copies of the software and related documentation, and (ii) the names of 9 * Sam Leffler and Silicon Graphics may not be used in any advertising or 10 * publicity relating to the software without the specific, prior written 11 * permission of Sam Leffler and Silicon Graphics. 12 * 13 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 14 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 15 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 16 * 17 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 18 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 19 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 20 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 21 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 22 * OF THIS SOFTWARE. 23 */ 24 25 #ifndef _TIFFIO_ 26 #define _TIFFIO_ 27 28 /* 29 * TIFF I/O Library Definitions. 30 */ 31 #include "tiff.h" 32 #include "tiffvers.h" 33 34 /* 35 * TIFF is defined as an incomplete type to hide the 36 * library's internal data structures from clients. 37 */ 38 typedef struct tiff TIFF; 39 40 /* 41 * The following typedefs define the intrinsic size of 42 * data types used in the *exported* interfaces. These 43 * definitions depend on the proper definition of types 44 * in tiff.h. Note also that the varargs interface used 45 * to pass tag types and values uses the types defined in 46 * tiff.h directly. 47 * 48 * NB: ttag_t is unsigned int and not unsigned short because 49 * ANSI C requires that the type before the ellipsis be a 50 * promoted type (i.e. one of int, unsigned int, pointer, 51 * or double) and because we defined pseudo-tags that are 52 * outside the range of legal Aldus-assigned tags. 53 * NB: tsize_t is signed and not unsigned because some functions 54 * return -1. 55 * NB: toff_t is not off_t for many reasons; TIFFs max out at 56 * 32-bit file offsets, and BigTIFF maxes out at 64-bit 57 * offsets being the most important, and to ensure use of 58 * a consistently unsigned type across architectures. 59 * Prior to libtiff 4.0, this was an unsigned 32 bit type. 60 */ 61 /* 62 * this is the machine addressing size type, only it's signed, so make it 63 * int32 on 32bit machines, int64 on 64bit machines 64 */ 65 typedef TIFF_SSIZE_T tmsize_t; 66 typedef uint64 toff_t; /* file offset */ 67 /* the following are deprecated and should be replaced by their defining 68 counterparts */ 69 typedef uint32 ttag_t; /* directory tag */ 70 typedef uint16 tdir_t; /* directory index */ 71 typedef uint16 tsample_t; /* sample number */ 72 typedef uint32 tstrile_t; /* strip or tile number */ 73 typedef tstrile_t tstrip_t; /* strip number */ 74 typedef tstrile_t ttile_t; /* tile number */ 75 typedef tmsize_t tsize_t; /* i/o size in bytes */ 76 typedef void* tdata_t; /* image data ref */ 77 78 #if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32)) 79 #define __WIN32__ 80 #endif 81 82 /* 83 * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c 84 * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c). 85 * 86 * By default tif_unix.c is assumed. 87 */ 88 89 #if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) 90 # if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO) 91 # define AVOID_WIN32_FILEIO 92 # endif 93 #endif 94 95 #if defined(USE_WIN32_FILEIO) 96 # define VC_EXTRALEAN 97 # include <windows.h> 98 # ifdef __WIN32__ 99 DECLARE_HANDLE(thandle_t); /* Win32 file handle */ 100 # else 101 typedef HFILE thandle_t; /* client data handle */ 102 # endif /* __WIN32__ */ 103 #else 104 typedef void* thandle_t; /* client data handle */ 105 #endif /* USE_WIN32_FILEIO */ 106 107 /* 108 * Flags to pass to TIFFPrintDirectory to control 109 * printing of data structures that are potentially 110 * very large. Bit-or these flags to enable printing 111 * multiple items. 112 */ 113 #define TIFFPRINT_NONE 0x0 /* no extra info */ 114 #define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ 115 #define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ 116 #define TIFFPRINT_COLORMAP 0x4 /* colormap */ 117 #define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ 118 #define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ 119 #define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ 120 121 /* 122 * Colour conversion stuff 123 */ 124 125 /* reference white */ 126 #define D65_X0 (95.0470F) 127 #define D65_Y0 (100.0F) 128 #define D65_Z0 (108.8827F) 129 130 #define D50_X0 (96.4250F) 131 #define D50_Y0 (100.0F) 132 #define D50_Z0 (82.4680F) 133 134 /* Structure for holding information about a display device. */ 135 136 typedef unsigned char TIFFRGBValue; /* 8-bit samples */ 137 138 typedef struct { 139 float d_mat[3][3]; /* XYZ -> luminance matrix */ 140 float d_YCR; /* Light o/p for reference white */ 141 float d_YCG; 142 float d_YCB; 143 uint32 d_Vrwr; /* Pixel values for ref. white */ 144 uint32 d_Vrwg; 145 uint32 d_Vrwb; 146 float d_Y0R; /* Residual light for black pixel */ 147 float d_Y0G; 148 float d_Y0B; 149 float d_gammaR; /* Gamma values for the three guns */ 150 float d_gammaG; 151 float d_gammaB; 152 } TIFFDisplay; 153 154 typedef struct { /* YCbCr->RGB support */ 155 TIFFRGBValue* clamptab; /* range clamping table */ 156 int* Cr_r_tab; 157 int* Cb_b_tab; 158 int32* Cr_g_tab; 159 int32* Cb_g_tab; 160 int32* Y_tab; 161 } TIFFYCbCrToRGB; 162 163 typedef struct { /* CIE Lab 1976->RGB support */ 164 int range; /* Size of conversion table */ 165 #define CIELABTORGB_TABLE_RANGE 1500 166 float rstep, gstep, bstep; 167 float X0, Y0, Z0; /* Reference white point */ 168 TIFFDisplay display; 169 float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */ 170 float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */ 171 float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */ 172 } TIFFCIELabToRGB; 173 174 /* 175 * RGBA-style image support. 176 */ 177 typedef struct _TIFFRGBAImage TIFFRGBAImage; 178 /* 179 * The image reading and conversion routines invoke 180 * ``put routines'' to copy/image/whatever tiles of 181 * raw image data. A default set of routines are 182 * provided to convert/copy raw image data to 8-bit 183 * packed ABGR format rasters. Applications can supply 184 * alternate routines that unpack the data into a 185 * different format or, for example, unpack the data 186 * and draw the unpacked raster on the display. 187 */ 188 typedef void (*tileContigRoutine) 189 (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, 190 unsigned char*); 191 typedef void (*tileSeparateRoutine) 192 (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, 193 unsigned char*, unsigned char*, unsigned char*, unsigned char*); 194 /* 195 * RGBA-reader state. 196 */ 197 struct _TIFFRGBAImage { 198 TIFF* tif; /* image handle */ 199 int stoponerr; /* stop on read error */ 200 int isContig; /* data is packed/separate */ 201 int alpha; /* type of alpha data present */ 202 uint32 width; /* image width */ 203 uint32 height; /* image height */ 204 uint16 bitspersample; /* image bits/sample */ 205 uint16 samplesperpixel; /* image samples/pixel */ 206 uint16 orientation; /* image orientation */ 207 uint16 req_orientation; /* requested orientation */ 208 uint16 photometric; /* image photometric interp */ 209 uint16* redcmap; /* colormap palette */ 210 uint16* greencmap; 211 uint16* bluecmap; 212 /* get image data routine */ 213 int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32); 214 /* put decoded strip/tile */ 215 union { 216 void (*any)(TIFFRGBAImage*); 217 tileContigRoutine contig; 218 tileSeparateRoutine separate; 219 } put; 220 TIFFRGBValue* Map; /* sample mapping array */ 221 uint32** BWmap; /* black&white map */ 222 uint32** PALmap; /* palette image map */ 223 TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */ 224 TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */ 225 226 uint8* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */ 227 uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */ 228 229 int row_offset; 230 int col_offset; 231 }; 232 233 /* 234 * Macros for extracting components from the 235 * packed ABGR form returned by TIFFReadRGBAImage. 236 */ 237 #define TIFFGetR(abgr) ((abgr) & 0xff) 238 #define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) 239 #define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) 240 #define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) 241 242 /* 243 * A CODEC is a software package that implements decoding, 244 * encoding, or decoding+encoding of a compression algorithm. 245 * The library provides a collection of builtin codecs. 246 * More codecs may be registered through calls to the library 247 * and/or the builtin implementations may be overridden. 248 */ 249 typedef int (*TIFFInitMethod)(TIFF*, int); 250 typedef struct { 251 char* name; 252 uint16 scheme; 253 TIFFInitMethod init; 254 } TIFFCodec; 255 256 #include <stdio.h> 257 #include <stdarg.h> 258 259 /* share internal LogLuv conversion routines? */ 260 #ifndef LOGLUV_PUBLIC 261 #define LOGLUV_PUBLIC 1 262 #endif 263 264 #if defined(__GNUC__) || defined(__attribute__) 265 # define TIFF_ATTRIBUTE(x) __attribute__(x) 266 #else 267 # define TIFF_ATTRIBUTE(x) /*nothing*/ 268 #endif 269 270 #if defined(c_plusplus) || defined(__cplusplus) 271 extern "C" { 272 #endif 273 typedef void (*TIFFErrorHandler)(const char*, const char*, va_list); 274 typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list); 275 typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t); 276 typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int); 277 typedef int (*TIFFCloseProc)(thandle_t); 278 typedef toff_t (*TIFFSizeProc)(thandle_t); 279 typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size); 280 typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size); 281 typedef void (*TIFFExtendProc)(TIFF*); 282 283 extern const char* TIFFGetVersion(void); 284 285 extern const TIFFCodec* TIFFFindCODEC(uint16); 286 extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod); 287 extern void TIFFUnRegisterCODEC(TIFFCodec*); 288 extern int TIFFIsCODECConfigured(uint16); 289 extern TIFFCodec* TIFFGetConfiguredCODECs(void); 290 291 /* 292 * Auxiliary functions. 293 */ 294 295 extern void* _TIFFmalloc(tmsize_t s); 296 extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz); 297 extern void* _TIFFrealloc(void* p, tmsize_t s); 298 extern void _TIFFmemset(void* p, int v, tmsize_t c); 299 extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c); 300 extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c); 301 extern void _TIFFfree(void* p); 302 303 /* 304 ** Stuff, related to tag handling and creating custom tags. 305 */ 306 extern int TIFFGetTagListCount( TIFF * ); 307 extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index ); 308 309 #define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ 310 #define TIFF_VARIABLE -1 /* marker for variable length tags */ 311 #define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ 312 #define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */ 313 314 #define FIELD_CUSTOM 65 315 316 typedef struct _TIFFField TIFFField; 317 typedef struct _TIFFFieldArray TIFFFieldArray; 318 319 extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType); 320 extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); 321 extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); 322 323 extern uint32 TIFFFieldTag(const TIFFField*); 324 extern const char* TIFFFieldName(const TIFFField*); 325 extern TIFFDataType TIFFFieldDataType(const TIFFField*); 326 extern int TIFFFieldPassCount(const TIFFField*); 327 extern int TIFFFieldReadCount(const TIFFField*); 328 extern int TIFFFieldWriteCount(const TIFFField*); 329 330 typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list); 331 typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list); 332 typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long); 333 334 typedef struct { 335 TIFFVSetMethod vsetfield; /* tag set routine */ 336 TIFFVGetMethod vgetfield; /* tag get routine */ 337 TIFFPrintMethod printdir; /* directory print routine */ 338 } TIFFTagMethods; 339 340 extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *); 341 extern void *TIFFGetClientInfo(TIFF *, const char *); 342 extern void TIFFSetClientInfo(TIFF *, void *, const char *); 343 344 extern void TIFFCleanup(TIFF* tif); 345 extern void TIFFClose(TIFF* tif); 346 extern int TIFFFlush(TIFF* tif); 347 extern int TIFFFlushData(TIFF* tif); 348 extern int TIFFGetField(TIFF* tif, uint32 tag, ...); 349 extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap); 350 extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...); 351 extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap); 352 extern int TIFFReadDirectory(TIFF* tif); 353 extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray); 354 extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff); 355 extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff); 356 extern uint64 TIFFScanlineSize64(TIFF* tif); 357 extern tmsize_t TIFFScanlineSize(TIFF* tif); 358 extern uint64 TIFFRasterScanlineSize64(TIFF* tif); 359 extern tmsize_t TIFFRasterScanlineSize(TIFF* tif); 360 extern uint64 TIFFStripSize64(TIFF* tif); 361 extern tmsize_t TIFFStripSize(TIFF* tif); 362 extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip); 363 extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip); 364 extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows); 365 extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows); 366 extern uint64 TIFFTileRowSize64(TIFF* tif); 367 extern tmsize_t TIFFTileRowSize(TIFF* tif); 368 extern uint64 TIFFTileSize64(TIFF* tif); 369 extern tmsize_t TIFFTileSize(TIFF* tif); 370 extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows); 371 extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows); 372 extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request); 373 extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*); 374 extern int TIFFFileno(TIFF*); 375 extern int TIFFSetFileno(TIFF*, int); 376 extern thandle_t TIFFClientdata(TIFF*); 377 extern thandle_t TIFFSetClientdata(TIFF*, thandle_t); 378 extern int TIFFGetMode(TIFF*); 379 extern int TIFFSetMode(TIFF*, int); 380 extern int TIFFIsTiled(TIFF*); 381 extern int TIFFIsByteSwapped(TIFF*); 382 extern int TIFFIsUpSampled(TIFF*); 383 extern int TIFFIsMSB2LSB(TIFF*); 384 extern int TIFFIsBigEndian(TIFF*); 385 extern TIFFReadWriteProc TIFFGetReadProc(TIFF*); 386 extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*); 387 extern TIFFSeekProc TIFFGetSeekProc(TIFF*); 388 extern TIFFCloseProc TIFFGetCloseProc(TIFF*); 389 extern TIFFSizeProc TIFFGetSizeProc(TIFF*); 390 extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*); 391 extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*); 392 extern uint32 TIFFCurrentRow(TIFF*); 393 extern uint16 TIFFCurrentDirectory(TIFF*); 394 extern uint16 TIFFNumberOfDirectories(TIFF*); 395 extern uint64 TIFFCurrentDirOffset(TIFF*); 396 extern uint32 TIFFCurrentStrip(TIFF*); 397 extern uint32 TIFFCurrentTile(TIFF* tif); 398 extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size); 399 extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size); 400 extern int TIFFSetupStrips(TIFF *); 401 extern int TIFFWriteCheck(TIFF*, int, const char *); 402 extern void TIFFFreeDirectory(TIFF*); 403 extern int TIFFCreateDirectory(TIFF*); 404 extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*); 405 extern int TIFFCreateEXIFDirectory(TIFF*); 406 extern int TIFFCreateGPSDirectory(TIFF*); 407 extern int TIFFLastDirectory(TIFF*); 408 extern int TIFFSetDirectory(TIFF*, uint16); 409 extern int TIFFSetSubDirectory(TIFF*, uint64); 410 extern int TIFFUnlinkDirectory(TIFF*, uint16); 411 extern int TIFFSetField(TIFF*, uint32, ...); 412 extern int TIFFVSetField(TIFF*, uint32, va_list); 413 extern int TIFFUnsetField(TIFF*, uint32); 414 extern int TIFFWriteDirectory(TIFF *); 415 extern int TIFFWriteCustomDirectory(TIFF *, uint64 *); 416 extern int TIFFCheckpointDirectory(TIFF *); 417 extern int TIFFRewriteDirectory(TIFF *); 418 extern int TIFFDeferStrileArrayWriting(TIFF *); 419 extern int TIFFForceStrileArrayWriting(TIFF* ); 420 421 #if defined(c_plusplus) || defined(__cplusplus) 422 extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); 423 extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); 424 extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); 425 extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0); 426 extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, 427 int = ORIENTATION_BOTLEFT, int = 0); 428 #else 429 extern void TIFFPrintDirectory(TIFF*, FILE*, long); 430 extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); 431 extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); 432 extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int); 433 extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int); 434 #endif 435 436 extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * ); 437 extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * ); 438 extern int TIFFReadRGBAStripExt(TIFF*, uint32, uint32 *, int stop_on_error ); 439 extern int TIFFReadRGBATileExt(TIFF*, uint32, uint32, uint32 *, int stop_on_error ); 440 extern int TIFFRGBAImageOK(TIFF*, char [1024]); 441 extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]); 442 extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32); 443 extern void TIFFRGBAImageEnd(TIFFRGBAImage*); 444 extern TIFF* TIFFOpen(const char*, const char*); 445 # ifdef __WIN32__ 446 extern TIFF* TIFFOpenW(const wchar_t*, const char*); 447 # endif /* __WIN32__ */ 448 extern TIFF* TIFFFdOpen(int, const char*, const char*); 449 extern TIFF* TIFFClientOpen(const char*, const char*, 450 thandle_t, 451 TIFFReadWriteProc, TIFFReadWriteProc, 452 TIFFSeekProc, TIFFCloseProc, 453 TIFFSizeProc, 454 TIFFMapFileProc, TIFFUnmapFileProc); 455 extern const char* TIFFFileName(TIFF*); 456 extern const char* TIFFSetFileName(TIFF*, const char *); 457 extern void TIFFError(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3))); 458 extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4))); 459 extern void TIFFWarning(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3))); 460 extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4))); 461 extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler); 462 extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt); 463 extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); 464 extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); 465 extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); 466 extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); 467 extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); 468 extern uint32 TIFFNumberOfTiles(TIFF*); 469 extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); 470 extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); 471 extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16); 472 extern uint32 TIFFNumberOfStrips(TIFF*); 473 extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); 474 extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); 475 extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); 476 extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); 477 extern int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile, 478 void* inbuf, tmsize_t insize, 479 void* outbuf, tmsize_t outsize); 480 extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); 481 extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); 482 extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); 483 extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); 484 extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */ 485 extern void TIFFSetWriteOffset(TIFF* tif, toff_t off); 486 extern void TIFFSwabShort(uint16*); 487 extern void TIFFSwabLong(uint32*); 488 extern void TIFFSwabLong8(uint64*); 489 extern void TIFFSwabFloat(float*); 490 extern void TIFFSwabDouble(double*); 491 extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n); 492 extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n); 493 extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n); 494 extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n); 495 extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n); 496 extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n); 497 extern void TIFFReverseBits(uint8* cp, tmsize_t n); 498 extern const unsigned char* TIFFGetBitRevTable(int); 499 500 extern uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile); 501 extern uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile); 502 extern uint64 TIFFGetStrileOffsetWithErr(TIFF *tif, uint32 strile, int *pbErr); 503 extern uint64 TIFFGetStrileByteCountWithErr(TIFF *tif, uint32 strile, int *pbErr); 504 505 #ifdef LOGLUV_PUBLIC 506 #define U_NEU 0.210526316 507 #define V_NEU 0.473684211 508 #define UVSCALE 410. 509 extern double LogL16toY(int); 510 extern double LogL10toY(int); 511 extern void XYZtoRGB24(float*, uint8*); 512 extern int uv_decode(double*, double*, int); 513 extern void LogLuv24toXYZ(uint32, float*); 514 extern void LogLuv32toXYZ(uint32, float*); 515 #if defined(c_plusplus) || defined(__cplusplus) 516 extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER); 517 extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER); 518 extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER); 519 extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER); 520 extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER); 521 #else 522 extern int LogL16fromY(double, int); 523 extern int LogL10fromY(double, int); 524 extern int uv_encode(double, double, int); 525 extern uint32 LogLuv24fromXYZ(float*, int); 526 extern uint32 LogLuv32fromXYZ(float*, int); 527 #endif 528 #endif /* LOGLUV_PUBLIC */ 529 530 extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*); 531 extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32, 532 float *, float *, float *); 533 extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, 534 uint32 *, uint32 *, uint32 *); 535 536 extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); 537 extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, 538 uint32 *, uint32 *, uint32 *); 539 540 /**************************************************************************** 541 * O B S O L E T E D I N T E R F A C E S 542 * 543 * Don't use this stuff in your applications, it may be removed in the future 544 * libtiff versions. 545 ****************************************************************************/ 546 typedef struct { 547 ttag_t field_tag; /* field's tag */ 548 short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */ 549 short field_writecount; /* write count/TIFF_VARIABLE */ 550 TIFFDataType field_type; /* type of associated data */ 551 unsigned short field_bit; /* bit in fieldsset bit vector */ 552 unsigned char field_oktochange; /* if true, can change while writing */ 553 unsigned char field_passcount; /* if true, pass dir count on set */ 554 char *field_name; /* ASCII name */ 555 } TIFFFieldInfo; 556 557 extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32); 558 559 #if defined(c_plusplus) || defined(__cplusplus) 560 } 561 #endif 562 563 #endif /* _TIFFIO_ */ 564 565 /* vim: set ts=8 sts=8 sw=8 noet: */ 566 /* 567 * Local Variables: 568 * mode: c 569 * c-basic-offset: 8 570 * fill-column: 78 571 * End: 572 */ 573