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