1 #ifndef LIBRARIES_TIFF_H
    2 #define	LIBRARIES_TIFF_H
    3 
    4 /*
    5 	MorphOS Shared TIFFLib
    6 	
    7 	tiff.library include
    8 	
    9 	Copyright © 2004 The MorphOS Development Team, All Rights Reserved.
   10 */
   11 
   12 #ifndef DOS_DOS_H
   13 # include <dos/dos.h>
   14 #endif
   15 
   16 
   17 /*
   18  * Copyright (c) 1988-1997 Sam Leffler
   19  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
   20  *
   21  * Permission to use, copy, modify, distribute, and sell this software and 
   22  * its documentation for any purpose is hereby granted without fee, provided
   23  * that (i) the above copyright notices and this permission notice appear in
   24  * all copies of the software and related documentation, and (ii) the names of
   25  * Sam Leffler and Silicon Graphics may not be used in any advertising or
   26  * publicity relating to the software without the specific, prior written
   27  * permission of Sam Leffler and Silicon Graphics.
   28  * 
   29  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
   30  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
   31  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
   32  * 
   33  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
   34  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
   35  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   36  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
   37  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
   38  * OF THIS SOFTWARE.
   39  */
   40 
   41 
   42 #ifdef __cplusplus
   43 extern "C" {
   44 #endif
   45 
   46 #define	TIFF_VERSION	42
   47 #define	TIFF_BIGTIFF_VERSION	43
   48 #define TIFFLIB_VERSION 20050912
   49 
   50 #define	TIFF_BIGENDIAN		0x4d4d
   51 #define	TIFF_LITTLEENDIAN	0x4949
   52 
   53 #define	MDI_LITTLEENDIAN	0x5045
   54 #define	MDI_BIGENDIAN		0x4550
   55 
   56 /*
   57  * TIFF is defined as an incomplete type to hide the
   58  * library's internal data structures from clients.
   59  */
   60 
   61 typedef struct tiff TIFF;
   62 
   63 
   64 #ifndef _TIFF_DATA_TYPEDEFS_
   65 #define _TIFF_DATA_TYPEDEFS_
   66 typedef unsigned char uint8;
   67 typedef unsigned short uint16;
   68 typedef unsigned int uint32;
   69 typedef signed char int8;
   70 typedef short int16;
   71 typedef int int32;
   72 #endif /* _TIFF_DATA_TYPEDEFS_ */
   73 
   74 
   75 /*	For TIFFReassignTagToIgnore */
   76 enum TIFFIgnoreSense /* IGNORE tag table */
   77 {
   78 	TIS_STORE,
   79 	TIS_EXTRACT,
   80 	TIS_EMPTY
   81 };
   82 
   83 typedef	struct {
   84 	uint16	tiff_magic;	/* magic number (defines byte order) */
   85 #define TIFF_MAGIC_SIZE	2
   86 	uint16	tiff_version;	/* TIFF version number */
   87 #define TIFF_VERSION_SIZE	2
   88 	uint32	tiff_diroff;	/* byte offset to first directory */
   89 #define TIFF_DIROFFSET_SIZE	4
   90 } TIFFHeader;
   91 
   92 /*
   93  * TIFF Image File Directories are comprised of a table of field
   94  * descriptors of the form shown below.  The table is sorted in
   95  * ascending order by tag.  The values associated with each entry are
   96  * disjoint and may appear anywhere in the file (so long as they are
   97  * placed on a word boundary).
   98  *
   99  * If the value is 4 bytes or less, then it is placed in the offset
  100  * field to save space.  If the value is less than 4 bytes, it is
  101  * left-justified in the offset field.
  102  */
  103 typedef	struct {
  104 	uint16		tdir_tag;	/* see below */
  105 	uint16		tdir_type;	/* data type; see below */
  106 	uint32		tdir_count;	/* number of items; length in spec */
  107 	uint32		tdir_offset;	/* byte offset to field data */
  108 } TIFFDirEntry;
  109 
  110 /*
  111  * NB: In the comments below,
  112  *  - items marked with a + are obsoleted by revision 5.0,
  113  *  - items marked with a ! are introduced in revision 6.0.
  114  *  - items marked with a % are introduced post revision 6.0.
  115  *  - items marked with a $ are obsoleted by revision 6.0.
  116  *  - items marked with a & are introduced by Adobe DNG specification.
  117  */
  118 
  119 /*
  120  * Tag data type information.
  121  *
  122  * Note: RATIONALs are the ratio of two 32-bit integer values.
  123  */
  124 typedef	enum {
  125 	TIFF_NOTYPE	= 0,	/* placeholder */
  126 	TIFF_BYTE	= 1,	/* 8-bit unsigned integer */
  127 	TIFF_ASCII	= 2,	/* 8-bit bytes w/ last byte null */
  128 	TIFF_SHORT	= 3,	/* 16-bit unsigned integer */
  129 	TIFF_LONG	= 4,	/* 32-bit unsigned integer */
  130 	TIFF_RATIONAL	= 5,	/* 64-bit unsigned fraction */
  131 	TIFF_SBYTE	= 6,	/* !8-bit signed integer */
  132 	TIFF_UNDEFINED	= 7,	/* !8-bit untyped data */
  133 	TIFF_SSHORT	= 8,	/* !16-bit signed integer */
  134 	TIFF_SLONG	= 9,	/* !32-bit signed integer */
  135 	TIFF_SRATIONAL	= 10,	/* !64-bit signed fraction */
  136 	TIFF_FLOAT	= 11,	/* !32-bit IEEE floating point */
  137 	TIFF_DOUBLE	= 12,	/* !64-bit IEEE floating point */
  138 	TIFF_IFD	= 13	/* %32-bit unsigned integer (offset) */
  139 } TIFFDataType;
  140 
  141 /*
  142  * TIFF Tag Definitions.
  143  */
  144 #define	TIFFTAG_SUBFILETYPE		254	/* subfile data descriptor */
  145 #define	    FILETYPE_REDUCEDIMAGE	0x1	/* reduced resolution version */
  146 #define	    FILETYPE_PAGE		0x2	/* one page of many */
  147 #define	    FILETYPE_MASK		0x4	/* transparency mask */
  148 #define	TIFFTAG_OSUBFILETYPE		255	/* +kind of data in subfile */
  149 #define	    OFILETYPE_IMAGE		1	/* full resolution image data */
  150 #define	    OFILETYPE_REDUCEDIMAGE	2	/* reduced size image data */
  151 #define	    OFILETYPE_PAGE		3	/* one page of many */
  152 #define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
  153 #define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
  154 #define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  155 #define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  156 #define	    COMPRESSION_NONE		1	/* dump mode */
  157 #define	    COMPRESSION_CCITTRLE	2	/* CCITT modified Huffman RLE */
  158 #define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
  159 #define     COMPRESSION_CCITT_T4        3       /* CCITT T.4 (TIFF 6 name) */
  160 #define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
  161 #define     COMPRESSION_CCITT_T6        4       /* CCITT T.6 (TIFF 6 name) */
  162 #define	    COMPRESSION_LZW		5       /* Lempel-Ziv  & Welch */
  163 #define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
  164 #define	    COMPRESSION_JPEG		7	/* %JPEG DCT compression */
  165 #define	    COMPRESSION_NEXT		32766	/* NeXT 2-bit RLE */
  166 #define	    COMPRESSION_CCITTRLEW	32771	/* #1 w/ word alignment */
  167 #define	    COMPRESSION_PACKBITS	32773	/* Macintosh RLE */
  168 #define	    COMPRESSION_THUNDERSCAN	32809	/* ThunderScan RLE */
  169 /* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
  170 #define	    COMPRESSION_IT8CTPAD	32895   /* IT8 CT w/padding */
  171 #define	    COMPRESSION_IT8LW		32896   /* IT8 Linework RLE */
  172 #define	    COMPRESSION_IT8MP		32897   /* IT8 Monochrome picture */
  173 #define	    COMPRESSION_IT8BL		32898   /* IT8 Binary line art */
  174 /* compression codes 32908-32911 are reserved for Pixar */
  175 #define     COMPRESSION_PIXARFILM	32908   /* Pixar companded 10bit LZW */
  176 #define	    COMPRESSION_PIXARLOG	32909   /* Pixar companded 11bit ZIP */
  177 #define	    COMPRESSION_DEFLATE		32946	/* Deflate compression */
  178 #define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression, as recognized by Adobe */
  179 /* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
  180 #define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */
  181 #define	    COMPRESSION_JBIG		34661	/* ISO JBIG */
  182 #define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  183 #define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  184 #define     COMPRESSION_JP2000          34712   /* Leadtools JPEG2000 */
  185 #define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  186 #define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  187 #define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  188 #define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  189 #define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  190 #define	    PHOTOMETRIC_MASK		4	/* $holdout mask */
  191 #define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
  192 #define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  193 #define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
  194 #define	    PHOTOMETRIC_ICCLAB		9	/* ICC L*a*b* [Adobe TIFF Technote 4] */
  195 #define	    PHOTOMETRIC_ITULAB		10	/* ITU L*a*b* */
  196 #define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
  197 #define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
  198 #define	TIFFTAG_THRESHHOLDING		263	/* +thresholding used on data */
  199 #define	    THRESHHOLD_BILEVEL		1	/* b&w art scan */
  200 #define	    THRESHHOLD_HALFTONE		2	/* or dithered scan */
  201 #define	    THRESHHOLD_ERRORDIFFUSE	3	/* usually floyd-steinberg */
  202 #define	TIFFTAG_CELLWIDTH		264	/* +dithering matrix width */
  203 #define	TIFFTAG_CELLLENGTH		265	/* +dithering matrix height */
  204 #define	TIFFTAG_FILLORDER		266	/* data order within a byte */
  205 #define	    FILLORDER_MSB2LSB		1	/* most significant -> least */
  206 #define	    FILLORDER_LSB2MSB		2	/* least significant -> most */
  207 #define	TIFFTAG_DOCUMENTNAME		269	/* name of doc. image is from */
  208 #define	TIFFTAG_IMAGEDESCRIPTION	270	/* info about image */
  209 #define	TIFFTAG_MAKE			271	/* scanner manufacturer name */
  210 #define	TIFFTAG_MODEL			272	/* scanner model name/number */
  211 #define	TIFFTAG_STRIPOFFSETS		273	/* offsets to data strips */
  212 #define	TIFFTAG_ORIENTATION		274	/* +image orientation */
  213 #define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
  214 #define	    ORIENTATION_TOPRIGHT	2	/* row 0 top, col 0 rhs */
  215 #define	    ORIENTATION_BOTRIGHT	3	/* row 0 bottom, col 0 rhs */
  216 #define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
  217 #define	    ORIENTATION_LEFTTOP		5	/* row 0 lhs, col 0 top */
  218 #define	    ORIENTATION_RIGHTTOP	6	/* row 0 rhs, col 0 top */
  219 #define	    ORIENTATION_RIGHTBOT	7	/* row 0 rhs, col 0 bottom */
  220 #define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
  221 #define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  222 #define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
  223 #define	TIFFTAG_STRIPBYTECOUNTS		279	/* bytes counts for strips */
  224 #define	TIFFTAG_MINSAMPLEVALUE		280	/* +minimum sample value */
  225 #define	TIFFTAG_MAXSAMPLEVALUE		281	/* +maximum sample value */
  226 #define	TIFFTAG_XRESOLUTION		282	/* pixels/resolution in x */
  227 #define	TIFFTAG_YRESOLUTION		283	/* pixels/resolution in y */
  228 #define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
  229 #define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  230 #define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  231 #define	TIFFTAG_PAGENAME		285	/* page name image is from */
  232 #define	TIFFTAG_XPOSITION		286	/* x page offset of image lhs */
  233 #define	TIFFTAG_YPOSITION		287	/* y page offset of image lhs */
  234 #define	TIFFTAG_FREEOFFSETS		288	/* +byte offset to free block */
  235 #define	TIFFTAG_FREEBYTECOUNTS		289	/* +sizes of free blocks */
  236 #define	TIFFTAG_GRAYRESPONSEUNIT	290	/* $gray scale curve accuracy */
  237 #define	    GRAYRESPONSEUNIT_10S	1	/* tenths of a unit */
  238 #define	    GRAYRESPONSEUNIT_100S	2	/* hundredths of a unit */
  239 #define	    GRAYRESPONSEUNIT_1000S	3	/* thousandths of a unit */
  240 #define	    GRAYRESPONSEUNIT_10000S	4	/* ten-thousandths of a unit */
  241 #define	    GRAYRESPONSEUNIT_100000S	5	/* hundred-thousandths */
  242 #define	TIFFTAG_GRAYRESPONSECURVE	291	/* $gray scale response curve */
  243 #define	TIFFTAG_GROUP3OPTIONS		292	/* 32 flag bits */
  244 #define	TIFFTAG_T4OPTIONS		292	/* TIFF 6.0 proper name alias */
  245 #define	    GROUP3OPT_2DENCODING	0x1	/* 2-dimensional coding */
  246 #define	    GROUP3OPT_UNCOMPRESSED	0x2	/* data not compressed */
  247 #define	    GROUP3OPT_FILLBITS		0x4	/* fill to byte boundary */
  248 #define	TIFFTAG_GROUP4OPTIONS		293	/* 32 flag bits */
  249 #define TIFFTAG_T6OPTIONS               293     /* TIFF 6.0 proper name */
  250 #define	    GROUP4OPT_UNCOMPRESSED	0x2	/* data not compressed */
  251 #define	TIFFTAG_RESOLUTIONUNIT		296	/* units of resolutions */
  252 #define	    RESUNIT_NONE		1	/* no meaningful units */
  253 #define	    RESUNIT_INCH		2	/* english */
  254 #define	    RESUNIT_CENTIMETER		3	/* metric */
  255 #define	TIFFTAG_PAGENUMBER		297	/* page numbers of multi-page */
  256 #define	TIFFTAG_COLORRESPONSEUNIT	300	/* $color curve accuracy */
  257 #define	    COLORRESPONSEUNIT_10S	1	/* tenths of a unit */
  258 #define	    COLORRESPONSEUNIT_100S	2	/* hundredths of a unit */
  259 #define	    COLORRESPONSEUNIT_1000S	3	/* thousandths of a unit */
  260 #define	    COLORRESPONSEUNIT_10000S	4	/* ten-thousandths of a unit */
  261 #define	    COLORRESPONSEUNIT_100000S	5	/* hundred-thousandths */
  262 #define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
  263 #define	TIFFTAG_SOFTWARE		305	/* name & release */
  264 #define	TIFFTAG_DATETIME		306	/* creation date and time */
  265 #define	TIFFTAG_ARTIST			315	/* creator of image */
  266 #define	TIFFTAG_HOSTCOMPUTER		316	/* machine where created */
  267 #define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  268 #define     PREDICTOR_NONE		1	/* no prediction scheme used */
  269 #define     PREDICTOR_HORIZONTAL	2	/* horizontal differencing */
  270 #define     PREDICTOR_FLOATINGPOINT	3	/* floating point predictor */
  271 #define	TIFFTAG_WHITEPOINT		318	/* image white point */
  272 #define	TIFFTAG_PRIMARYCHROMATICITIES	319	/* !primary chromaticities */
  273 #define	TIFFTAG_COLORMAP		320	/* RGB map for pallette image */
  274 #define	TIFFTAG_HALFTONEHINTS		321	/* !highlight+shadow info */
  275 #define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
  276 #define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
  277 #define TIFFTAG_TILEOFFSETS		324	/* !offsets to data tiles */
  278 #define TIFFTAG_TILEBYTECOUNTS		325	/* !byte counts for tiles */
  279 #define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
  280 #define	TIFFTAG_CLEANFAXDATA		327	/* regenerated line info */
  281 #define	    CLEANFAXDATA_CLEAN		0	/* no errors detected */
  282 #define	    CLEANFAXDATA_REGENERATED	1	/* receiver regenerated lines */
  283 #define	    CLEANFAXDATA_UNCLEAN	2	/* uncorrected errors exist */
  284 #define	TIFFTAG_CONSECUTIVEBADFAXLINES	328	/* max consecutive bad lines */
  285 #define	TIFFTAG_SUBIFD			330	/* subimage descriptors */
  286 #define	TIFFTAG_INKSET			332	/* !inks in separated image */
  287 #define	    INKSET_CMYK			1	/* !cyan-magenta-yellow-black color */
  288 #define	    INKSET_MULTIINK		2	/* !multi-ink or hi-fi color */
  289 #define	TIFFTAG_INKNAMES		333	/* !ascii names of inks */
  290 #define	TIFFTAG_NUMBEROFINKS		334	/* !number of inks */
  291 #define	TIFFTAG_DOTRANGE		336	/* !0% and 100% dot codes */
  292 #define	TIFFTAG_TARGETPRINTER		337	/* !separation target */
  293 #define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
  294 #define	    EXTRASAMPLE_UNSPECIFIED	0	/* !unspecified data */
  295 #define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  296 #define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  297 #define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  298 #define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  299 #define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
  300 #define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  301 #define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
  302 #define	    SAMPLEFORMAT_COMPLEXINT	5	/* !complex signed int */
  303 #define	    SAMPLEFORMAT_COMPLEXIEEEFP	6	/* !complex ieee floating */
  304 #define	TIFFTAG_SMINSAMPLEVALUE		340	/* !variable MinSampleValue */
  305 #define	TIFFTAG_SMAXSAMPLEVALUE		341	/* !variable MaxSampleValue */
  306 #define	TIFFTAG_CLIPPATH		343	/* %ClipPath [Adobe TIFF technote 2] */
  307 #define	TIFFTAG_XCLIPPATHUNITS	344	/* %XClipPathUnits [Adobe TIFF technote 2] */
  308 #define	TIFFTAG_YCLIPPATHUNITS		345	/* %YClipPathUnits [Adobe TIFF technote 2] */
  309 #define	TIFFTAG_INDEXED			346	/* %Indexed [Adobe TIFF Technote 3] */
  310 #define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
  311 #define	TIFFTAG_OPIPROXY		351	/* %OPI Proxy [Adobe TIFF technote] */
  312 /*
  313  * Tags 512-521 are obsoleted by Technical Note #2 which specifies a
  314  * revised JPEG-in-TIFF scheme.
  315  */
  316 #define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
  317 #define	    JPEGPROC_BASELINE		1	/* !baseline sequential */
  318 #define	    JPEGPROC_LOSSLESS		14	/* !Huffman coded lossless */
  319 #define	TIFFTAG_JPEGIFOFFSET		513	/* !pointer to SOI marker */
  320 #define	TIFFTAG_JPEGIFBYTECOUNT		514	/* !JFIF stream length */
  321 #define	TIFFTAG_JPEGRESTARTINTERVAL	515	/* !restart interval length */
  322 #define	TIFFTAG_JPEGLOSSLESSPREDICTORS	517	/* !lossless proc predictor */
  323 #define	TIFFTAG_JPEGPOINTTRANSFORM	518	/* !lossless point transform */
  324 #define	TIFFTAG_JPEGQTABLES		519	/* !Q matrice offsets */
  325 #define	TIFFTAG_JPEGDCTABLES		520	/* !DCT table offsets */
  326 #define	TIFFTAG_JPEGACTABLES		521	/* !AC coefficient offsets */
  327 #define	TIFFTAG_YCBCRCOEFFICIENTS	529	/* !RGB -> YCbCr transform */
  328 #define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  329 #define	TIFFTAG_YCBCRPOSITIONING	531	/* !subsample positioning */
  330 #define	    YCBCRPOSITION_CENTERED	1	/* !as in PostScript Level 2 */
  331 #define	    YCBCRPOSITION_COSITED	2	/* !as in CCIR 601-1 */
  332 #define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
  333 #define	TIFFTAG_XMLPACKET		700	/* %XML packet [Adobe XMP Specification, January 2004 */
  334 #define TIFFTAG_OPIIMAGEID		32781	/* %OPI ImageID [Adobe TIFF technote] */
  335 /* tags 32952-32956 are private tags registered to Island Graphics */
  336 #define TIFFTAG_REFPTS			32953	/* image reference points */
  337 #define TIFFTAG_REGIONTACKPOINT		32954	/* region-xform tack point */
  338 #define TIFFTAG_REGIONWARPCORNERS	32955	/* warp quadrilateral */
  339 #define TIFFTAG_REGIONAFFINE		32956	/* affine transformation mat */
  340 /* tags 32995-32999 are private tags registered to SGI */
  341 #define	TIFFTAG_MATTEING		32995	/* $use ExtraSamples */
  342 #define	TIFFTAG_DATATYPE		32996	/* $use SampleFormat */
  343 #define	TIFFTAG_IMAGEDEPTH		32997	/* z depth of image */
  344 #define	TIFFTAG_TILEDEPTH		32998	/* z depth/data tile */
  345 /* tags 33300-33309 are private tags registered to Pixar */
  346 /*
  347  * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
  348  * are set when an image has been cropped out of a larger image.  
  349  * They reflect the size of the original uncropped image.
  350  * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
  351  * to determine the position of the smaller image in the larger one.
  352  */
  353 #define TIFFTAG_PIXAR_IMAGEFULLWIDTH    33300   /* full image size in x */
  354 #define TIFFTAG_PIXAR_IMAGEFULLLENGTH   33301   /* full image size in y */
  355  /* Tags 33302-33306 are used to identify special image modes and data
  356   * used by Pixar's texture formats.
  357   */
  358 #define TIFFTAG_PIXAR_TEXTUREFORMAT	33302	/* texture map format */
  359 #define TIFFTAG_PIXAR_WRAPMODES		33303	/* s & t wrap modes */
  360 #define TIFFTAG_PIXAR_FOVCOT		33304	/* cotan(fov) for env. maps */
  361 #define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
  362 #define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
  363 /* tag 33405 is a private tag registered to Eastman Kodak */
  364 #define TIFFTAG_WRITERSERIALNUMBER      33405   /* device serial number */
  365 /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
  366 #define	TIFFTAG_COPYRIGHT		33432	/* copyright string */
  367 /* IPTC TAG from RichTIFF specifications */
  368 #define TIFFTAG_RICHTIFFIPTC    33723
  369 /* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
  370 #define TIFFTAG_IT8SITE			34016	/* site name */
  371 #define TIFFTAG_IT8COLORSEQUENCE	34017	/* color seq. [RGB,CMYK,etc] */
  372 #define TIFFTAG_IT8HEADER		34018	/* DDES Header */
  373 #define TIFFTAG_IT8RASTERPADDING	34019	/* raster scanline padding */
  374 #define TIFFTAG_IT8BITSPERRUNLENGTH	34020	/* # of bits in short run */
  375 #define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
  376 #define TIFFTAG_IT8COLORTABLE		34022	/* LW colortable */
  377 #define TIFFTAG_IT8IMAGECOLORINDICATOR	34023	/* BP/BL image color switch */
  378 #define TIFFTAG_IT8BKGCOLORINDICATOR	34024	/* BP/BL bg color switch */
  379 #define TIFFTAG_IT8IMAGECOLORVALUE	34025	/* BP/BL image color value */
  380 #define TIFFTAG_IT8BKGCOLORVALUE	34026	/* BP/BL bg color value */
  381 #define TIFFTAG_IT8PIXELINTENSITYRANGE	34027	/* MP pixel intensity value */
  382 #define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028	/* HC transparency switch */
  383 #define TIFFTAG_IT8COLORCHARACTERIZATION 34029	/* color character. table */
  384 #define TIFFTAG_IT8HCUSAGE			34030	/* HC usage indicator */
  385 #define TIFFTAG_IT8TRAPINDICATOR	34031	/* Trapping indicator (untrapped=0, trapped=1) */
  386 #define TIFFTAG_IT8CMYKEQUIVALENT	34032	/* CMYK color equivalents */
  387 /* tags 34232-34236 are private tags registered to Texas Instruments */
  388 #define TIFFTAG_FRAMECOUNT              34232   /* Sequence Frame Count */
  389 /* tag 34377 is private tag registered to Adobe for PhotoShop */
  390 #define TIFFTAG_PHOTOSHOP				34377 
  391 /* tags 34665, 34853 and 40965 are documented in EXIF specification */
  392 #define TIFFTAG_EXIFIFD			34665	/* Pointer to EXIF private directory */
  393 /* tag 34750 is a private tag registered to Adobe? */
  394 #define TIFFTAG_ICCPROFILE		34675	/* ICC profile data */
  395 /* tag 34750 is a private tag registered to Pixel Magic */
  396 #define	TIFFTAG_JBIGOPTIONS		34750	/* JBIG options */
  397 #define TIFFTAG_GPSIFD			34853	/* Pointer to GPS private directory */
  398 /* tags 34908-34914 are private tags registered to SGI */
  399 #define	TIFFTAG_FAXRECVPARAMS		34908	/* encoded Class 2 ses. parms */
  400 #define	TIFFTAG_FAXSUBADDRESS		34909	/* received SubAddr string */
  401 #define	TIFFTAG_FAXRECVTIME		34910	/* receive time (secs) */
  402 #define	TIFFTAG_FAXDCS			34911	/* encoded fax ses. params, Table 2/T.30 */
  403 /* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
  404 #define TIFFTAG_STONITS			37439	/* Sample value to Nits */
  405 /* tag 34929 is a private tag registered to FedEx */
  406 #define	TIFFTAG_FEDEX_EDR		34929	/* unknown use */
  407 #define TIFFTAG_INTEROPERABILITYIFD	40965	/* Pointer to Interoperability private directory */
  408 /* Adobe Digital Negative (DNG) format tags */
  409 #define TIFFTAG_DNGVERSION		50706	/* &DNG version number */
  410 #define TIFFTAG_DNGBACKWARDVERSION	50707	/* &DNG compatibility version */
  411 #define TIFFTAG_UNIQUECAMERAMODEL	50708	/* &name for the camera model */
  412 #define TIFFTAG_LOCALIZEDCAMERAMODEL	50709	/* &localized camera model
  413 						   name */
  414 #define TIFFTAG_CFAPLANECOLOR		50710	/* &CFAPattern->LinearRaw space
  415 						   mapping */
  416 #define TIFFTAG_CFALAYOUT		50711	/* &spatial layout of the CFA */
  417 #define TIFFTAG_LINEARIZATIONTABLE	50712	/* &lookup table description */
  418 #define TIFFTAG_BLACKLEVELREPEATDIM	50713	/* &repeat pattern size for
  419 						   the BlackLevel tag */
  420 #define TIFFTAG_BLACKLEVEL		50714	/* &zero light encoding level */
  421 #define TIFFTAG_BLACKLEVELDELTAH	50715	/* &zero light encoding level
  422 						   differences (columns) */
  423 #define TIFFTAG_BLACKLEVELDELTAV	50716	/* &zero light encoding level
  424 						   differences (rows) */
  425 #define TIFFTAG_WHITELEVEL		50717	/* &fully saturated encoding
  426 						   level */
  427 #define TIFFTAG_DEFAULTSCALE		50718	/* &default scale factors */
  428 #define TIFFTAG_DEFAULTCROPORIGIN	50719	/* &origin of the final image
  429 						   area */
  430 #define TIFFTAG_DEFAULTCROPSIZE		50720	/* &size of the final image 
  431 						   area */
  432 #define TIFFTAG_COLORMATRIX1		50721	/* &XYZ->reference color space
  433 						   transformation matrix 1 */
  434 #define TIFFTAG_COLORMATRIX2		50722	/* &XYZ->reference color space
  435 						   transformation matrix 2 */
  436 #define TIFFTAG_CAMERACALIBRATION1	50723	/* &calibration matrix 1 */
  437 #define TIFFTAG_CAMERACALIBRATION2	50724	/* &calibration matrix 2 */
  438 #define TIFFTAG_REDUCTIONMATRIX1	50725	/* &dimensionality reduction
  439 						   matrix 1 */
  440 #define TIFFTAG_REDUCTIONMATRIX2	50726	/* &dimensionality reduction
  441 						   matrix 2 */
  442 #define TIFFTAG_ANALOGBALANCE		50727	/* &gain applied the stored raw
  443 						   values*/
  444 #define TIFFTAG_ASSHOTNEUTRAL		50728	/* &selected white balance in
  445 						   linear reference space */
  446 #define TIFFTAG_ASSHOTWHITEXY		50729	/* &selected white balance in
  447 						   x-y chromaticity
  448 						   coordinates */
  449 #define TIFFTAG_BASELINEEXPOSURE	50730	/* &how much to move the zero
  450 						   point */
  451 #define TIFFTAG_BASELINENOISE		50731	/* &relative noise level */
  452 #define TIFFTAG_BASELINESHARPNESS	50732	/* &relative amount of
  453 						   sharpening */
  454 #define TIFFTAG_BAYERGREENSPLIT		50733	/* &how closely the values of
  455 						   the green pixels in the
  456 						   blue/green rows track the
  457 						   values of the green pixels
  458 						   in the red/green rows */
  459 #define TIFFTAG_LINEARRESPONSELIMIT	50734	/* &non-linear encoding range */
  460 #define TIFFTAG_CAMERASERIALNUMBER	50735	/* &camera's serial number */
  461 #define TIFFTAG_LENSINFO		50736	/* info about the lens */
  462 #define TIFFTAG_CHROMABLURRADIUS	50737	/* &chroma blur radius */
  463 #define TIFFTAG_ANTIALIASSTRENGTH	50738	/* &relative strength of the
  464 						   camera's anti-alias filter */
  465 #define TIFFTAG_SHADOWSCALE		50739	/* &used by Adobe Camera Raw */
  466 #define TIFFTAG_DNGPRIVATEDATA		50740	/* &manufacturer's private data */
  467 #define TIFFTAG_MAKERNOTESAFETY		50741	/* &whether the EXIF MakerNote
  468 						   tag is safe to preserve
  469 						   along with the rest of the
  470 						   EXIF data */
  471 #define	TIFFTAG_CALIBRATIONILLUMINANT1	50778	/* &illuminant 1 */
  472 #define TIFFTAG_CALIBRATIONILLUMINANT2	50779	/* &illuminant 2 */
  473 #define TIFFTAG_BESTQUALITYSCALE	50780	/* &best quality multiplier */
  474 #define TIFFTAG_RAWDATAUNIQUEID		50781	/* &unique identifier for
  475 						   the raw image data */
  476 #define TIFFTAG_ORIGINALRAWFILENAME	50827	/* &file name of the original
  477 						   raw file */
  478 #define TIFFTAG_ORIGINALRAWFILEDATA	50828	/* &contents of the original
  479 						   raw file */
  480 #define TIFFTAG_ACTIVEAREA		50829	/* &active (non-masked) pixels
  481 						   of the sensor */
  482 #define TIFFTAG_MASKEDAREAS		50830	/* &list of coordinates
  483 						   of fully masked pixels */
  484 #define TIFFTAG_ASSHOTICCPROFILE	50831	/* &these two tags used to */
  485 #define TIFFTAG_ASSHOTPREPROFILEMATRIX	50832	/* map cameras's color space
  486 						   into ICC profile space */
  487 #define TIFFTAG_CURRENTICCPROFILE	50833	/* & */
  488 #define TIFFTAG_CURRENTPREPROFILEMATRIX	50834	/* & */
  489 /* tag 65535 is an undefined tag used by Eastman Kodak */
  490 #define TIFFTAG_DCSHUESHIFTVALUES       65535   /* hue shift correction data */
  491 
  492 /*
  493  * The following are ``pseudo tags'' that can be used to control
  494  * codec-specific functionality.  These tags are not written to file.
  495  * Note that these values start at 0xffff+1 so that they'll never
  496  * collide with Aldus-assigned tags.
  497  *
  498  * If you want your private pseudo tags ``registered'' (i.e. added to
  499  * this file), please post a bug report via the tracking system at
  500  * http://www.remotesensing.org/libtiff/bugs.html with the appropriate
  501  * C definitions to add.
  502  */
  503 #define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
  504 #define	    FAXMODE_CLASSIC	0x0000		/* default, include RTC */
  505 #define	    FAXMODE_NORTC	0x0001		/* no RTC at end of data */
  506 #define	    FAXMODE_NOEOL	0x0002		/* no EOL code at end of row */
  507 #define	    FAXMODE_BYTEALIGN	0x0004		/* byte align row */
  508 #define	    FAXMODE_WORDALIGN	0x0008		/* word align row */
  509 #define	    FAXMODE_CLASSF	FAXMODE_NORTC	/* TIFF Class F */
  510 #define	TIFFTAG_JPEGQUALITY		65537	/* Compression quality level */
  511 /* Note: quality level is on the IJG 0-100 scale.  Default value is 75 */
  512 #define	TIFFTAG_JPEGCOLORMODE		65538	/* Auto RGB<=>YCbCr convert? */
  513 #define	    JPEGCOLORMODE_RAW	0x0000		/* no conversion (default) */
  514 #define	    JPEGCOLORMODE_RGB	0x0001		/* do auto conversion */
  515 #define	TIFFTAG_JPEGTABLESMODE		65539	/* What to put in JPEGTables */
  516 #define	    JPEGTABLESMODE_QUANT 0x0001		/* include quantization tbls */
  517 #define	    JPEGTABLESMODE_HUFF	0x0002		/* include Huffman tbls */
  518 /* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
  519 #define	TIFFTAG_FAXFILLFUNC		65540	/* G3/G4 fill function */
  520 #define	TIFFTAG_PIXARLOGDATAFMT		65549	/* PixarLogCodec I/O data sz */
  521 #define	    PIXARLOGDATAFMT_8BIT	0	/* regular u_char samples */
  522 #define	    PIXARLOGDATAFMT_8BITABGR	1	/* ABGR-order u_chars */
  523 #define	    PIXARLOGDATAFMT_11BITLOG	2	/* 11-bit log-encoded (raw) */
  524 #define	    PIXARLOGDATAFMT_12BITPICIO	3	/* as per PICIO (1.0==2048) */
  525 #define	    PIXARLOGDATAFMT_16BIT	4	/* signed short samples */
  526 #define	    PIXARLOGDATAFMT_FLOAT	5	/* IEEE float samples */
  527 /* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
  528 #define TIFFTAG_DCSIMAGERTYPE           65550   /* imager model & filter */
  529 #define     DCSIMAGERMODEL_M3           0       /* M3 chip (1280 x 1024) */
  530 #define     DCSIMAGERMODEL_M5           1       /* M5 chip (1536 x 1024) */
  531 #define     DCSIMAGERMODEL_M6           2       /* M6 chip (3072 x 2048) */
  532 #define     DCSIMAGERFILTER_IR          0       /* infrared filter */
  533 #define     DCSIMAGERFILTER_MONO        1       /* monochrome filter */
  534 #define     DCSIMAGERFILTER_CFA         2       /* color filter array */
  535 #define     DCSIMAGERFILTER_OTHER       3       /* other filter */
  536 #define TIFFTAG_DCSINTERPMODE           65551   /* interpolation mode */
  537 #define     DCSINTERPMODE_NORMAL        0x0     /* whole image, default */
  538 #define     DCSINTERPMODE_PREVIEW       0x1     /* preview of image (384x256) */
  539 #define TIFFTAG_DCSBALANCEARRAY         65552   /* color balance values */
  540 #define TIFFTAG_DCSCORRECTMATRIX        65553   /* color correction values */
  541 #define TIFFTAG_DCSGAMMA                65554   /* gamma value */
  542 #define TIFFTAG_DCSTOESHOULDERPTS       65555   /* toe & shoulder points */
  543 #define TIFFTAG_DCSCALIBRATIONFD        65556   /* calibration file desc */
  544 /* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
  545 #define	TIFFTAG_ZIPQUALITY		65557	/* compression quality level */
  546 #define	TIFFTAG_PIXARLOGQUALITY		65558	/* PixarLog uses same scale */
  547 /* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
  548 #define TIFFTAG_DCSCLIPRECTANGLE	65559	/* area of image to acquire */
  549 #define TIFFTAG_SGILOGDATAFMT		65560	/* SGILog user data format */
  550 #define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
  551 #define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
  552 #define     SGILOGDATAFMT_RAW		2	/* uninterpreted data */
  553 #define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  554 #define TIFFTAG_SGILOGENCODE		65561 /* SGILog data encoding control*/
  555 #define     SGILOGENCODE_NODITHER	0     /* do not dither encoded values*/
  556 #define     SGILOGENCODE_RANDITHER	1     /* randomly dither encd values */
  557 
  558 /*
  559  * EXIF tags
  560  */
  561 #define EXIFTAG_EXPOSURETIME		33434	/* Exposure time */
  562 #define EXIFTAG_FNUMBER			33437	/* F number */
  563 #define EXIFTAG_EXPOSUREPROGRAM		34850	/* Exposure program */
  564 #define EXIFTAG_SPECTRALSENSITIVITY	34852	/* Spectral sensitivity */
  565 #define EXIFTAG_ISOSPEEDRATINGS		34855	/* ISO speed rating */
  566 #define EXIFTAG_OECF			34856	/* Optoelectric conversion
  567 						   factor */
  568 #define EXIFTAG_EXIFVERSION		36864	/* Exif version */
  569 #define EXIFTAG_DATETIMEORIGINAL	36867	/* Date and time of original
  570 						   data generation */
  571 #define EXIFTAG_DATETIMEDIGITIZED	36868	/* Date and time of digital
  572 						   data generation */
  573 #define EXIFTAG_COMPONENTSCONFIGURATION	37121	/* Meaning of each component */
  574 #define EXIFTAG_COMPRESSEDBITSPERPIXEL	37122	/* Image compression mode */
  575 #define EXIFTAG_SHUTTERSPEEDVALUE	37377	/* Shutter speed */
  576 #define EXIFTAG_APERTUREVALUE		37378	/* Aperture */
  577 #define EXIFTAG_BRIGHTNESSVALUE		37379	/* Brightness */
  578 #define EXIFTAG_EXPOSUREBIASVALUE	37380	/* Exposure bias */
  579 #define EXIFTAG_MAXAPERTUREVALUE	37381	/* Maximum lens aperture */
  580 #define EXIFTAG_SUBJECTDISTANCE		37382	/* Subject distance */
  581 #define EXIFTAG_METERINGMODE		37383	/* Metering mode */
  582 #define EXIFTAG_LIGHTSOURCE		37384	/* Light source */
  583 #define EXIFTAG_FLASH			37385	/* Flash */
  584 #define EXIFTAG_FOCALLENGTH		37386	/* Lens focal length */
  585 #define EXIFTAG_SUBJECTAREA		37396	/* Subject area */
  586 #define EXIFTAG_MAKERNOTE		37500	/* Manufacturer notes */
  587 #define EXIFTAG_USERCOMMENT		37510	/* User comments */
  588 #define EXIFTAG_SUBSECTIME		37520	/* DateTime subseconds */
  589 #define EXIFTAG_SUBSECTIMEORIGINAL	37521	/* DateTimeOriginal subseconds */
  590 #define EXIFTAG_SUBSECTIMEDIGITIZED	37522	/* DateTimeDigitized subseconds */
  591 #define EXIFTAG_FLASHPIXVERSION		40960	/* Supported Flashpix version */
  592 #define EXIFTAG_COLORSPACE		40961	/* Color space information */
  593 #define EXIFTAG_PIXELXDIMENSION		40962	/* Valid image width */
  594 #define EXIFTAG_PIXELYDIMENSION		40963	/* Valid image height */
  595 #define EXIFTAG_RELATEDSOUNDFILE	40964	/* Related audio file */
  596 #define EXIFTAG_FLASHENERGY		41483	/* Flash energy */
  597 #define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484	/* Spatial frequency response */
  598 #define EXIFTAG_FOCALPLANEXRESOLUTION	41486	/* Focal plane X resolution */
  599 #define EXIFTAG_FOCALPLANEYRESOLUTION	41487	/* Focal plane Y resolution */
  600 #define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488	/* Focal plane resolution unit */
  601 #define EXIFTAG_SUBJECTLOCATION		41492	/* Subject location */
  602 #define EXIFTAG_EXPOSUREINDEX		41493	/* Exposure index */
  603 #define EXIFTAG_SENSINGMETHOD		41495	/* Sensing method */
  604 #define EXIFTAG_FILESOURCE		41728	/* File source */
  605 #define EXIFTAG_SCENETYPE		41729	/* Scene type */
  606 #define EXIFTAG_CFAPATTERN		41730	/* CFA pattern */
  607 #define EXIFTAG_CUSTOMRENDERED		41985	/* Custom image processing */
  608 #define EXIFTAG_EXPOSUREMODE		41986	/* Exposure mode */
  609 #define EXIFTAG_WHITEBALANCE		41987	/* White balance */
  610 #define EXIFTAG_DIGITALZOOMRATIO	41988	/* Digital zoom ratio */
  611 #define EXIFTAG_FOCALLENGTHIN35MMFILM	41989	/* Focal length in 35 mm film */
  612 #define EXIFTAG_SCENECAPTURETYPE	41990	/* Scene capture type */
  613 #define EXIFTAG_GAINCONTROL		41991	/* Gain control */
  614 #define EXIFTAG_CONTRAST		41992	/* Contrast */
  615 #define EXIFTAG_SATURATION		41993	/* Saturation */
  616 #define EXIFTAG_SHARPNESS		41994	/* Sharpness */
  617 #define EXIFTAG_DEVICESETTINGDESCRIPTION 41995	/* Device settings description */
  618 #define EXIFTAG_SUBJECTDISTANCERANGE	41996	/* Subject distance range */
  619 #define EXIFTAG_GAINCONTROL		41991	/* Gain control */
  620 #define EXIFTAG_GAINCONTROL		41991	/* Gain control */
  621 #define EXIFTAG_IMAGEUNIQUEID		42016	/* Unique image ID */
  622 
  623 
  624 /*
  625  * The following typedefs define the intrinsic size of
  626  * data types used in the *exported* interfaces.  These
  627  * definitions depend on the proper definition of types
  628  * in tiff.h.  Note also that the varargs interface used
  629  * to pass tag types and values uses the types defined in
  630  * tiff.h directly.
  631  *
  632  * NB: ttag_t is unsigned int and not unsigned short because
  633  *     ANSI C requires that the type before the ellipsis be a
  634  *     promoted type (i.e. one of int, unsigned int, pointer,
  635  *     or double) and because we defined pseudo-tags that are
  636  *     outside the range of legal Aldus-assigned tags.
  637  * NB: tsize_t is int32 and not uint32 because some functions
  638  *     return -1.
  639  * NB: toff_t is not off_t for many reasons; TIFFs max out at
  640  *     32-bit file offsets being the most important, and to ensure
  641  *     that it is unsigned, rather than signed.
  642  */
  643 
  644 typedef	uint32 ttag_t;		/* directory tag */
  645 typedef	uint16 tdir_t;		/* directory index */
  646 typedef	uint16 tsample_t;	/* sample number */
  647 typedef	uint32 tstrip_t;	/* strip number */
  648 typedef uint32 ttile_t;		/* tile number */
  649 typedef	int32 tsize_t;		/* i/o size in bytes */
  650 typedef	void* tdata_t;		/* image data ref */
  651 typedef	uint32 toff_t;		/* file offset */
  652 typedef	void* thandle_t;	/* client data handle */
  653 
  654 #ifndef NULL
  655 # define NULL	(void *)0
  656 #endif
  657 
  658 /*
  659  * Flags to pass to TIFFPrintDirectory to control
  660  * printing of data structures that are potentially
  661  * very large.   Bit-or these flags to enable printing
  662  * multiple items.
  663  */
  664 #define	TIFFPRINT_NONE		0x0		/* no extra info */
  665 #define	TIFFPRINT_STRIPS	0x1		/* strips/tiles info */
  666 #define	TIFFPRINT_CURVES	0x2		/* color/gray response curves */
  667 #define	TIFFPRINT_COLORMAP	0x4		/* colormap */
  668 #define	TIFFPRINT_JPEGQTABLES	0x100		/* JPEG Q matrices */
  669 #define	TIFFPRINT_JPEGACTABLES	0x200		/* JPEG AC tables */
  670 #define	TIFFPRINT_JPEGDCTABLES	0x200		/* JPEG DC tables */
  671 
  672 /* 
  673  * Colour conversion stuff
  674  */
  675 
  676 /* reference white */
  677 #define D65_X0 (95.0470F)
  678 #define D65_Y0 (100.0F)
  679 #define D65_Z0 (108.8827F)
  680 
  681 #define D50_X0 (96.4250F)
  682 #define D50_Y0 (100.0F)
  683 #define D50_Z0 (82.4680F)
  684 
  685 /* Structure for holding information about a display device. */
  686 
  687 typedef	unsigned char TIFFRGBValue;		/* 8-bit samples */
  688 
  689 typedef struct {
  690 	float d_mat[3][3]; 		/* XYZ -> luminance matrix */
  691 	float d_YCR;			/* Light o/p for reference white */
  692 	float d_YCG;
  693 	float d_YCB;
  694 	uint32 d_Vrwr;			/* Pixel values for ref. white */
  695 	uint32 d_Vrwg;
  696 	uint32 d_Vrwb;
  697 	float d_Y0R;			/* Residual light for black pixel */
  698 	float d_Y0G;
  699 	float d_Y0B;
  700 	float d_gammaR;			/* Gamma values for the three guns */
  701 	float d_gammaG;
  702 	float d_gammaB;
  703 } TIFFDisplay;
  704 
  705 typedef struct {				/* YCbCr->RGB support */
  706 	TIFFRGBValue* clamptab;			/* range clamping table */
  707 	int*	Cr_r_tab;
  708 	int*	Cb_b_tab;
  709 	int32*	Cr_g_tab;
  710 	int32*	Cb_g_tab;
  711 	int32*	Y_tab;
  712 } TIFFYCbCrToRGB;
  713 
  714 typedef struct {				/* CIE Lab 1976->RGB support */
  715 	int	range;				/* Size of conversion table */
  716 #define CIELABTORGB_TABLE_RANGE 1500
  717 	float	rstep, gstep, bstep;
  718 	float	X0, Y0, Z0;			/* Reference white point */
  719 	TIFFDisplay display;
  720 	float	Yr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */
  721 	float	Yg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */
  722 	float	Yb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */
  723 } TIFFCIELabToRGB;
  724 
  725 
  726 /*
  727  * RGBA-style image support.
  728  */
  729 typedef struct _TIFFRGBAImage TIFFRGBAImage;
  730 /*
  731  * The image reading and conversion routines invoke
  732  * ``put routines'' to copy/image/whatever tiles of
  733  * raw image data.  A default set of routines are 
  734  * provided to convert/copy raw image data to 8-bit
  735  * packed ABGR format rasters.  Applications can supply
  736  * alternate routines that unpack the data into a
  737  * different format or, for example, unpack the data
  738  * and draw the unpacked raster on the display.
  739  */
  740 typedef void (*tileContigRoutine)
  741     (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
  742 	unsigned char*);
  743 typedef void (*tileSeparateRoutine)
  744     (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
  745 	unsigned char*, unsigned char*, unsigned char*, unsigned char*);
  746 
  747 /*
  748  * RGBA-reader state.
  749  */
  750 struct _TIFFRGBAImage {
  751 	TIFF*	tif;				/* image handle */
  752 	int	stoponerr;			/* stop on read error */
  753 	int	isContig;			/* data is packed/separate */
  754 	int	alpha;				/* type of alpha data present */
  755 	uint32	width;				/* image width */
  756 	uint32	height;				/* image height */
  757 	uint16	bitspersample;			/* image bits/sample */
  758 	uint16	samplesperpixel;		/* image samples/pixel */
  759 	uint16	orientation;			/* image orientation */
  760 	uint16	req_orientation;		/* requested orientation */
  761 	uint16	photometric;			/* image photometric interp */
  762 	uint16*	redcmap;			/* colormap pallete */
  763 	uint16*	greencmap;
  764 	uint16*	bluecmap;
  765 						/* get image data routine */
  766 	int	(*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
  767 	union {
  768 	    void (*any)(TIFFRGBAImage*);
  769 	    tileContigRoutine	contig;
  770 	    tileSeparateRoutine	separate;
  771 	} put;					/* put decoded strip/tile */
  772 	TIFFRGBValue* Map;			/* sample mapping array */
  773 	uint32** BWmap;				/* black&white map */
  774 	uint32** PALmap;			/* palette image map */
  775 	TIFFYCbCrToRGB* ycbcr;			/* YCbCr conversion state */
  776 	TIFFCIELabToRGB* cielab;		/* CIE L*a*b conversion state */
  777 
  778 	int row_offset;
  779 	int col_offset;
  780 };
  781 
  782 /*
  783  * Macros for extracting components from the
  784  * packed ABGR form returned by TIFFReadRGBAImage.
  785  */
  786 #define	TIFFGetR(abgr)	((abgr) & 0xff)
  787 #define	TIFFGetG(abgr)	(((abgr) >> 8) & 0xff)
  788 #define	TIFFGetB(abgr)	(((abgr) >> 16) & 0xff)
  789 #define	TIFFGetA(abgr)	(((abgr) >> 24) & 0xff)
  790 
  791 /*
  792  * A CODEC is a software package that implements decoding,
  793  * encoding, or decoding+encoding of a compression algorithm.
  794  * The library provides a collection of builtin codecs.
  795  * More codecs may be registered through calls to the library
  796  * and/or the builtin implementations may be overridden.
  797  */
  798 typedef	int (*TIFFInitMethod)(TIFF*, int);
  799 typedef struct {
  800 	char*		name;
  801 	uint16		scheme;
  802 	TIFFInitMethod	init;
  803 } TIFFCodec;
  804 
  805 #include <stdio.h>
  806 #include <stdarg.h>
  807 
  808 typedef	void (*TIFFErrorHandler)(const char*, const char*, va_list);
  809 typedef	void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
  810 typedef	tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
  811 typedef	toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
  812 typedef	int (*TIFFCloseProc)(thandle_t);
  813 typedef	toff_t (*TIFFSizeProc)(thandle_t);
  814 typedef	int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
  815 typedef	void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
  816 typedef	void (*TIFFExtendProc)(TIFF*); 
  817 
  818 /* share internal LogLuv conversion routines? */
  819 #ifndef LOGLUV_PUBLIC
  820 #define LOGLUV_PUBLIC		0
  821 #endif
  822 
  823 
  824 /*
  825 ** Stuff, related to tag handling and creating custom tags.
  826 */
  827     
  828 #define	TIFF_ANY	TIFF_NOTYPE	/* for field descriptor searching */
  829 #define	TIFF_VARIABLE	-1		/* marker for variable length tags */
  830 #define	TIFF_SPP	-2		/* marker for SamplesPerPixel tags */
  831 #define	TIFF_VARIABLE2	-3		/* marker for uint32 var-length tags */
  832 
  833 #define FIELD_CUSTOM    65    
  834 
  835 typedef	struct {
  836 	ttag_t	field_tag;		/* field's tag */
  837 	short	field_readcount;	/* read count/TIFF_VARIABLE/TIFF_SPP */
  838 	short	field_writecount;	/* write count/TIFF_VARIABLE */
  839 	TIFFDataType field_type;	/* type of associated data */
  840 	unsigned short field_bit;	/* bit in fieldsset bit vector */
  841 	unsigned char field_oktochange;	/* if true, can change while writing */
  842 	unsigned char field_passcount;	/* if true, pass dir count on set */
  843 	char	*field_name;		/* ASCII name */
  844 } TIFFFieldInfo;
  845 
  846 typedef struct _TIFFTagValue {
  847     const TIFFFieldInfo  *info;
  848     int             count;
  849     void           *value;
  850 } TIFFTagValue;
  851 
  852 typedef	int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
  853 typedef	int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
  854 typedef	void (*TIFFPrintMethodFH)(TIFF*, BPTR, long);
  855     
  856 typedef struct {
  857     TIFFVSetMethod	vsetfield;	/* tag set routine */
  858     TIFFVGetMethod	vgetfield;	/* tag get routine */
  859     TIFFPrintMethodFH	printdirfh;	/* directory print routine */
  860 } TIFFTagMethods;
  861         
  862 
  863 #ifdef __cplusplus
  864 }
  865 #endif
  866 
  867 #endif /* LIBRARIES_TIFF_H */