home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / IMGPROC.ZIP / C6TIFF.ZIP / TIFF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-30  |  9.2 KB  |  161 lines

  1. /*
  2. Copyright (c) 1988 by Sam Leffler.
  3. All rights reserved.
  4.  
  5. Program ported to Turbo C by Craig A. Lindley 12/08/89
  6.  
  7. This file is provided for unrestricted use provided that this
  8. legend is included on all tape media and as a part of the
  9. software program in whole or part.  Users may copy, modify or
  10. distribute this file at will.
  11. */
  12.  
  13. #ifndef _TIFF_
  14. #define _TIFF_
  15. /*
  16. Tag Image File Format (TIFF)
  17. */
  18.  
  19. #define TIFF_VERSION         42
  20. #define TIFF_BIGENDIAN       0x4d4d
  21. #define TIFF_LITTLEENDIAN    0x4949
  22.  
  23. typedef struct
  24. {
  25.    unsigned tiff_magic;           /* magic number (defines byte order) */
  26.    unsigned tiff_version;         /* TIFF version number */
  27.    unsigned long  tiff_diroff;    /* byte offset to first directory */
  28. } TIFFHeader;
  29.  
  30. /*
  31. TIFF Image File Directories are comprised of
  32. a table of field descriptors of the form shown
  33. below.  The table is sorted in ascending order
  34. by tag.  The values associated with each entry
  35. are disjoint and may appear anywhere in the file
  36. (so long as they are placed on a word boundary).
  37. If the value is 4 bytes or less, then it is placed
  38. in the offset field to save space.  If the value
  39. is less than 4 bytes, it is left-justified in the
  40. offset field.
  41. */
  42.  
  43. typedef struct
  44. {
  45.    unsigned tdir_tag;             /* see below */
  46.    unsigned tdir_type;            /* data type; see below */
  47.    unsigned long  tdir_count;     /* number of items; length in spec */
  48.    unsigned long  tdir_offset;    /* byte offset to field data */
  49. } TIFFDirEntry;
  50.  
  51. typedef enum
  52. {
  53.    ABYTE = 1,                /* 8-bit unsigned integer */
  54.    ASCII = 2,                /* 8-bit bytes w/ last byte null */
  55.    SHORT = 3,                /* 16-bit unsigned integer */
  56.    LONG = 4,                 /* 32-bit unsigned integer */
  57.    RATIONAL = 5,             /* 64-bit fractional (numerator+denominator) */
  58. } TIFFDataType;
  59.  
  60. /*
  61. TIFF Tag Definitions. Those marked with a + are obsoleted by revision 5.0
  62. */
  63. #define TIFFTAG_SUBFILETYPE             254     /* subfile data descriptor */
  64. #define     FILETYPE_REDUCEDIMAGE       0x1     /* reduced resolution version */
  65. #define     FILETYPE_PAGE               0x2     /* one page of many */
  66. #define     FILETYPE_MASK               0x4     /* transparency mask */
  67. #define TIFFTAG_OSUBFILETYPE            255     /* +kind of data in subfile */
  68. #define     OFILETYPE_IMAGE             1       /* full resolution image data */
  69. #define     OFILETYPE_REDUCEDIMAGE      2       /* reduced size image data */
  70. #define     OFILETYPE_PAGE              3       /* one page of many */
  71. #define TIFFTAG_IMAGEWIDTH              256     /* image width in pixels */
  72. #define TIFFTAG_IMAGELENGTH             257     /* image height in pixels */
  73. #define TIFFTAG_BITSPERSAMPLE           258     /* bits per channel (sample) */
  74. #define TIFFTAG_COMPRESSION             259     /* data compression technique */
  75. #define     COMPRESSION_NONE            1       /* dump mode */
  76. #define     COMPRESSION_CCITTRLE        2       /* CCITT modified Huffman RLE */
  77. #define     COMPRESSION_CCITTFAX3       3       /* CCITT Group 3 fax encoding */
  78. #define     COMPRESSION_CCITTFAX4       4       /* CCITT Group 4 fax encoding */
  79. #define     COMPRESSION_LZW             5       /* Lempel-Ziv  & Welch */
  80. #define     COMPRESSION_CCITTRLEW       32771U  /* #1 w/ word alignment */
  81. #define     COMPRESSION_PACKBITS        32773U  /* Macintosh RLE */
  82. #define TIFFTAG_PHOTOMETRIC             262     /* photometric interpretation */
  83. #define     PHOTOMETRIC_MINISWHITE      0       /* min value is white */
  84. #define     PHOTOMETRIC_MINISBLACK      1       /* min value is black */
  85. #define     PHOTOMETRIC_RGB             2       /* RGB color model */
  86. #define     PHOTOMETRIC_PALETTE         3       /* color map indexed */
  87. #define     PHOTOMETRIC_MASK            4       /* holdout mask */
  88. #define     PHOTOMETRIC_DEPTH           32768U  /* z-depth data */
  89. #define TIFFTAG_THRESHHOLDING           263     /* +thresholding used on data */
  90. #define     THRESHHOLD_BILEVEL          1       /* b&w art scan */
  91. #define     THRESHHOLD_HALFTONE         2       /* or dithered scan */
  92. #define     THRESHHOLD_ERRORDIFFUSE     3       /* usually floyd-steinberg */
  93. #define TIFFTAG_CELLWIDTH               264     /* +dithering matrix width */
  94. #define TIFFTAG_CELLLENGTH              265     /* +dithering matrix height */
  95. #define TIFFTAG_FILLORDER               266     /* +data order within a byte */
  96. #define     FILLORDER_MSB2LSB           1       /* most significant -> least */
  97. #define     FILLORDER_LSB2MSB           2       /* least significant -> most */
  98. #define TIFFTAG_DOCUMENTNAME            269     /* name of doc. image is from */
  99. #define TIFFTAG_IMAGEDESCRIPTION        270     /* info about image */
  100. #define TIFFTAG_MAKE                    271     /* scanner manufacturer name */
  101. #define TIFFTAG_MODEL                   272     /* scanner model name/number */
  102. #define TIFFTAG_STRIPOFFSETS            273     /* offsets to data strips */
  103. #define TIFFTAG_ORIENTATION             274     /* +image orientation */
  104. #define     ORIENTATION_TOPLEFT         1       /* row 0 top, col 0 lhs */
  105. #define     ORIENTATION_TOPRIGHT        2       /* row 0 top, col 0 rhs */
  106. #define     ORIENTATION_BOTRIGHT        3       /* row 0 bottom, col 0 rhs */
  107. #define     ORIENTATION_BOTLEFT         4       /* row 0 bottom, col 0 lhs */
  108. #define     ORIENTATION_LEFTTOP         5       /* row 0 lhs, col 0 top */
  109. #define     ORIENTATION_RIGHTTOP        6       /* row 0 rhs, col 0 top */
  110. #define     ORIENTATION_RIGHTBOT        7       /* row 0 rhs, col 0 bottom */
  111. #define     ORIENTATION_LEFTBOT         8       /* row 0 lhs, col 0 bottom */
  112. #define TIFFTAG_SAMPLESPERPIXEL         277     /* samples per pixel */
  113. #define TIFFTAG_ROWSPERSTRIP            278     /* rows per strip of data */
  114. #define TIFFTAG_STRIPBYTECOUNTS         279     /* bytes counts for strips */
  115. #define TIFFTAG_MINSAMPLEVALUE          280     /* +minimum sample value */
  116. #define TIFFTAG_MAXSAMPLEVALUE          281     /* maximum sample value */
  117. #define TIFFTAG_XRESOLUTION             282     /* pixels/resolution in x */
  118. #define TIFFTAG_YRESOLUTION             283     /* pixels/resolution in y */
  119. #define TIFFTAG_PLANARCONFIG            284     /* storage organization */
  120. #define     PLANARCONFIG_CONTIG         1       /* single image plane */
  121. #define     PLANARCONFIG_SEPARATE       2       /* separate planes of data */
  122. #define TIFFTAG_PAGENAME                285     /* page name image is from */
  123. #define TIFFTAG_XPOSITION               286     /* x page offset of image lhs */
  124. #define TIFFTAG_YPOSITION               287     /* y page offset of image lhs */
  125. #define TIFFTAG_FREEOFFSETS             288     /* +byte offset to free block */
  126. #define TIFFTAG_FREEBYTECOUNTS          289     /* +sizes of free blocks */
  127. #define TIFFTAG_GRAYRESPONSEUNIT        290     /* gray scale curve accuracy */
  128. #define     GRAYRESPONSEUNIT_10S        1       /* tenths of a unit */
  129. #define     GRAYRESPONSEUNIT_100S       2       /* hundredths of a unit */
  130. #define     GRAYRESPONSEUNIT_1000S      3       /* thousandths of a unit */
  131. #define     GRAYRESPONSEUNIT_10000S     4       /* ten-thousandths of a unit */
  132. #define     GRAYRESPONSEUNIT_100000S    5       /* hundred-thousandths */
  133. #define TIFFTAG_GRAYRESPONSECURVE       291     /* gray scale response curve */
  134. #define TIFFTAG_GROUP3OPTIONS           292     /* 32 flag bits */
  135. #define     GROUP3OPT_2DENCODING        0x1     /* 2-dimensional coding */
  136. #define     GROUP3OPT_UNCOMPRESSED      0x2     /* data not compressed */
  137. #define     GROUP3OPT_FILLBITS          0x4     /* fill to byte boundary */
  138. #define TIFFTAG_GROUP4OPTIONS           293     /* 32 flag bits */
  139. #define     GROUP4OPT_UNCOMPRESSED      0x2     /* data not compressed */
  140. #define TIFFTAG_RESOLUTIONUNIT          296     /* units of resolutions */
  141. #define     RESUNIT_NONE                1       /* no meaningful units */
  142. #define     RESUNIT_INCH                2       /* english */
  143. #define     RESUNIT_CENTIMETER          3       /* metric */
  144. #define TIFFTAG_PAGENUMBER              297     /* page numbers of multi-page */
  145. #define TIFFTAG_COLORRESPONSEUNIT       300     /* color scale curve accuracy */
  146. #define     COLORRESPONSEUNIT_10S       1       /* tenths of a unit */
  147. #define     COLORRESPONSEUNIT_100S      2       /* hundredths of a unit */
  148. #define     COLORRESPONSEUNIT_1000S     3       /* thousandths of a unit */
  149. #define     COLORRESPONSEUNIT_10000S    4       /* ten-thousandths of a unit */
  150. #define     COLORRESPONSEUNIT_100000S   5       /* hundred-thousandths */
  151. #define TIFFTAG_COLORRESPONSECURVE      301     /* RGB response curve */
  152. #define TIFFTAG_SOFTWARE                305     /* name & release */
  153. #define TIFFTAG_DATETIME                306     /* creation date and time */
  154. #define TIFFTAG_ARTIST                  315     /* creator of image */
  155. #define TIFFTAG_HOSTCOMPUTER            316     /* machine where created */
  156. #define TIFFTAG_PREDICTOR               317     /* prediction scheme w/ LZW */
  157. #define TIFFTAG_WHITEPOINT              318     /* image white point */
  158. #define TIFFTAG_PRIMARYCHROMATICITIES   319     /* primary chromaticities */
  159. #define TIFFTAG_COLORMAP                320     /* RGB map for pallette image */
  160. #endif _TIFF_
  161.