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