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