Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

347 lines
18 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. tiff.h
  5. Abstract:
  6. This file the data structures and constant
  7. definitions for the TIFF file format.
  8. See the TIFF specification Revision 6.0,
  9. dated 6-3-92, from Adobe for specific details.
  10. Environment:
  11. WIN32 User Mode
  12. Author:
  13. Wesley Witt (wesw) 17-Feb-1996
  14. --*/
  15. #ifndef _TIFF_
  16. #define _TIFF_
  17. #define TIFF_VERSION 42
  18. #define TIFF_BIGENDIAN 0x4d4d
  19. #define TIFF_LITTLEENDIAN 0x4949
  20. #pragma pack(1)
  21. typedef struct _TIFF_HEADER {
  22. WORD Identifier;
  23. WORD Version;
  24. DWORD IFDOffset;
  25. } TIFF_HEADER, *PTIFF_HEADER;
  26. //
  27. // TIFF Image File Directories are comprised of
  28. // a table of field descriptors of the form shown
  29. // below. The table is sorted in ascending order
  30. // by tag. The values associated with each entry
  31. // are disjoint and may appear anywhere in the file
  32. // (so long as they are placed on a word boundary).
  33. //
  34. // If the value is 4 bytes or less, then it is placed
  35. // in the offset field to save space. If the value
  36. // is less than 4 bytes, it is left-justified in the
  37. // offset field.
  38. //
  39. typedef struct _TIFF_TAG {
  40. WORD TagId;
  41. WORD DataType;
  42. DWORD DataCount;
  43. DWORD DataOffset;
  44. } TIFF_TAG, *PTIFF_TAG;
  45. #pragma pack()
  46. //
  47. // NB: In the comments below,
  48. // - items marked with a + are obsoleted by revision 5.0,
  49. // - items marked with a ! are introduced in revision 6.0.
  50. // - items marked with a % are introduced post revision 6.0.
  51. // - items marked with a $ are obsoleted by revision 6.0.
  52. //
  53. //
  54. // Tag data type information.
  55. //
  56. #define TIFF_NOTYPE 0 // placeholder
  57. #define TIFF_BYTE 1 // 8-bit unsigned integer
  58. #define TIFF_ASCII 2 // 8-bit bytes w/ last byte null
  59. #define TIFF_SHORT 3 // 16-bit unsigned integer
  60. #define TIFF_LONG 4 // 32-bit unsigned integer
  61. #define TIFF_RATIONAL 5 // 64-bit unsigned fraction
  62. #define TIFF_SBYTE 6 // !8-bit signed integer
  63. #define TIFF_UNDEFINED 7 // !8-bit untyped data
  64. #define TIFF_SSHORT 8 // !16-bit signed integer
  65. #define TIFF_SLONG 9 // !32-bit signed integer
  66. #define TIFF_SRATIONAL 10 // !64-bit signed fraction
  67. #define TIFF_FLOAT 11 // !32-bit IEEE floating point
  68. #define TIFF_DOUBLE 12 // !64-bit IEEE floating point
  69. //
  70. // TIFF Tag Definitions.
  71. //
  72. #define TIFFTAG_SUBFILETYPE 254 // subfile data descriptor
  73. #define FILETYPE_REDUCEDIMAGE 0x1 // reduced resolution version
  74. #define FILETYPE_PAGE 0x2 // one page of many
  75. #define FILETYPE_MASK 0x4 // transparency mask
  76. #define TIFFTAG_OSUBFILETYPE 255 // +kind of data in subfile
  77. #define OFILETYPE_IMAGE 1 // full resolution image data
  78. #define OFILETYPE_REDUCEDIMAGE 2 // reduced size image data
  79. #define OFILETYPE_PAGE 3 // one page of many
  80. #define TIFFTAG_IMAGEWIDTH 256 // image width in pixels
  81. #define TIFFTAG_IMAGELENGTH 257 // image height in pixels
  82. #define TIFFTAG_BITSPERSAMPLE 258 // bits per channel (sample)
  83. #define TIFFTAG_COMPRESSION 259 // data compression technique
  84. #define COMPRESSION_NONE 1 // dump mode
  85. #define COMPRESSION_CCITTRLE 2 // CCITT modified Huffman RLE
  86. #define COMPRESSION_CCITTFAX3 3 // CCITT Group 3 fax encoding
  87. #define COMPRESSION_CCITTFAX4 4 // CCITT Group 4 fax encoding
  88. #define COMPRESSION_LZW 5 // Lempel-Ziv & Welch
  89. #define COMPRESSION_OJPEG 6 // !6.0 JPEG
  90. #define COMPRESSION_JPEG 7 // %JPEG DCT compression
  91. #define COMPRESSION_NEXT 32766 // NeXT 2-bit RLE
  92. #define COMPRESSION_CCITTRLEW 32771 // #1 w/ word alignment
  93. #define COMPRESSION_PACKBITS 32773 // Macintosh RLE
  94. #define COMPRESSION_THUNDERSCAN 32809 // ThunderScan RLE
  95. //
  96. // compression codes 32908-32911 are reserved for Pixar
  97. //
  98. #define COMPRESSION_PIXARFILM 32908 // Pixar companded 10bit LZW
  99. #define COMPRESSION_DEFLATE 32946 // Deflate compression
  100. #define COMPRESSION_JBIG 34661 // ISO JBIG
  101. #define TIFFTAG_PHOTOMETRIC 262 // photometric interpretation
  102. #define PHOTOMETRIC_MINISWHITE 0 // min value is white
  103. #define PHOTOMETRIC_MINISBLACK 1 // min value is black
  104. #define PHOTOMETRIC_RGB 2 // RGB color model
  105. #define PHOTOMETRIC_PALETTE 3 // color map indexed
  106. #define PHOTOMETRIC_MASK 4 // $holdout mask
  107. #define PHOTOMETRIC_SEPARATED 5 // !color separations
  108. #define PHOTOMETRIC_YCBCR 6 // !CCIR 601
  109. #define PHOTOMETRIC_CIELAB 8 // !1976 CIE L*a*b*
  110. #define TIFFTAG_THRESHHOLDING 263 // +thresholding used on data
  111. #define THRESHHOLD_BILEVEL 1 // b&w art scan
  112. #define THRESHHOLD_HALFTONE 2 // or dithered scan
  113. #define THRESHHOLD_ERRORDIFFUSE 3 // usually floyd-steinberg
  114. #define TIFFTAG_CELLWIDTH 264 // +dithering matrix width
  115. #define TIFFTAG_CELLLENGTH 265 // +dithering matrix height
  116. #define TIFFTAG_FILLORDER 266 // data order within a byte
  117. #define FILLORDER_MSB2LSB 1 // most significant -> least
  118. #define FILLORDER_LSB2MSB 2 // least significant -> most
  119. #define TIFFTAG_DOCUMENTNAME 269 // name of doc. image is from
  120. #define TIFFTAG_IMAGEDESCRIPTION 270 // info about image
  121. #define TIFFTAG_MAKE 271 // scanner manufacturer name
  122. #define TIFFTAG_MODEL 272 // scanner model name/number
  123. #define TIFFTAG_STRIPOFFSETS 273 // offsets to data strips
  124. #define TIFFTAG_ORIENTATION 274 // +image orientation
  125. #define ORIENTATION_TOPLEFT 1 // row 0 top, col 0 lhs
  126. #define ORIENTATION_TOPRIGHT 2 // row 0 top, col 0 rhs
  127. #define ORIENTATION_BOTRIGHT 3 // row 0 bottom, col 0 rhs
  128. #define ORIENTATION_BOTLEFT 4 // row 0 bottom, col 0 lhs
  129. #define ORIENTATION_LEFTTOP 5 // row 0 lhs, col 0 top
  130. #define ORIENTATION_RIGHTTOP 6 // row 0 rhs, col 0 top
  131. #define ORIENTATION_RIGHTBOT 7 // row 0 rhs, col 0 bottom
  132. #define ORIENTATION_LEFTBOT 8 // row 0 lhs, col 0 bottom
  133. #define TIFFTAG_SAMPLESPERPIXEL 277 // samples per pixel
  134. #define TIFFTAG_ROWSPERSTRIP 278 // rows per strip of data
  135. #define TIFFTAG_STRIPBYTECOUNTS 279 // bytes counts for strips
  136. #define TIFFTAG_MINSAMPLEVALUE 280 // +minimum sample value
  137. #define TIFFTAG_MAXSAMPLEVALUE 281 // +maximum sample value
  138. #define TIFFTAG_XRESOLUTION 282 // pixels/resolution in x
  139. #define TIFFTAG_YRESOLUTION 283 // pixels/resolution in y
  140. #define TIFFTAG_PLANARCONFIG 284 // storage organization
  141. #define PLANARCONFIG_CONTIG 1 // single image plane
  142. #define PLANARCONFIG_SEPARATE 2 // separate planes of data
  143. #define TIFFTAG_PAGENAME 285 // page name image is from
  144. #define TIFFTAG_XPOSITION 286 // x page offset of image lhs
  145. #define TIFFTAG_YPOSITION 287 // y page offset of image lhs
  146. #define TIFFTAG_FREEOFFSETS 288 // +byte offset to free block
  147. #define TIFFTAG_FREEBYTECOUNTS 289 // +sizes of free blocks
  148. #define TIFFTAG_GRAYRESPONSEUNIT 290 // $gray scale curve accuracy
  149. #define GRAYRESPONSEUNIT_10S 1 // tenths of a unit
  150. #define GRAYRESPONSEUNIT_100S 2 // hundredths of a unit
  151. #define GRAYRESPONSEUNIT_1000S 3 // thousandths of a unit
  152. #define GRAYRESPONSEUNIT_10000S 4 // ten-thousandths of a unit
  153. #define GRAYRESPONSEUNIT_100000S 5 // hundred-thousandths
  154. #define TIFFTAG_GRAYRESPONSECURVE 291 // $gray scale response curve
  155. #define TIFFTAG_GROUP3OPTIONS 292 // 32 flag bits
  156. #define GROUP3OPT_2DENCODING 0x1 // 2-dimensional coding
  157. #define GROUP3OPT_UNCOMPRESSED 0x2 // data not compressed
  158. #define GROUP3OPT_FILLBITS 0x4 // fill to byte boundary
  159. #define TIFFTAG_GROUP4OPTIONS 293 // 32 flag bits
  160. #define GROUP4OPT_UNCOMPRESSED 0x2 // data not compressed
  161. #define TIFFTAG_RESOLUTIONUNIT 296 // units of resolutions
  162. #define RESUNIT_NONE 1 // no meaningful units
  163. #define RESUNIT_INCH 2 // english
  164. #define RESUNIT_CENTIMETER 3 // metric
  165. #define TIFFTAG_PAGENUMBER 297 // page numbers of multi-page
  166. #define TIFFTAG_COLORRESPONSEUNIT 300 // $color curve accuracy
  167. #define COLORRESPONSEUNIT_10S 1 // tenths of a unit
  168. #define COLORRESPONSEUNIT_100S 2 // hundredths of a unit
  169. #define COLORRESPONSEUNIT_1000S 3 // thousandths of a unit
  170. #define COLORRESPONSEUNIT_10000S 4 // ten-thousandths of a unit
  171. #define COLORRESPONSEUNIT_100000S 5 // hundred-thousandths
  172. #define TIFFTAG_TRANSFERFUNCTION 301 // !colorimetry info
  173. #define TIFFTAG_SOFTWARE 305 // name & release
  174. #define TIFFTAG_DATETIME 306 // creation date and time
  175. #define TIFFTAG_ARTIST 315 // creator of image
  176. #define TIFFTAG_HOSTCOMPUTER 316 // machine where created
  177. #define TIFFTAG_PREDICTOR 317 // prediction scheme w/ LZW
  178. #define TIFFTAG_WHITEPOINT 318 // image white point
  179. #define TIFFTAG_PRIMARYCHROMATICITIES 319 // !primary chromaticities
  180. #define TIFFTAG_COLORMAP 320 // RGB map for pallette image
  181. #define TIFFTAG_HALFTONEHINTS 321 // !highlight+shadow info
  182. #define TIFFTAG_TILEWIDTH 322 // !rows/data tile
  183. #define TIFFTAG_TILELENGTH 323 // !cols/data tile
  184. #define TIFFTAG_TILEOFFSETS 324 // !offsets to data tiles
  185. #define TIFFTAG_TILEBYTECOUNTS 325 // !byte counts for tiles
  186. #define TIFFTAG_BADFAXLINES 326 // lines w/ wrong pixel count
  187. #define TIFFTAG_CLEANFAXDATA 327 // regenerated line info
  188. #define CLEANFAXDATA_CLEAN 0 // no errors detected
  189. #define CLEANFAXDATA_REGENERATED 1 // receiver regenerated lines
  190. #define CLEANFAXDATA_UNCLEAN 2 // uncorrected errors exist
  191. #define TIFFTAG_CONSECUTIVEBADFAXLINES 328 // max consecutive bad lines
  192. #define TIFFTAG_SUBIFD 330 // subimage descriptors
  193. #define TIFFTAG_INKSET 332 // !inks in separated image
  194. #define INKSET_CMYK 1 // !cyan-magenta-yellow-black
  195. #define TIFFTAG_INKNAMES 333 // !ascii names of inks
  196. #define TIFFTAG_DOTRANGE 336 // !0% and 100% dot codes
  197. #define TIFFTAG_TARGETPRINTER 337 // !separation target
  198. #define TIFFTAG_EXTRASAMPLES 338 // !info about extra samples
  199. #define EXTRASAMPLE_UNSPECIFIED 0 // !unspecified data
  200. #define EXTRASAMPLE_ASSOCALPHA 1 // !associated alpha data
  201. #define EXTRASAMPLE_UNASSALPHA 2 // !unassociated alpha data
  202. #define TIFFTAG_SAMPLEFORMAT 339 // !data sample format
  203. #define SAMPLEFORMAT_UINT 1 // !unsigned integer data
  204. #define SAMPLEFORMAT_INT 2 // !signed integer data
  205. #define SAMPLEFORMAT_IEEEFP 3 // !IEEE floating point data
  206. #define SAMPLEFORMAT_VOID 4 // !untyped data
  207. #define TIFFTAG_SMINSAMPLEVALUE 340 // !variable MinSampleValue
  208. #define TIFFTAG_SMAXSAMPLEVALUE 341 // !variable MaxSampleValue
  209. #define TIFFTAG_JPEGTABLES 347 // %JPEG table stream
  210. //
  211. // Tags 512-521 are obsoleted by Technical Note #2
  212. // which specifies a revised JPEG-in-TIFF scheme.
  213. //
  214. #define TIFFTAG_JPEGPROC 512 // !JPEG processing algorithm
  215. #define JPEGPROC_BASELINE 1 // !baseline sequential
  216. #define JPEGPROC_LOSSLESS 14 // !Huffman coded lossless
  217. #define TIFFTAG_JPEGIFOFFSET 513 // !pointer to SOI marker
  218. #define TIFFTAG_JPEGIFBYTECOUNT 514 // !JFIF stream length
  219. #define TIFFTAG_JPEGRESTARTINTERVAL 515 // !restart interval length
  220. #define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 // !lossless proc predictor
  221. #define TIFFTAG_JPEGPOINTTRANSFORM 518 // !lossless point transform
  222. #define TIFFTAG_JPEGQTABLES 519 // !Q matrice offsets
  223. #define TIFFTAG_JPEGDCTABLES 520 // !DCT table offsets
  224. #define TIFFTAG_JPEGACTABLES 521 // !AC coefficient offsets
  225. #define TIFFTAG_YCBCRCOEFFICIENTS 529 // !RGB -> YCbCr transform
  226. #define TIFFTAG_YCBCRSUBSAMPLING 530 // !YCbCr subsampling factors
  227. #define TIFFTAG_YCBCRPOSITIONING 531 // !subsample positioning
  228. #define YCBCRPOSITION_CENTERED 1 // !as in PostScript Level 2
  229. #define YCBCRPOSITION_COSITED 2 // !as in CCIR 601-1
  230. #define TIFFTAG_REFERENCEBLACKWHITE 532 // !colorimetry info
  231. //
  232. // tags 32952-32956 are private tags registered to Island Graphics
  233. //
  234. #define TIFFTAG_REFPTS 32953 // image reference points
  235. #define TIFFTAG_REGIONTACKPOINT 32954 // region-xform tack point
  236. #define TIFFTAG_REGIONWARPCORNERS 32955 // warp quadrilateral
  237. #define TIFFTAG_REGIONAFFINE 32956 // affine transformation mat
  238. //
  239. // tags 32995-32999 are private tags registered to SGI
  240. //
  241. #define TIFFTAG_MATTEING 32995 // $use ExtraSamples
  242. #define TIFFTAG_DATATYPE 32996 // $use SampleFormat
  243. #define TIFFTAG_IMAGEDEPTH 32997 // z depth of image
  244. #define TIFFTAG_TILEDEPTH 32998 // z depth/data tile
  245. //
  246. // tags 33300-33309 are private tags registered to Pixar
  247. //
  248. // TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
  249. // are set when an image has been cropped out of a larger image.
  250. // They reflect the size of the original uncropped image.
  251. // The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
  252. // to determine the position of the smaller image in the larger one.
  253. //
  254. #define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 // full image size in x
  255. #define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 // full image size in y
  256. //
  257. // tag 33432 is listed in the 6.0 spec w/ unknown ownership
  258. //
  259. #define TIFFTAG_COPYRIGHT 33432 // copyright string
  260. //
  261. // tags 34232-34236 are private tags registered to Texas Instruments
  262. //
  263. #define TIFFTAG_FRAMECOUNT 34232 // Sequence Frame Count
  264. //
  265. // tag 34750 is a private tag registered to Pixel Magic
  266. //
  267. #define TIFFTAG_JBIGOPTIONS 34750 // JBIG options
  268. //
  269. // tags 34908-34914 are private tags registered to SGI
  270. //
  271. #define TIFFTAG_FAXRECVPARAMS 34908 // encoded Class 2 ses. parms
  272. #define TIFFTAG_FAXSUBADDRESS 34909 // received SubAddr string
  273. #define TIFFTAG_FAXRECVTIME 34910 // receive time (secs)
  274. //
  275. // tags 40001-40100 are private tags registered to ms
  276. //
  277. #define TIFFTAG_RECIP_NAME 40001
  278. #define TIFFTAG_RECIP_NUMBER 40002
  279. #define TIFFTAG_SENDER_NAME 40003
  280. #define TIFFTAG_ROUTING 40004
  281. #define TIFFTAG_CALLERID 40005
  282. #define TIFFTAG_TSID 40006
  283. #define TIFFTAG_CSID 40007
  284. #define TIFFTAG_FAX_TIME 40008
  285. //
  286. // The following are ``pseudo tags'' that can be
  287. // used to control codec-specific functionality.
  288. // These tags are not written to file. Note that
  289. // these values start at 0xffff+1 so that they'll
  290. // never collide with Aldus-assigned tags.
  291. //
  292. // If you want your private pseudo tags ``registered''
  293. // (i.e. added to this file), send mail to [email protected]
  294. // with the appropriate C definitions to add.
  295. //
  296. #define TIFFTAG_FAXMODE 65536 // Group 3/4 format control
  297. #define FAXMODE_CLASSIC 0x0000 // default, include RTC
  298. #define FAXMODE_NORTC 0x0001 // no RTC at end of data
  299. #define FAXMODE_NOEOL 0x0002 // no EOL code at end of row
  300. #define FAXMODE_BYTEALIGN 0x0004 // byte align row
  301. #define FAXMODE_WORDALIGN 0x0008 // word align row
  302. #define FAXMODE_CLASSF FAXMODE_NORTC // TIFF Class F
  303. #define TIFFTAG_JPEGQUALITY 65537 // Compression quality level
  304. //
  305. // Note: quality level is on the IJG 0-100 scale. Default value is 75
  306. //
  307. #define TIFFTAG_JPEGCOLORMODE 65538 // Auto RGB<=>YCbCr convert?
  308. #define JPEGCOLORMODE_RAW 0x0000 // no conversion (default)
  309. #define JPEGCOLORMODE_RGB 0x0001 // do auto conversion
  310. #define TIFFTAG_JPEGTABLESMODE 65539 // What to put in JPEGTables
  311. #define JPEGTABLESMODE_QUANT 0x0001 // include quantization tbls
  312. #define JPEGTABLESMODE_HUFF 0x0002 // include Huffman tbls
  313. //
  314. // Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF
  315. //
  316. #define TIFFTAG_FAXFILLFUNC 65540 // G3/G4 fill function
  317. #define TIFFTAG_PIXARLOGDATAFMT 65549 // PixarLogCodec I/O data sz
  318. #define PIXARLOGDATAFMT_8BIT 0 // regular u_char samples
  319. #define PIXARLOGDATAFMT_8BITABGR 1 // ABGR-order u_chars
  320. #define PIXARLOGDATAFMT_10BITLOG 2 // 10-bit log-encoded (raw)
  321. #define PIXARLOGDATAFMT_12BITPICIO 3 // as per PICIO (1.0==2048)
  322. #define PIXARLOGDATAFMT_16BIT 4 // signed short samples
  323. #define PIXARLOGDATAFMT_FLOAT 5 // IEEE float samples
  324. #endif