home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TIFF / TACS40.ZIP / TIFF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1987-07-22  |  2.8 KB  |  124 lines

  1. /*
  2.  * Header file for Tag Image File Format (TIFF) routines.
  3.  */
  4.  
  5. #ifndef _TIFF_H
  6.  
  7. #define _TIFF_H
  8.  
  9. /* TIFF data types */
  10.  
  11. typedef char BYTE;
  12. typedef char ASCII;
  13. typedef short SHORT;
  14. typedef long LONG;
  15. struct rational
  16. {
  17.     LONG numerator;
  18.     LONG denominator;
  19. };
  20. typedef struct rational RATIONAL;
  21.  
  22. /* other data types */
  23. typedef char far * LONGPTR;
  24. typedef int BOOL;
  25. struct tiff_header
  26. {
  27.     SHORT byte_order;
  28.     SHORT version;
  29.     LONG dir_offset;
  30. };
  31. typedef struct tiff_header TIFF_HEADER;
  32.  
  33. #define TIFF_HEADER_SIZE sizeof(TIFF_HEADER)
  34.  
  35. struct tiff_dir_entry
  36. {
  37.     SHORT tag;
  38.     SHORT type;
  39.     LONG length;
  40.     LONG value_offset;
  41. };
  42. typedef struct tiff_dir_entry TIFF_DIR_ENTRY;
  43.  
  44. #define TIFF_DIR_ENTRY_SIZE sizeof(TIFF_DIR_ENTRY)
  45.  
  46. struct field_info
  47. {
  48.     SHORT num_tags;
  49.     LONG num_bytes;
  50. };
  51. typedef struct field_info FIELD_INFO;
  52.  
  53. #define FIELD_INFO_SIZE sizeof(FIELD_INFO)
  54.  
  55. /* constants */
  56. #define TRUE        1
  57. #define FALSE        0
  58. #define INTEL        0x4949
  59. #define MOTOROLA    0x4d4d
  60. #define BYTE_SIZE    sizeof(BYTE)
  61. #define ASCII_SIZE    sizeof(ASCII)
  62. #define SHORT_SIZE    sizeof(SHORT)
  63. #define LONG_SIZE    sizeof(LONG)
  64. #define RATIONAL_SIZE    sizeof(RATIONAL)
  65. #define ERROR_VALUE    0
  66. #define DIRECT_VALUE    1
  67. #define INDIRECT_VALUE    2
  68.  
  69. /* tags */
  70. #define SUBFILE_TYPE_TAG    0x00ff
  71. #define IMAGE_WIDTH_TAG        0x0100
  72. #define IMAGE_LENGTH_TAG    0x0101
  73. #define BITS_PER_SAMPLE_TAG    0x0102
  74. #define COMPRESSION_TAG        0x0103
  75.  
  76. #define PHOTOMETRIC_INTERP_TAG    0x0106
  77. #define THRESHOLDING_TAG    0x0107
  78. #define CELL_WIDTH_TAG        0x0108
  79. #define CELL_LENGTH_TAG        0x0109
  80. #define FILL_ORDER_TAG        0x010a
  81.  
  82. #define DOCUMENT_NAME_TAG    0x010d
  83. #define IMAGE_DESCRIPTION_TAG    0x010e
  84. #define MAKE_TAG        0x010f
  85. #define MODEL_TAG        0x0110
  86. #define STRIP_OFFSETS_TAG    0x0111
  87. #define ORIENTATION_TAG        0x0112
  88. #define SAMPLES_PER_PIXEL_TAG    0x0115
  89. #define ROWS_PER_STRIP_TAG    0x0116
  90. #define STRIP_BYTE_COUNTS_TAG    0x0117
  91. #define MIN_SAMPLE_VALUE_TAG    0x0118
  92. #define MAX_SAMPLE_VALUE_TAG    0x0119
  93. #define X_RESOLUTION_TAG    0x011a
  94. #define Y_RESOLUTION_TAG    0x011b
  95. #define PLANAR_CONFIG_TAG    0x011c
  96. #define PAGE_NAME_TAG        0x011d
  97. #define X_POSITION_TAG        0x011e
  98. #define Y_POSITION_TAG        0x011f
  99. #define FREE_OFFSETS_TAG    0x0120
  100. #define FREE_BYTE_COUNTS_TAG    0x0121
  101.  
  102. /*
  103.  * Legal compression types.  See the description of the "Compression" tag
  104.  * in the "Tag Image File Format" abstract, Aldus Corporation, 8/5/86 or
  105.  * later.
  106.  */
  107. #define PACK_TIGHTLY        1
  108. #define ONE_D_MOD_HUFFMAN    2
  109.  
  110. /*
  111.  * Answer to the question of the meaning of life and arbitrarily-chosen
  112.  * version number.
  113.  */
  114. #define LEGAL_VERSION    42
  115.  
  116. /* macros */
  117. #define HIBYTE(X)    ((BYTE)(((SHORT)(X)) >> 8))
  118. #define LOBYTE(X)    ((BYTE)(((SHORT)(X)) & 0xff))
  119. #define HIWORD(X)    ((SHORT)(((LONG)(X)) >> 16))
  120. #define LOWORD(X)    ((SHORT)(((LONG)(X)) & 0xffff))
  121. #define ELEMENTS(X)    (sizeof(X)/sizeof((X)[0]))
  122.  
  123. #endif /* _TIFF_H */
  124.