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