source: trunk/third/tiff/libtiff/tif_dir.h @ 18174

Revision 18174, 8.7 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18173, which included commits to RCS files with non-trunk default branches.
Line 
1/* $Header: /afs/dev.mit.edu/source/repository/third/tiff/libtiff/tif_dir.h,v 1.1.1.1 2002-12-26 02:38:46 ghudson 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 _TIFFDIR_
28#define _TIFFDIR_
29/*
30 * ``Library-private'' Directory-related Definitions.
31 */
32
33/*
34 * Internal format of a TIFF directory entry.
35 */
36typedef struct {
37#define FIELD_SETLONGS  3
38        /* bit vector of fields that are set */
39        u_long  td_fieldsset[FIELD_SETLONGS];
40
41        uint32  td_imagewidth, td_imagelength, td_imagedepth;
42        uint32  td_tilewidth, td_tilelength, td_tiledepth;
43        uint32  td_subfiletype;
44        uint16  td_bitspersample;
45        uint16  td_sampleformat;
46        uint16  td_compression;
47        uint16  td_photometric;
48        uint16  td_threshholding;
49        uint16  td_fillorder;
50        uint16  td_orientation;
51        uint16  td_samplesperpixel;
52        uint32  td_rowsperstrip;
53        uint16  td_minsamplevalue, td_maxsamplevalue;
54        double  td_sminsamplevalue, td_smaxsamplevalue;
55        float   td_xresolution, td_yresolution;
56        uint16  td_resolutionunit;
57        uint16  td_planarconfig;
58        float   td_xposition, td_yposition;
59        uint16  td_pagenumber[2];
60        uint16* td_colormap[3];
61        uint16  td_halftonehints[2];
62        uint16  td_extrasamples;
63        uint16* td_sampleinfo;
64        double  td_stonits;
65        char*   td_documentname;
66        char*   td_artist;
67        char*   td_datetime;
68        char*   td_hostcomputer;
69        char*   td_imagedescription;
70        char*   td_make;
71        char*   td_model;
72        char*   td_software;
73        char*   td_copyright;
74        char*   td_pagename;
75        tstrip_t td_stripsperimage;
76        tstrip_t td_nstrips;            /* size of offset & bytecount arrays */
77        uint32* td_stripoffset;
78        uint32* td_stripbytecount;
79#if SUBIFD_SUPPORT
80        uint16  td_nsubifd;
81        uint32* td_subifd;
82#endif
83#ifdef YCBCR_SUPPORT
84        float*  td_ycbcrcoeffs;
85        uint16  td_ycbcrsubsampling[2];
86        uint16  td_ycbcrpositioning;
87#endif
88#ifdef COLORIMETRY_SUPPORT
89        float*  td_whitepoint;
90        float*  td_primarychromas;
91        float*  td_refblackwhite;
92        uint16* td_transferfunction[3];
93#endif
94#ifdef CMYK_SUPPORT
95        uint16  td_inkset;
96        uint16  td_ninks;
97        uint16  td_dotrange[2];
98        int     td_inknameslen;
99        char*   td_inknames;
100        char*   td_targetprinter;
101#endif
102#ifdef ICC_SUPPORT
103        uint32  td_profileLength;
104        void    *td_profileData;
105#endif
106#ifdef PHOTOSHOP_SUPPORT
107        uint32  td_photoshopLength;
108        void    *td_photoshopData;
109#endif
110#ifdef IPTC_SUPPORT
111        uint32  td_richtiffiptcLength;
112        void    *td_richtiffiptcData;
113#endif
114        /* Begin Pixar Tag values. */
115        uint32  td_imagefullwidth, td_imagefulllength;
116        char*   td_textureformat;
117        char*   td_wrapmodes;
118        float   td_fovcot;
119        float*  td_matrixWorldToScreen;
120        float*  td_matrixWorldToCamera;
121        /* End Pixar Tag Values. */
122} TIFFDirectory;
123
124/*
125 * Field flags used to indicate fields that have
126 * been set in a directory, and to reference fields
127 * when manipulating a directory.
128 */
129
130/*
131 * FIELD_IGNORE is used to signify tags that are to
132 * be processed but otherwise ignored.  This permits
133 * antiquated tags to be quietly read and discarded.
134 * Note that a bit *is* allocated for ignored tags;
135 * this is understood by the directory reading logic
136 * which uses this fact to avoid special-case handling
137 */
138#define FIELD_IGNORE                    0
139
140/* multi-item fields */
141#define FIELD_IMAGEDIMENSIONS           1
142#define FIELD_TILEDIMENSIONS            2
143#define FIELD_RESOLUTION                3
144#define FIELD_POSITION                  4
145
146/* single-item fields */
147#define FIELD_SUBFILETYPE               5
148#define FIELD_BITSPERSAMPLE             6
149#define FIELD_COMPRESSION               7
150#define FIELD_PHOTOMETRIC               8
151#define FIELD_THRESHHOLDING             9
152#define FIELD_FILLORDER                 10
153#define FIELD_DOCUMENTNAME              11
154#define FIELD_IMAGEDESCRIPTION          12
155#define FIELD_MAKE                      13
156#define FIELD_MODEL                     14
157#define FIELD_ORIENTATION               15
158#define FIELD_SAMPLESPERPIXEL           16
159#define FIELD_ROWSPERSTRIP              17
160#define FIELD_MINSAMPLEVALUE            18
161#define FIELD_MAXSAMPLEVALUE            19
162#define FIELD_PLANARCONFIG              20
163#define FIELD_PAGENAME                  21
164#define FIELD_RESOLUTIONUNIT            22
165#define FIELD_PAGENUMBER                23
166#define FIELD_STRIPBYTECOUNTS           24
167#define FIELD_STRIPOFFSETS              25
168#define FIELD_COLORMAP                  26
169#define FIELD_ARTIST                    27
170#define FIELD_DATETIME                  28
171#define FIELD_HOSTCOMPUTER              29
172#define FIELD_SOFTWARE                  30
173#define FIELD_EXTRASAMPLES              31
174#define FIELD_SAMPLEFORMAT              32
175#define FIELD_SMINSAMPLEVALUE           33
176#define FIELD_SMAXSAMPLEVALUE           34
177#define FIELD_IMAGEDEPTH                35
178#define FIELD_TILEDEPTH                 36
179#define FIELD_HALFTONEHINTS             37
180#define FIELD_YCBCRCOEFFICIENTS         38
181#define FIELD_YCBCRSUBSAMPLING          39
182#define FIELD_YCBCRPOSITIONING          40
183#define FIELD_REFBLACKWHITE             41
184#define FIELD_WHITEPOINT                42
185#define FIELD_PRIMARYCHROMAS            43
186#define FIELD_TRANSFERFUNCTION          44
187#define FIELD_INKSET                    45
188#define FIELD_INKNAMES                  46
189#define FIELD_DOTRANGE                  47
190#define FIELD_TARGETPRINTER             48
191#define FIELD_SUBIFD                    49
192#define FIELD_NUMBEROFINKS              50
193#define FIELD_ICCPROFILE                51
194#define FIELD_PHOTOSHOP                 52
195#define FIELD_RICHTIFFIPTC              53
196#define FIELD_STONITS                   54
197/* Begin PIXAR */
198#define FIELD_IMAGEFULLWIDTH            55
199#define FIELD_IMAGEFULLLENGTH           56
200#define FIELD_TEXTUREFORMAT             57
201#define FIELD_WRAPMODES                 58
202#define FIELD_FOVCOT                    59
203#define FIELD_MATRIX_WORLDTOSCREEN      60
204#define FIELD_MATRIX_WORLDTOCAMERA      61
205#define FIELD_COPYRIGHT                 62
206/* end of support for well-known tags; codec-private tags follow */
207#define FIELD_CODEC                     63      /* base of codec-private tags */
208/*
209 * Pseudo-tags don't normally need field bits since they
210 * are not written to an output file (by definition).
211 * The library also has express logic to always query a
212 * codec for a pseudo-tag so allocating a field bit for
213 * one is a waste.   If codec wants to promote the notion
214 * of a pseudo-tag being ``set'' or ``unset'' then it can
215 * do using internal state flags without polluting the
216 * field bit space defined for real tags.
217 */
218#define FIELD_PSEUDO                    0
219
220#define FIELD_LAST                      (32*FIELD_SETLONGS-1)
221
222#define TIFFExtractData(tif, type, v) \
223    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
224        ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \
225        (v) & (tif)->tif_typemask[type]))
226#define TIFFInsertData(tif, type, v) \
227    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
228        ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \
229        (v) & (tif)->tif_typemask[type]))
230
231typedef struct {
232        ttag_t  field_tag;              /* field's tag */
233        short   field_readcount;        /* read count/TIFF_VARIABLE/TIFF_SPP */
234        short   field_writecount;       /* write count/TIFF_VARIABLE */
235        TIFFDataType field_type;        /* type of associated data */
236        u_short field_bit;              /* bit in fieldsset bit vector */
237        u_char  field_oktochange;       /* if true, can change while writing */
238        u_char  field_passcount;        /* if true, pass dir count on set */
239        char    *field_name;            /* ASCII name */
240} TIFFFieldInfo;
241
242#define TIFF_ANY        TIFF_NOTYPE     /* for field descriptor searching */
243#define TIFF_VARIABLE   -1              /* marker for variable length tags */
244#define TIFF_SPP        -2              /* marker for SamplesPerPixel tags */
245#define TIFF_VARIABLE2  -3              /* marker for uint32 var-length tags */
246
247extern  const int tiffDataWidth[];      /* table of tag datatype widths */
248
249#define BITn(n)                         (((u_long)1L)<<((n)&0x1f))
250#define BITFIELDn(tif, n)               ((tif)->tif_dir.td_fieldsset[(n)/32])
251#define TIFFFieldSet(tif, field)        (BITFIELDn(tif, field) & BITn(field))
252#define TIFFSetFieldBit(tif, field)     (BITFIELDn(tif, field) |= BITn(field))
253#define TIFFClrFieldBit(tif, field)     (BITFIELDn(tif, field) &= ~BITn(field))
254
255#define FieldSet(fields, f)             (fields[(f)/32] & BITn(f))
256#define ResetFieldBit(fields, f)        (fields[(f)/32] &= ~BITn(f))
257
258#if defined(__cplusplus)
259extern "C" {
260#endif
261extern  void _TIFFSetupFieldInfo(TIFF*);
262extern  void _TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
263extern  void _TIFFPrintFieldInfo(TIFF*, FILE*);
264extern  const TIFFFieldInfo* _TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
265extern  const TIFFFieldInfo* _TIFFFieldWithTag(TIFF*, ttag_t);
266extern  TIFFDataType _TIFFSampleToTagType(TIFF*);
267#if defined(__cplusplus)
268}
269#endif
270#endif /* _TIFFDIR_ */
Note: See TracBrowser for help on using the repository browser.