w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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