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.

300 lines
9.5 KiB

  1. /*----------------------------------------------------------------------------
  2. %%File: FILTAPI.H
  3. %%Unit: FILTER32
  4. %%Contact: rlittle@microsoft.com
  5. This header is distributed as part of the 32 bit Filter SDK.
  6. Changes to this header file should be sent to rlittle@microsoft.com
  7. or doneill@microsoft.com
  8. Revision History: (Current=1.03)
  9. 1/12/96 Created
  10. 1/23/96 Renamed grt values and synchronized with grfSupport values
  11. 1/24/96 Extra SetFilterPref arguments (smueller)
  12. 1/25/96 Correct packing (rlittle)
  13. ----------------------------------------------------------------------------*/
  14. #ifndef FILTAPI_H
  15. #define FILTAPI_H
  16. // Definitions
  17. #ifdef MAC
  18. #include "macos\types.h"
  19. #include "macos\files.h"
  20. // Mac type equivalents
  21. typedef Handle HANDLE;
  22. typedef Handle HMETAFILE;
  23. typedef Handle HENHMETAFILE;
  24. typedef Rect RECT;
  25. typedef long HDC; // unused
  26. typedef short FH;
  27. #endif // MAC
  28. #ifdef WIN16
  29. typedef HANDLE HENHMETAFILE; // win16 doesn't support enhanced metafiles
  30. typedef HFILE FH;
  31. #endif // WIN16
  32. #ifdef WIN32
  33. typedef HANDLE FH;
  34. #endif // WIN32
  35. // useful macros (mainly for Mac; windows.h defines most of these, so this
  36. // will just be a failsafe.
  37. typedef unsigned short ushort;
  38. typedef unsigned long ulong;
  39. typedef unsigned char uchar;
  40. typedef int BOOL;
  41. // these are the graphics definitions for Version 2 & Version 3
  42. #ifdef WIN16
  43. #define cchMaxGrName 124 // max file path length for graphics filter
  44. #else // !WIN16
  45. #define cchMaxGrName 260 // max file path length for graphics filter
  46. #endif
  47. #define cchMaxGrExt 4 // chars + end-of-string mark ('\0')
  48. #pragma pack(2)
  49. typedef struct _FILESPEC {
  50. union
  51. {
  52. struct
  53. {
  54. ushort slippery: 1; // True if file may disappear.
  55. ushort write : 1; // True if open for write.
  56. ushort unnamed: 1; // True if unnamed.
  57. ushort linked : 1; // Linked to an FS FCB.
  58. ushort mark : 1; // Generic mark bit.
  59. ushort unused : 11;
  60. };
  61. ushort wFlags;
  62. };
  63. union
  64. {
  65. char rgchExt[cchMaxGrExt]; // file extension, not used on MacPPC
  66. FH hfEmbed; // embedded file handle
  67. };
  68. ushort wUnused;
  69. #ifdef MACPPC
  70. FSSpec fsSpec;
  71. #else
  72. char szName[cchMaxGrName]; // fully qualified path
  73. #endif // MACPPC
  74. ulong dcbFile; // file position in hfEmbed
  75. /*** END VERSION 2 FIELDS
  76. ***
  77. *** Fields above this point are IMMUTABLE. They are guaranteed
  78. *** to be in the above format for backwards compatibility with
  79. *** existing Version 2 filters.
  80. ***/
  81. ulong dcbFileHigh;
  82. } FILESPEC;
  83. // NOTE: the client application will arbitrarily decide which type to
  84. // send if the filter returns multiple support types
  85. #define GrfSupportFromGrt(grt) (ulong)(1 << ((grt) + 15))
  86. #define grfSupportEMF GrfSupportFromGrt(grtEMF) // 0x00010000
  87. #define grfSupportWMF GrfSupportFromGrt(grtWMF) // 0x00020000
  88. #define grfSupportPNG GrfSupportFromGrt(grtPNG) // 0x00040000
  89. #define grfSupportPICT GrfSupportFromGrt(grtPICT) // 0x00080000
  90. #define grfSupportJFIF GrfSupportFromGrt(grtJFIF) // 0x00100000
  91. // NOTE: grfImport/grfExport are not mutually exclusive. They can be
  92. // OR'ed together for a filter that does both. Values 2 and 4 cannot be
  93. // used as they would be indistinguishable from version 2 return values.
  94. #define grfImport 0x00000008
  95. #define grfExport 0x00000010
  96. // Version 2 support:
  97. typedef struct _GRPI { // GRaPhic Interface
  98. HMETAFILE hmf; // metafile
  99. RECT bbox; // tightly bounds the image (in metafile units)
  100. ushort inch; // metafile units per inch
  101. } GRPI;
  102. // Version 3 support:
  103. #define grtEMF 0x01
  104. #define grtWMF 0x02
  105. #define grtPNG 0x03
  106. #define grtPICT 0x04
  107. #define grtJFIF 0x05
  108. // NOTE:
  109. // if fPointer is fTrue, then the information is represented as
  110. // a pointer to data rather than a handle to data. This is not
  111. // valid for HMETAFILE and HENHMETAFILE (as there is no pointer
  112. // equivalent)
  113. typedef struct _GRPIX { // GRaPhic Interface Extended
  114. ushort cbGrpix; // size of this structure
  115. uchar grt; // GRaphic Type
  116. ulong cbData; // number of bytes in the graphic
  117. BOOL fPointer;
  118. union
  119. {
  120. HMETAFILE hmf; // metafile
  121. HENHMETAFILE hemf; // enhanced metafile
  122. HANDLE hPng; // handle to PNG bits
  123. void *pPng; // pointer to PNG bits (fPointer = fTrue)
  124. HANDLE hPict; // handle to MacPict
  125. void *pPict; // pointer to MacPict (fPointer = fTrue)
  126. HANDLE hJpeg; // handle to JPEG/JFIF
  127. void *pJpeg; // pointer to JPEG/JFIF (fPointer = fTrue)
  128. };
  129. RECT bbox; // tightly bounds the image (in metafile units)
  130. ulong inch; // metafile units per inch
  131. } GRPIX;
  132. #ifndef WIN16
  133. // Update the percent complete (if return value is fTrue, then
  134. // abort the conversion) lPct is the percent
  135. // pfnPctComplete MUST be called frequently (every 2 or 3 percent)
  136. typedef BOOL (*PFN_PCTCOMPLETE)(long lPct, void *pvData);
  137. #if defined(RISC) // mips,alpha,ibm ppc,mac ppc
  138. #define FILTAPI _cdecl
  139. #else
  140. #define FILTAPI PASCAL
  141. #endif
  142. // NOTE: For version 3 handling, pgrpi should be cast as
  143. // pgrpix = (GRPIX *)pgrpi
  144. typedef int (FILTAPI *PFNGetFilterInfo)(short, char *, HANDLE *, ulong);
  145. typedef void (FILTAPI *PFNGetFilterPref)(HANDLE, HANDLE, HANDLE, ushort);
  146. typedef int (FILTAPI *PFNExportGr)(FILESPEC *, GRPI *, HANDLE);
  147. typedef int (FILTAPI *PFNExportEmbeddedGr)(FILESPEC *, GRPI *, HANDLE, ulong);
  148. typedef int (FILTAPI *PFNImportGr)(HDC, FILESPEC *, GRPI *, HANDLE);
  149. typedef int (FILTAPI *PFNImportEmbeddedGr)(HDC, FILESPEC *, GRPI *, HANDLE, ulong, char *);
  150. typedef int (FILTAPI *PFNRegisterPercentCallback)(HANDLE, PFN_PCTCOMPLETE, void *);
  151. typedef int (FILTAPI *PFNSetFilterPref)(HANDLE, char *, void *, ulong, ulong);
  152. int FILTAPI GetFilterInfo(short wVersion, char *pIni,
  153. HANDLE *phPrefMem, ulong lFlags);
  154. void FILTAPI GetFilterPref(HANDLE hInst, HANDLE hWnd, HANDLE hPrefMem,
  155. ushort wFlags);
  156. int FILTAPI ExportGr(FILESPEC *pFileSpec, GRPI *pgrpi, HANDLE hPrefMem);
  157. int FILTAPI ExportEmbeddedGr(FILESPEC *pFileSpec, GRPI *pgrpi, HANDLE hPrefMem, ulong *pdwSize);
  158. int FILTAPI ImportGr(HDC hdcPrint, FILESPEC *pFileSpec, GRPI *pgrpi,
  159. HANDLE hPrefMem);
  160. int FILTAPI ImportEmbeddedGr(HDC hdcPrint, FILESPEC *pFileSpec, GRPI *pgrpi,
  161. HANDLE hPrefMem, ulong ulSize, char *szMetaFileName);
  162. int FILTAPI RegisterPercentCallback(HANDLE hPrefMem, PFN_PCTCOMPLETE pfnPctComplete, void *pvData);
  163. int FILTAPI SetFilterPref(HANDLE hPrefMem, char *szOption, void *pvValue, ulong dwSize, ulong dwType);
  164. #endif // WIN16
  165. // Definitions of ordinal values for entry points
  166. // backwards compatibility only
  167. #define ordGetFilterInfo ((DWORD)1)
  168. #define ordImportGr ((DWORD)2)
  169. // SetFilterPref data types
  170. // these exactly parallel a subset of Win32 registry value data types
  171. #if !defined(REG_NONE) || !defined(REG_SZ) || !defined(REG_BINARY) || !defined(REG_DWORD)
  172. #define REG_NONE ( 0 ) // No value type
  173. #define REG_SZ ( 1 ) // '\0' terminated string
  174. #define REG_BINARY ( 3 ) // Free form binary
  175. #define REG_DWORD ( 4 ) // 32-bit number
  176. #endif
  177. // ERROR RETURN VALUES
  178. #define IE_NO_ERROR 0
  179. #define IE_INTERNAL_ERROR (-1)
  180. #define IE_BASE 0x14B4
  181. #define IE(err) (IE_BASE + err)
  182. // IMPORT/EXPORT ERRORS
  183. #define IE_NOT_MY_FILE IE(0x0001) // generic not my file error
  184. #define IE_TOO_BIG IE(0x0002) // bitmap or pict too big error
  185. #define IE_DUMB_BITMAP IE(0x0003) // bitmap all white
  186. #define IE_BAD_VCHAR IE(0x0004) // bad vchar in ImportString
  187. #define IE_BAD_TOKEN IE(0x0005) // illegal wp token
  188. #define IE_NO_VERIFY IE(0x0006) // failed to verify imported story
  189. #define IE_UNKNOWN_TYPE IE(0x0007) // unknown file type
  190. #define IE_NOT_WP_FILE IE(0x0008) // not a wp file
  191. #define IE_BAD_FILE_DATA IE(0x0009) // current file data is bad
  192. #define IE_IMPORT_ABORT IE(0x000A) // import abort alert
  193. #define IE_MEM_FULL IE(0x000B) // ran out of memory during import
  194. #define IE_MSNG_FONTS IE(0x000C) // system font not found
  195. #define IE_META_TOO_BIG IE(0x000D) // metafile too big
  196. #define IE_MEM_FAIL IE(0x000F) // couldn't lock memory during import
  197. #define IE_NO_FILTER IE(0x0012) // expected filter not found
  198. #define IE_UNSUPP_COMPR IE(0x0029) // unsupported compress style
  199. #define IE_UNSUPP_VERSION IE(0x002A) // unsupported file version
  200. #define IE_UNSUPP_COLOR IE(0x002B) // unsupported color style
  201. #define IE_ERROR_NOMSG IE(0x0037) // dialog box cancel
  202. #define IE_FILE_NOT_FOUND IE(0x003C) // file not found
  203. #define IE_BUG IE(0x0051)
  204. #define IE_BAD_METAFILE IE(0x0053) // inconsistent metafile data
  205. #define IE_BAD_METAFILE2 0xCCCC // inconsistent metafile data
  206. #define IE_BAD_PARAM IE(0x0100) // bad parameter passed by client
  207. #define IE_UNSUPP_FORMAT IE(0x0101) // cannot provide/accept format
  208. #define FA_DISK_ERROR 7015
  209. // values for WPG-specific PRF fields (for GetFilterPref)
  210. // backwards compatibility only
  211. #define bBGIni 0 // do what the mstxtcnv.ini file says
  212. #define bBGDiscard 1 // discard the background
  213. #define bBGKeep 2 // keep the background
  214. #define bCCNone 0
  215. #define bCCOutline 1 // convert black to black, all others to white
  216. #define bCCBlackWhite 2 // convert white to white, all others to black
  217. #define bCCInvert 3 // invert all colours, except black and white
  218. #define bCCOutline6 4 // true outline
  219. #define bCCSilhouette 5 // everything to black
  220. #define bCCInvert6 6 // invert all colours, including black<->white
  221. #define bMRNone 0
  222. #define bMRHorizontal 1 // flip image horizontally, across y-axis
  223. #define bMRVertical 2 // flip image vertically, across x-axis
  224. typedef struct _PRF
  225. {
  226. uchar fSilent;
  227. uchar bBackground;
  228. uchar bColorChange;
  229. uchar bMirror; // formerly fMirror
  230. unsigned dgRotate;
  231. } PRF;
  232. #pragma pack()
  233. #endif // !FILTAPI_H