| Bsoft 1.9 Bernard's software package

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

tif_dir.h
Go to the documentation of this file.
1 /* $Id: tif_dir.h,v 1.30.2.3 2010-06-09 21:15:27 bfriesen 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 4
38 /* bit vector of fields that are set */
39 unsigned 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 /* even though the name is misleading, td_stripsperimage is the number
65 * of striles (=strips or tiles) per plane, and td_nstrips the total
66 * number of striles */
67 tstrile_t td_stripsperimage;
68 tstrile_t td_nstrips; /* size of offset & bytecount arrays */
69 toff_t* td_stripoffset;
70 toff_t* td_stripbytecount; /* FIXME: it should be tsize_t array */
71 int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
72 uint16 td_nsubifd;
73 uint32* td_subifd;
74 /* YCbCr parameters */
75 uint16 td_ycbcrsubsampling[2];
76 uint16 td_ycbcrpositioning;
77 /* Colorimetry parameters */
78 float* td_refblackwhite;
79 uint16* td_transferfunction[3];
80 /* CMYK parameters */
81 int td_inknameslen;
82 char* td_inknames;
83
84 int td_customValueCount;
85 TIFFTagValue *td_customValues;
86 } TIFFDirectory;
87
88 /*
89 * Field flags used to indicate fields that have
90 * been set in a directory, and to reference fields
91 * when manipulating a directory.
92 */
93
94 /*
95 * FIELD_IGNORE is used to signify tags that are to
96 * be processed but otherwise ignored. This permits
97 * antiquated tags to be quietly read and discarded.
98 * Note that a bit *is* allocated for ignored tags;
99 * this is understood by the directory reading logic
100 * which uses this fact to avoid special-case handling
101 */
102 #define FIELD_IGNORE 0
103
104 /* multi-item fields */
105 #define FIELD_IMAGEDIMENSIONS 1
106 #define FIELD_TILEDIMENSIONS 2
107 #define FIELD_RESOLUTION 3
108 #define FIELD_POSITION 4
109
110 /* single-item fields */
111 #define FIELD_SUBFILETYPE 5
112 #define FIELD_BITSPERSAMPLE 6
113 #define FIELD_COMPRESSION 7
114 #define FIELD_PHOTOMETRIC 8
115 #define FIELD_THRESHHOLDING 9
116 #define FIELD_FILLORDER 10
117 #define FIELD_ORIENTATION 15
118 #define FIELD_SAMPLESPERPIXEL 16
119 #define FIELD_ROWSPERSTRIP 17
120 #define FIELD_MINSAMPLEVALUE 18
121 #define FIELD_MAXSAMPLEVALUE 19
122 #define FIELD_PLANARCONFIG 20
123 #define FIELD_RESOLUTIONUNIT 22
124 #define FIELD_PAGENUMBER 23
125 #define FIELD_STRIPBYTECOUNTS 24
126 #define FIELD_STRIPOFFSETS 25
127 #define FIELD_COLORMAP 26
128 #define FIELD_EXTRASAMPLES 31
129 #define FIELD_SAMPLEFORMAT 32
130 #define FIELD_SMINSAMPLEVALUE 33
131 #define FIELD_SMAXSAMPLEVALUE 34
132 #define FIELD_IMAGEDEPTH 35
133 #define FIELD_TILEDEPTH 36
134 #define FIELD_HALFTONEHINTS 37
135 #define FIELD_YCBCRSUBSAMPLING 39
136 #define FIELD_YCBCRPOSITIONING 40
137 #define FIELD_REFBLACKWHITE 41
138 #define FIELD_TRANSFERFUNCTION 44
139 #define FIELD_INKNAMES 46
140 #define FIELD_SUBIFD 49
141 /* FIELD_CUSTOM (see tiffio.h) 65 */
142 /* end of support for well-known tags; codec-private tags follow */
143 #define FIELD_CODEC 66 /* base of codec-private tags */
144
145
146 /*
147 * Pseudo-tags don't normally need field bits since they
148 * are not written to an output file (by definition).
149 * The library also has express logic to always query a
150 * codec for a pseudo-tag so allocating a field bit for
151 * one is a waste. If codec wants to promote the notion
152 * of a pseudo-tag being ``set'' or ``unset'' then it can
153 * do using internal state flags without polluting the
154 * field bit space defined for real tags.
155 */
156 #define FIELD_PSEUDO 0
157
158 #define FIELD_LAST (32*FIELD_SETLONGS-1)
159
160 #define TIFFExtractData(tif, type, v) \
161 ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
162 ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \
163 (v) & (tif)->tif_typemask[type]))
164 #define TIFFInsertData(tif, type, v) \
165 ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
166 ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \
167 (v) & (tif)->tif_typemask[type]))
168
169
170 #define BITn(n) (((unsigned long)1L)<<((n)&0x1f))
171 #define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32])
172 #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
173 #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
174 #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
175
176 #define FieldSet(fields, f) (fields[(f)/32] & BITn(f))
177 #define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f))
178
179 #if defined(__cplusplus)
180 extern "C" {
181 #endif
182 extern const TIFFFieldInfo *_TIFFGetFieldInfo(size_t *);
183 extern const TIFFFieldInfo *_TIFFGetExifFieldInfo(size_t *);
184 extern void _TIFFSetupFieldInfo(TIFF*, const TIFFFieldInfo[], size_t);
185 extern int _TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
186 extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
187 extern TIFFDataType _TIFFSampleToTagType(TIFF*);
188 extern const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,
189 ttag_t tag,
190 TIFFDataType dt );
191 extern TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
192 TIFFDataType dt );
193
194 #define _TIFFFindFieldInfo TIFFFindFieldInfo
195 #define _TIFFFindFieldInfoByName TIFFFindFieldInfoByName
196 #define _TIFFFieldWithTag TIFFFieldWithTag
197 #define _TIFFFieldWithName TIFFFieldWithName
198
199 #if defined(__cplusplus)
200 }
201 #endif
202 #endif /* _TIFFDIR_ */
203
204 /* vim: set ts=8 sts=8 sw=8 noet: */
205 /*
206 * Local Variables:
207 * mode: c
208 * c-basic-offset: 8
209 * fill-column: 78
210 * End:
211 */
ttag_t
uint32 ttag_t
Definition: tiffio.h:61
TIFFDirectory::td_threshholding
uint16 td_threshholding
Definition: tif_dir.h:48
TIFFDirectory::td_refblackwhite
float * td_refblackwhite
Definition: tif_dir.h:78
TIFFDirectory::td_imagewidth
uint32 td_imagewidth
Definition: tif_dir.h:41
TIFFDirectory::td_stripsperimage
tstrile_t td_stripsperimage
Definition: tif_dir.h:67
_TIFFGetExifFieldInfo
const TIFFFieldInfo * _TIFFGetExifFieldInfo(size_t *)
Definition: tif_dirinfo.c:523
TIFFDirectory::td_bitspersample
uint16 td_bitspersample
Definition: tif_dir.h:44
TIFFDirectory::td_nsubifd
uint16 td_nsubifd
Definition: tif_dir.h:72
TIFFDirectory::td_minsamplevalue
uint16 td_minsamplevalue
Definition: tif_dir.h:53
_TIFFPrintFieldInfo
void _TIFFPrintFieldInfo(TIFF *, FILE *)
Definition: tif_dirinfo.c:638
TIFFDirectory::td_customValues
TIFFTagValue * td_customValues
Definition: tif_dir.h:85
TIFFDirectory::td_subfiletype
uint32 td_subfiletype
Definition: tif_dir.h:43
_TIFFTagValue
Definition: tiffio.h:314
_TIFFGetFieldInfo
const TIFFFieldInfo * _TIFFGetFieldInfo(size_t *)
Definition: tif_dirinfo.c:516
_TIFFFindOrRegisterFieldInfo
const TIFFFieldInfo * _TIFFFindOrRegisterFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType dt)
Definition: tif_dirinfo.c:832
TIFFDirectory::td_inknameslen
int td_inknameslen
Definition: tif_dir.h:81
tiff
Definition: tiffiop.h:102
FIELD_SETLONGS
#define FIELD_SETLONGS
Definition: tif_dir.h:37
TIFFDirectory::td_extrasamples
uint16 td_extrasamples
Definition: tif_dir.h:62
TIFFDirectory::td_customValueCount
int td_customValueCount
Definition: tif_dir.h:84
_TIFFSampleToTagType
TIFFDataType _TIFFSampleToTagType(TIFF *)
Definition: tif_dirinfo.c:726
TIFFDirectory::td_orientation
uint16 td_orientation
Definition: tif_dir.h:50
TIFFDirectory::td_sampleinfo
uint16 * td_sampleinfo
Definition: tif_dir.h:63
TIFFDirectory::td_tilewidth
uint32 td_tilewidth
Definition: tif_dir.h:42
TIFFDirectory::td_stripbytecountsorted
int td_stripbytecountsorted
Definition: tif_dir.h:71
TIFFDirectory::td_stripoffset
toff_t * td_stripoffset
Definition: tif_dir.h:69
TIFFDirectory::td_nstrips
tstrile_t td_nstrips
Definition: tif_dir.h:68
uint16
unsigned short uint16
Definition: tiff.h:71
TIFFFieldInfo
Definition: tiffio.h:303
_TIFFMergeFieldInfo
int _TIFFMergeFieldInfo(TIFF *, const TIFFFieldInfo[], int)
Definition: tif_dirinfo.c:593
TIFFDirectory::td_subifd
uint32 * td_subifd
Definition: tif_dir.h:73
TIFFDirectory::td_rowsperstrip
uint32 td_rowsperstrip
Definition: tif_dir.h:52
tstrile_t
uint32 tstrile_t
Definition: tiffio.h:64
TIFFDirectory::td_yposition
float td_yposition
Definition: tif_dir.h:58
TIFFDirectory
Definition: tif_dir.h:36
TIFFDirectory::td_planarconfig
uint16 td_planarconfig
Definition: tif_dir.h:57
TIFFDirectory::td_samplesperpixel
uint16 td_samplesperpixel
Definition: tif_dir.h:51
TIFFDirectory::td_yresolution
float td_yresolution
Definition: tif_dir.h:55
TIFFDirectory::td_inknames
char * td_inknames
Definition: tif_dir.h:82
TIFFDirectory::td_sminsamplevalue
double td_sminsamplevalue
Definition: tif_dir.h:54
TIFFDirectory::td_ycbcrpositioning
uint16 td_ycbcrpositioning
Definition: tif_dir.h:76
toff_t
uint32 toff_t
Definition: tiffio.h:69
TIFFDirectory::td_compression
uint16 td_compression
Definition: tif_dir.h:46
TIFFDirectory::td_sampleformat
uint16 td_sampleformat
Definition: tif_dir.h:45
TIFFDirectory::td_resolutionunit
uint16 td_resolutionunit
Definition: tif_dir.h:56
TIFFDirectory::td_stripbytecount
toff_t * td_stripbytecount
Definition: tif_dir.h:70
TIFFDataType
TIFFDataType
Definition: tiff.h:137
TIFFDirectory::td_photometric
uint16 td_photometric
Definition: tif_dir.h:47
TIFFDirectory::td_fillorder
uint16 td_fillorder
Definition: tif_dir.h:49
_TIFFCreateAnonFieldInfo
TIFFFieldInfo * _TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType dt)
Definition: tif_dirinfo.c:849
_TIFFSetupFieldInfo
void _TIFFSetupFieldInfo(TIFF *, const TIFFFieldInfo[], size_t)
Definition: tif_dirinfo.c:530