Source code of Windows XP (NT5)
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.

200 lines
6.9 KiB

  1. #ifndef _AWG3FILE_
  2. #define _AWG3FILE_
  3. /********************************************************************
  4. @doc EXTERNAL SRVRDLL LINEARIZER
  5. @type VOID | AWG3 File Format |
  6. An AWG3 file can be used to describe any
  7. multi page image encoded using a CCITT G3 standard like
  8. MH, MR, or MMR.
  9. The file format is a special case of the Microsoft Fax Linearized
  10. format. It consists of a LINHEADER structure, followed by
  11. an extended linearized header, followed by the image data.
  12. The image data is specified as one or more headers, each followed
  13. by a page of encoded image data. Each header starts a
  14. new page. The file is terminated with a header containing
  15. a special end-of-file signature marker.
  16. Linearizer helper function CreateSimpleHeader should be used to
  17. write the LINHEADER and extended linearized header when creating
  18. an AWG3 file.
  19. Linearizer helper function DiscardLinHeader should be used to
  20. skip past the LINHEADER and extended linearized header when
  21. reading the AWG3 file.
  22. The page header format is defined by the structure <t AWG3HEADER>.
  23. The data for each page consists of one or more frames.
  24. A frame consists of a DWORD indicating the length of data in
  25. the frame followed by that many bytes of data. The last
  26. frame of each page must be of zero length and indicates
  27. the end of the page data.
  28. The data consists of raw MH, MR, or MMR, encoded so that the
  29. least significant bit of each byte should be sent first over
  30. the wire.
  31. @xref <t AWG3HEADER>
  32. ********************************************************************/
  33. /********
  34. @doc EXTERNAL SRVRDLL LINEARIZER
  35. @types AWG3HEADER | Describes the Header Structure for an AWG3 File.
  36. @field WORD | wSig | Must be SIG_G3 for the page headers, and
  37. SIG_ENDFILE for the end of file header.
  38. @field WORD | wHeaderSize | Must be set to the size of the header
  39. structure. Used for version control.
  40. @field WORD | wTotalHeaders | If non-zero, this indicates the total
  41. number of and headers (including the end-of-file header)
  42. in this file. This need only be set in the first header.
  43. If zero, the total number of headers is not specified directly and
  44. can be obtained by traversing the headers in the file (until
  45. the end-of-file header).
  46. @field WORD | wHeaderNum | Gives the ordinal number for this
  47. header. Must be set for all headers. Numbering starts at 1.
  48. @field DWORD | lDataOffset | Gives the offset from the beginning
  49. of the current header to the start of the first frame
  50. of the data for this page.
  51. Must always be set.
  52. @field DWORD | lNextHeaderOffset | Gives the offset from the start of the
  53. current header to where the header for the next page can be found. If this
  54. is set to 0, the next header starts at the end of the
  55. last frame (which will be a null frame) for this page.
  56. @field DWORD | AwRes | One of the standard resolution defines
  57. specified in <t STD_RESOLUTIONS>.
  58. @field DWORD | Encoding | One of the G3 Fax types from the
  59. standard types defined in <t STD_DATA_TYPES>. Basically one
  60. of MH_DATA, MR_DATA, or MMR_DATA.
  61. @field DWORD | PageWidth | One of the standard page widths as defined in
  62. <t STD_PAGE_WIDTHS>.
  63. @field DWORD | PageLength | One of the standard page lengths as defined in
  64. <t STD_PAGE_LENGTHS>.
  65. @xref <t AWG3 File Format>
  66. ********/
  67. #define SIG_G3 0x3347
  68. #define SIG_ENDFILE 0x4067
  69. #ifndef WIN16 // remove WIN16 irritation
  70. #pragma pack(push)
  71. #endif
  72. #pragma pack(1)
  73. typedef struct {
  74. WORD wSig; // always set to one of the above SIG_ #defines
  75. WORD wHeaderSize; // always set
  76. WORD wTotalHeaders; // can be 0
  77. WORD wHeaderNum; // starts from 1
  78. // 8 bytes
  79. // all offsets from start of _this_header_
  80. DWORD lDataOffset; // always set. points to the first frame-size DWORD
  81. DWORD lNextHeaderOffset; // may be NULL--then next header follows end of data
  82. // 16 bytes
  83. DWORD AwRes; // as per AWRES_ defines below. DIFFERENT from Snowball
  84. DWORD Encoding; // as per _DATA defines below. Same as Snowball
  85. DWORD PageWidth; // as per WIDTH_ defines below. Same as Snowball
  86. DWORD PageLength; // as per LENGTH_ defines below. Same as SNowball
  87. // 32 bytes
  88. BYTE Reserved1[32]; // pad out to 64 bytes for future expansion
  89. } AWG3HEADER, far* LPAWG3HEADER;
  90. #ifdef WIN16 // remove WIN16 irritation
  91. #pragma pack()
  92. #else
  93. #pragma pack(pop)
  94. #endif
  95. // Standard Bit Valued MetaData values
  96. #define MH_DATA 0x00000001L
  97. #define MR_DATA 0x00000002L
  98. #define MMR_DATA 0x00000004L
  99. // Standard Resolutions
  100. #define AWRES_UNKNOWN 0x00000000L
  101. #define AWRES_CUSTOM 0x00000001L
  102. #define AWRES_mm080_038 0x00000002L
  103. #define AWRES_mm080_077 0x00000004L
  104. #define AWRES_mm080_154 0x00000008L
  105. #define AWRES_mm160_154 0x00000010L
  106. #define AWRES_200_100 0x00000020L
  107. #define AWRES_200_200 0x00000040L
  108. #define AWRES_200_400 0x00000080L
  109. #define AWRES_300_300 0x00000100L
  110. #define AWRES_400_400 0x00000200L
  111. #define AWRES_600_600 0x00000400L
  112. #define AWRES_75_75 0x00000800L
  113. #define AWRES_100_100 0x00001000L
  114. /********
  115. @doc EXTERNAL DATATYPES SRVRDLL
  116. @type WORD | STD_PAGE_LENGTHS | Standard Page Lengths
  117. @emem LENGTH_A4 | Std A4 paper length, Value: 0
  118. @emem LENGTH_B4 | Std B4 paper length, Value: 1
  119. @emem LENGTH_UNLIMITED | Unknown length, Value: 2
  120. @comm These lengths are compatible with those defined
  121. by the CCITT for G3 machines. They are used
  122. in fax format headers, and in structures dealing
  123. with fax machine capabilities.
  124. ********/
  125. // Length defines
  126. #define LENGTH_A4 0
  127. #define LENGTH_B4 1
  128. #define LENGTH_UNLIMITED 2
  129. /********
  130. @doc EXTERNAL DATATYPES SRVRDLL
  131. @type WORD | STD_PAGE_WIDTHS | Standard Page Widths
  132. @emem WIDTH_A4 |1728 pixels, Value: 0
  133. @emem WIDTH_B4 |2048 pixels, Value: 1
  134. @emem WIDTH_A3 |2432 pixels, Value: 2
  135. @emem WIDTH_A5 |1216 pixels, Value: 16
  136. @emem WIDTH_A6 |864 pixels, Value: 32
  137. @comm These widths are compatible with those defined
  138. by the CCITT for G3 machines. They are used
  139. in fax format headers, and in structures dealing
  140. with fax machine capabilities.
  141. ********/
  142. //Width defines
  143. #define WIDTH_A4 0 /* 1728 pixels */
  144. #define WIDTH_B4 1 /* 2048 pixels */
  145. #define WIDTH_A3 2 /* 2432 pixels */
  146. #define WIDTH_MAX WIDTH_A3
  147. #define WIDTH_A5 16 /* 1216 pixels */
  148. #define WIDTH_A6 32 /* 864 pixels */
  149. #define WIDTH_A5_1728 64 /* 1216 pixels */
  150. #define WIDTH_A6_1728 128 /* 864 pixels */
  151. #endif // _AWG3FILE_