1/*
2 * Copyright (c) 1988-1997 Sam Leffler
3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and
6 * its documentation for any purpose is hereby granted without fee, provided
7 * that (i) the above copyright notices and this permission notice appear in
8 * all copies of the software and related documentation, and (ii) the names of
9 * Sam Leffler and Silicon Graphics may not be used in any advertising or
10 * publicity relating to the software without the specific, prior written
11 * permission of Sam Leffler and Silicon Graphics.
12 *
13 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22 * OF THIS SOFTWARE.
23 */
24
25#ifndef _TIFFIO_
26#define _TIFFIO_
27
28/*
29 * TIFF I/O Library Definitions.
30 */
31#include "tiff.h"
32#include "tiffvers.h"
33
34/*
35 * TIFF is defined as an incomplete type to hide the
36 * library's internal data structures from clients.
37 */
38typedef struct tiff TIFF;
39
40/*
41 * The following typedefs define the intrinsic size of
42 * data types used in the *exported* interfaces. These
43 * definitions depend on the proper definition of types
44 * in tiff.h. Note also that the varargs interface used
45 * to pass tag types and values uses the types defined in
46 * tiff.h directly.
47 *
48 * NB: ttag_t is unsigned int and not unsigned short because
49 * ANSI C requires that the type before the ellipsis be a
50 * promoted type (i.e. one of int, unsigned int, pointer,
51 * or double) and because we defined pseudo-tags that are
52 * outside the range of legal Aldus-assigned tags.
53 * NB: tsize_t is signed and not unsigned because some functions
54 * return -1.
55 * NB: toff_t is not off_t for many reasons; TIFFs max out at
56 * 32-bit file offsets, and BigTIFF maxes out at 64-bit
57 * offsets being the most important, and to ensure use of
58 * a consistently unsigned type across architectures.
59 * Prior to libtiff 4.0, this was an unsigned 32 bit type.
60 */
61/*
62 * this is the machine addressing size type, only it's signed, so make it
63 * int32_t on 32bit machines, int64_t on 64bit machines
64 */
65typedef TIFF_SSIZE_T tmsize_t;
66#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
67
68typedef uint64_t toff_t; /* file offset */
69/* the following are deprecated and should be replaced by their defining
70 counterparts */
71typedef uint32_t ttag_t; /* directory tag */
72typedef uint16_t tdir_t; /* directory index */
73typedef uint16_t tsample_t; /* sample number */
74typedef uint32_t 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_t d_Vrwr; /* Pixel values for ref. white */
146 uint32_t d_Vrwg;
147 uint32_t 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_t* Cr_g_tab;
161 int32_t* Cb_g_tab;
162 int32_t* 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_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
192 unsigned char*);
193typedef void (*tileSeparateRoutine)
194 (TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
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_t width; /* image width */
205 uint32_t height; /* image height */
206 uint16_t bitspersample; /* image bits/sample */
207 uint16_t samplesperpixel; /* image samples/pixel */
208 uint16_t orientation; /* image orientation */
209 uint16_t req_orientation; /* requested orientation */
210 uint16_t photometric; /* image photometric interp */
211 uint16_t* redcmap; /* colormap palette */
212 uint16_t* greencmap;
213 uint16_t* bluecmap;
214 /* get image data routine */
215 int (*get)(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
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_t** BWmap; /* black&white map */
224 uint32_t** PALmap; /* palette image map */
225 TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
226 TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
227
228 uint8_t* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
229 uint8_t* 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_t 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 TIFF_ATTRIBUTE(x) __attribute__(x)
268#else
269# define TIFF_ATTRIBUTE(x) /*nothing*/
270#endif
271
272#if defined(c_plusplus) || defined(__cplusplus)
273extern "C" {
274#endif
275typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
276typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
277typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t);
278typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
279typedef int (*TIFFCloseProc)(thandle_t);
280typedef toff_t (*TIFFSizeProc)(thandle_t);
281typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size);
282typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size);
283typedef void (*TIFFExtendProc)(TIFF*);
284
285extern const char* TIFFGetVersion(void);
286
287extern const TIFFCodec* TIFFFindCODEC(uint16_t);
288extern TIFFCodec* TIFFRegisterCODEC(uint16_t, const char*, TIFFInitMethod);
289extern void TIFFUnRegisterCODEC(TIFFCodec*);
290extern int TIFFIsCODECConfigured(uint16_t);
291extern TIFFCodec* TIFFGetConfiguredCODECs(void);
292
293/*
294 * Auxiliary functions.
295 */
296
297extern void* _TIFFmalloc(tmsize_t s);
298extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz);
299extern void* _TIFFrealloc(void* p, tmsize_t s);
300extern void _TIFFmemset(void* p, int v, tmsize_t c);
301extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c);
302extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c);
303extern void _TIFFfree(void* p);
304
305/*
306** Stuff, related to tag handling and creating custom tags.
307*/
308extern int TIFFGetTagListCount( TIFF * );
309extern uint32_t TIFFGetTagListEntry(TIFF *, int tag_index );
310
311#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
312#define TIFF_VARIABLE -1 /* marker for variable length tags */
313#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
314#define TIFF_VARIABLE2 -3 /* marker for uint32_t var-length tags */
315
316#define FIELD_CUSTOM 65
317
318typedef struct _TIFFField TIFFField;
319typedef struct _TIFFFieldArray TIFFFieldArray;
320
321extern const TIFFField* TIFFFindField(TIFF *, uint32_t, TIFFDataType);
322extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32_t);
323extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
324
325extern uint32_t TIFFFieldTag(const TIFFField*);
326extern const char* TIFFFieldName(const TIFFField*);
327extern TIFFDataType TIFFFieldDataType(const TIFFField*);
328extern int TIFFFieldPassCount(const TIFFField*);
329extern int TIFFFieldReadCount(const TIFFField*);
330extern int TIFFFieldWriteCount(const TIFFField*);
331
332typedef int (*TIFFVSetMethod)(TIFF*, uint32_t, va_list);
333typedef int (*TIFFVGetMethod)(TIFF*, uint32_t, va_list);
334typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
335
336typedef struct {
337 TIFFVSetMethod vsetfield; /* tag set routine */
338 TIFFVGetMethod vgetfield; /* tag get routine */
339 TIFFPrintMethod printdir; /* directory print routine */
340} TIFFTagMethods;
341
342extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *);
343extern void *TIFFGetClientInfo(TIFF *, const char *);
344extern void TIFFSetClientInfo(TIFF *, void *, const char *);
345
346extern void TIFFCleanup(TIFF* tif);
347extern void TIFFClose(TIFF* tif);
348extern int TIFFFlush(TIFF* tif);
349extern int TIFFFlushData(TIFF* tif);
350extern int TIFFGetField(TIFF* tif, uint32_t tag, ...);
351extern int TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap);
352extern int TIFFGetFieldDefaulted(TIFF* tif, uint32_t tag, ...);
353extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32_t tag, va_list ap);
354extern int TIFFReadDirectory(TIFF* tif);
355extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
356extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
357extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff);
358extern uint64_t TIFFScanlineSize64(TIFF* tif);
359extern tmsize_t TIFFScanlineSize(TIFF* tif);
360extern uint64_t TIFFRasterScanlineSize64(TIFF* tif);
361extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
362extern uint64_t TIFFStripSize64(TIFF* tif);
363extern tmsize_t TIFFStripSize(TIFF* tif);
364extern uint64_t TIFFRawStripSize64(TIFF* tif, uint32_t strip);
365extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32_t strip);
366extern uint64_t TIFFVStripSize64(TIFF* tif, uint32_t nrows);
367extern tmsize_t TIFFVStripSize(TIFF* tif, uint32_t nrows);
368extern uint64_t TIFFTileRowSize64(TIFF* tif);
369extern tmsize_t TIFFTileRowSize(TIFF* tif);
370extern uint64_t TIFFTileSize64(TIFF* tif);
371extern tmsize_t TIFFTileSize(TIFF* tif);
372extern uint64_t TIFFVTileSize64(TIFF* tif, uint32_t nrows);
373extern tmsize_t TIFFVTileSize(TIFF* tif, uint32_t nrows);
374extern uint32_t TIFFDefaultStripSize(TIFF* tif, uint32_t request);
375extern void TIFFDefaultTileSize(TIFF*, uint32_t*, uint32_t*);
376extern int TIFFFileno(TIFF*);
377extern int TIFFSetFileno(TIFF*, int);
378extern thandle_t TIFFClientdata(TIFF*);
379extern thandle_t TIFFSetClientdata(TIFF*, thandle_t);
380extern int TIFFGetMode(TIFF*);
381extern int TIFFSetMode(TIFF*, int);
382extern int TIFFIsTiled(TIFF*);
383extern int TIFFIsByteSwapped(TIFF*);
384extern int TIFFIsUpSampled(TIFF*);
385extern int TIFFIsMSB2LSB(TIFF*);
386extern int TIFFIsBigEndian(TIFF*);
387extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
388extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
389extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
390extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
391extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
392extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
393extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
394extern uint32_t TIFFCurrentRow(TIFF*);
395extern uint16_t TIFFCurrentDirectory(TIFF*);
396extern uint16_t TIFFNumberOfDirectories(TIFF*);
397extern uint64_t TIFFCurrentDirOffset(TIFF*);
398extern uint32_t TIFFCurrentStrip(TIFF*);
399extern uint32_t TIFFCurrentTile(TIFF* tif);
400extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
401extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
402extern int TIFFSetupStrips(TIFF *);
403extern int TIFFWriteCheck(TIFF*, int, const char *);
404extern void TIFFFreeDirectory(TIFF*);
405extern int TIFFCreateDirectory(TIFF*);
406extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
407extern int TIFFCreateEXIFDirectory(TIFF*);
408extern int TIFFCreateGPSDirectory(TIFF*);
409extern int TIFFLastDirectory(TIFF*);
410extern int TIFFSetDirectory(TIFF*, uint16_t);
411extern int TIFFSetSubDirectory(TIFF*, uint64_t);
412extern int TIFFUnlinkDirectory(TIFF*, uint16_t);
413extern int TIFFSetField(TIFF*, uint32_t, ...);
414extern int TIFFVSetField(TIFF*, uint32_t, va_list);
415extern int TIFFUnsetField(TIFF*, uint32_t);
416extern int TIFFWriteDirectory(TIFF *);
417extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *);
418extern int TIFFCheckpointDirectory(TIFF *);
419extern int TIFFRewriteDirectory(TIFF *);
420extern int TIFFDeferStrileArrayWriting(TIFF *);
421extern int TIFFForceStrileArrayWriting(TIFF* );
422
423#if defined(c_plusplus) || defined(__cplusplus)
424extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
425extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample = 0);
426extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample = 0);
427extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int = 0);
428extern int TIFFReadRGBAImageOriented(TIFF*, uint32_t, uint32_t, uint32_t*,
429 int = ORIENTATION_BOTLEFT, int = 0);
430#else
431extern void TIFFPrintDirectory(TIFF*, FILE*, long);
432extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
433extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
434extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int);
435extern int TIFFReadRGBAImageOriented(TIFF*, uint32_t, uint32_t, uint32_t*, int, int);
436#endif
437
438extern int TIFFReadRGBAStrip(TIFF*, uint32_t, uint32_t * );
439extern int TIFFReadRGBATile(TIFF*, uint32_t, uint32_t, uint32_t * );
440extern int TIFFReadRGBAStripExt(TIFF*, uint32_t, uint32_t *, int stop_on_error );
441extern int TIFFReadRGBATileExt(TIFF*, uint32_t, uint32_t, uint32_t *, int stop_on_error );
442extern int TIFFRGBAImageOK(TIFF*, char [1024]);
443extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
444extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
445extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
446extern TIFF* TIFFOpen(const char*, const char*);
447# ifdef __WIN32__
448extern TIFF* TIFFOpenW(const wchar_t*, const char*);
449# endif /* __WIN32__ */
450extern TIFF* TIFFFdOpen(int, const char*, const char*);
451extern TIFF* TIFFClientOpen(const char*, const char*,
452 thandle_t,
453 TIFFReadWriteProc, TIFFReadWriteProc,
454 TIFFSeekProc, TIFFCloseProc,
455 TIFFSizeProc,
456 TIFFMapFileProc, TIFFUnmapFileProc);
457extern const char* TIFFFileName(TIFF*);
458extern const char* TIFFSetFileName(TIFF*, const char *);
459extern void TIFFError(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
460extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4)));
461extern void TIFFWarning(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
462extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4)));
463extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
464extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
465extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
466extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
467extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
468extern uint32_t TIFFComputeTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
469extern int TIFFCheckTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
470extern uint32_t TIFFNumberOfTiles(TIFF*);
471extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
472extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
473extern uint32_t TIFFComputeStrip(TIFF*, uint32_t, uint16_t);
474extern uint32_t TIFFNumberOfStrips(TIFF*);
475extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
476extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
477extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
478extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
479extern int TIFFReadFromUserBuffer(TIFF* tif, uint32_t strile,
480 void* inbuf, tmsize_t insize,
481 void* outbuf, tmsize_t outsize);
482extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc);
483extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc);
484extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc);
485extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc);
486extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
487extern void TIFFSetWriteOffset(TIFF* tif, toff_t off);
488extern void TIFFSwabShort(uint16_t*);
489extern void TIFFSwabLong(uint32_t*);
490extern void TIFFSwabLong8(uint64_t*);
491extern void TIFFSwabFloat(float*);
492extern void TIFFSwabDouble(double*);
493extern void TIFFSwabArrayOfShort(uint16_t* wp, tmsize_t n);
494extern void TIFFSwabArrayOfTriples(uint8_t* tp, tmsize_t n);
495extern void TIFFSwabArrayOfLong(uint32_t* lp, tmsize_t n);
496extern void TIFFSwabArrayOfLong8(uint64_t* lp, tmsize_t n);
497extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
498extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
499extern void TIFFReverseBits(uint8_t* cp, tmsize_t n);
500extern const unsigned char* TIFFGetBitRevTable(int);
501
502extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile);
503extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile);
504extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile, int *pbErr);
505extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile, int *pbErr);
506
507#ifdef LOGLUV_PUBLIC
508#define U_NEU 0.210526316
509#define V_NEU 0.473684211
510#define UVSCALE 410.
511extern double LogL16toY(int);
512extern double LogL10toY(int);
513extern void XYZtoRGB24(float*, uint8_t*);
514extern int uv_decode(double*, double*, int);
515extern void LogLuv24toXYZ(uint32_t, float*);
516extern void LogLuv32toXYZ(uint32_t, float*);
517#if defined(c_plusplus) || defined(__cplusplus)
518extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
519extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
520extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
521extern uint32_t LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
522extern uint32_t LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
523#else
524extern int LogL16fromY(double, int);
525extern int LogL10fromY(double, int);
526extern int uv_encode(double, double, int);
527extern uint32_t LogLuv24fromXYZ(float*, int);
528extern uint32_t LogLuv32fromXYZ(float*, int);
529#endif
530#endif /* LOGLUV_PUBLIC */
531
532extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*);
533extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32_t, int32_t, int32_t,
534 float *, float *, float *);
535extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
536 uint32_t *, uint32_t *, uint32_t *);
537
538extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
539extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t,
540 uint32_t *, uint32_t *, uint32_t *);
541
542/****************************************************************************
543 * O B S O L E T E D I N T E R F A C E S
544 *
545 * Don't use this stuff in your applications, it may be removed in the future
546 * libtiff versions.
547 ****************************************************************************/
548typedef struct {
549 ttag_t field_tag; /* field's tag */
550 short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
551 short field_writecount; /* write count/TIFF_VARIABLE */
552 TIFFDataType field_type; /* type of associated data */
553 unsigned short field_bit; /* bit in fieldsset bit vector */
554 unsigned char field_oktochange; /* if true, can change while writing */
555 unsigned char field_passcount; /* if true, pass dir count on set */
556 char *field_name; /* ASCII name */
557} TIFFFieldInfo;
558
559extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32_t);
560
561#if defined(c_plusplus) || defined(__cplusplus)
562}
563#endif
564
565#endif /* _TIFFIO_ */
566
567/* vim: set ts=8 sts=8 sw=8 noet: */
568/*
569 * Local Variables:
570 * mode: c
571 * c-basic-offset: 8
572 * fill-column: 78
573 * End:
574 */
575

source code of include/x86_64-linux-gnu/tiffio.h