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