annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tiffio.h @ 69:33d812a61356

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