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.

1392 lines
56 KiB

  1. /* ======================================================================== *\
  2. Copyright (C) 1991, 1992 TWAIN Working Group: Aldus, Caere, Eastman-Kodak,
  3. Hewlett-Packard and Logitech Corporations. All rights reserved.
  4. Copyright (C) 1997 TWAIN Working Group: Bell+Howell, Canon, DocuMagix,
  5. Fujitsu, Genoa Technology, Hewlett-Packard, Kofax Imaging Products, and
  6. Ricoh Corporation. All rights reserved.
  7. TWAIN.h - This is the definitive include file for applications and
  8. data sources written to the TWAIN specification.
  9. It defines constants, data structures, messages etc.
  10. for the public interface to TWAIN.
  11. Revision History:
  12. version 1.0, March 6, 1992. TWAIN 1.0.
  13. version 1.1, January 1993. Tech Notes 1.1
  14. version 1.5, June 1993. Specification Update 1.5
  15. Change DC to TW
  16. Change filename from DC.H to TWAIN.H
  17. version 1.5, July 1993. Remove spaces from country identifiers
  18. version 1.7, July 1997 Added Capabilities and data structure for
  19. document imaging and digital cameras.
  20. KHL.
  21. version 1.7, July 1997 Inserted Borland compatibile structure packing
  22. directives provided by Mentor. JMH
  23. version 1.7, Aug 1997 Expanded file tabs to spaces.
  24. NOTE: future authors should be sure to have
  25. their editors set to automatically expand tabs
  26. to spaces (original tab setting was 4 spaces).
  27. version 1.7, Sept 1997 Added job control values
  28. Added return codes
  29. version 1.7, Sept 1997 changed definition of pRGBRESPONSE to
  30. pTW_RGBRESPONSE
  31. \* ======================================================================== */
  32. #ifndef TWAIN
  33. #define TWAIN
  34. #if _MSC_VER > 1000
  35. #pragma once
  36. #endif
  37. /* SDH - 02/08/95 - TWUNK */
  38. /* Force 32-bit twain to use same packing of twain structures as existing */
  39. /* 16-bit twain. This allows 16/32-bit thunking. */
  40. #ifdef WIN32
  41. #ifdef __BORLANDC__ //(Mentor June 13, 1996) if we're using a Borland compiler
  42. #pragma option -a2 //(Mentor June 13, 1996) switch to word alignment
  43. #else //(Mentor June 13, 1996) if we're using some other compiler
  44. #pragma pack (push, before_twain)
  45. #pragma pack (2)
  46. #endif //(Mentor June 13, 1996)
  47. #else /* WIN32 */
  48. #endif /* WIN32 */
  49. /****************************************************************************
  50. * TWAIN Version *
  51. ****************************************************************************/
  52. #define TWON_PROTOCOLMINOR 7 /* Changed for Version 1.7 */
  53. #define TWON_PROTOCOLMAJOR 1
  54. /****************************************************************************
  55. * Platform Dependent Definitions and Typedefs *
  56. ****************************************************************************/
  57. /* Define one of the following, depending on the platform */
  58. /* #define _MAC_ */
  59. /* #define _UNIX_ */
  60. #define _MSWIN_
  61. #ifdef _MSWIN_
  62. typedef HANDLE TW_HANDLE;
  63. typedef LPVOID TW_MEMREF;
  64. /* SDH - 05/05/95 - TWUNK */
  65. /* For common code between 16 and 32 bits. */
  66. #ifdef WIN32
  67. #define TW_HUGE
  68. #else /* WIN32 */
  69. #define TW_HUGE huge
  70. #endif /* WIN32 */
  71. typedef BYTE TW_HUGE * HPBYTE;
  72. typedef void TW_HUGE * HPVOID;
  73. #endif /* _MSWIN_ */
  74. #ifdef _MAC_
  75. #define PASCAL pascal
  76. #define FAR
  77. typedef Handle TW_HANDLE;
  78. typedef char *TW_MEMREF;
  79. #endif /* _MAC_ */
  80. #ifdef _UNIX_
  81. #define PASCAL pascal
  82. typedef unsigned char *TW_HANDLE;
  83. typedef unsigned char *TW_MEMREF;
  84. #endif /* _UNIX_ */
  85. /****************************************************************************
  86. * Type Definitions *
  87. ****************************************************************************/
  88. /* String types. These include room for the strings and a NULL char, *
  89. * or, on the Mac, a length byte followed by the string. *
  90. * TW_STR255 must hold less than 256 chars so length fits in first byte. */
  91. typedef char TW_STR32[34], FAR *pTW_STR32;
  92. typedef char TW_STR64[66], FAR *pTW_STR64;
  93. typedef char TW_STR128[130], FAR *pTW_STR128;
  94. typedef char TW_STR255[256], FAR *pTW_STR255;
  95. /* Numeric types. */
  96. typedef char TW_INT8, FAR *pTW_INT8;
  97. typedef short TW_INT16, FAR *pTW_INT16;
  98. typedef long TW_INT32, FAR *pTW_INT32;
  99. typedef unsigned char TW_UINT8, FAR *pTW_UINT8;
  100. typedef unsigned short TW_UINT16, FAR *pTW_UINT16;
  101. typedef unsigned long TW_UINT32, FAR *pTW_UINT32;
  102. typedef unsigned short TW_BOOL, FAR *pTW_BOOL;
  103. /* Fixed point structure type. */
  104. typedef struct {
  105. TW_INT16 Whole; /* maintains the sign */
  106. TW_UINT16 Frac;
  107. } TW_FIX32, FAR *pTW_FIX32;
  108. /****************************************************************************
  109. * Structure Definitions *
  110. ****************************************************************************/
  111. /* No DAT needed. */
  112. typedef struct {
  113. TW_FIX32 X;
  114. TW_FIX32 Y;
  115. TW_FIX32 Z;
  116. } TW_CIEPOINT, FAR * pTW_CIEPOINT;
  117. /* No DAT needed. */
  118. typedef struct {
  119. TW_FIX32 StartIn;
  120. TW_FIX32 BreakIn;
  121. TW_FIX32 EndIn;
  122. TW_FIX32 StartOut;
  123. TW_FIX32 BreakOut;
  124. TW_FIX32 EndOut;
  125. TW_FIX32 Gamma;
  126. TW_FIX32 SampleCount; /* if =0 use the gamma */
  127. } TW_DECODEFUNCTION, FAR * pTW_DECODEFUNCTION;
  128. /* No DAT needed. */
  129. typedef struct {
  130. TW_UINT8 Index; /* Value used to index into the color table. */
  131. TW_UINT8 Channel1; /* First tri-stimulus value (e.g Red) */
  132. TW_UINT8 Channel2; /* Second tri-stimulus value (e.g Green) */
  133. TW_UINT8 Channel3; /* Third tri-stimulus value (e.g Blue) */
  134. } TW_ELEMENT8, FAR * pTW_ELEMENT8;
  135. /* No DAT. Defines a frame rectangle in ICAP_UNITS coordinates. */
  136. typedef struct {
  137. TW_FIX32 Left;
  138. TW_FIX32 Top;
  139. TW_FIX32 Right;
  140. TW_FIX32 Bottom;
  141. } TW_FRAME, FAR * pTW_FRAME;
  142. /* No DAT needed. Used to manage memory buffers. */
  143. typedef struct {
  144. TW_UINT32 Flags; /* Any combination of the TWMF_ constants. */
  145. TW_UINT32 Length; /* Number of bytes stored in buffer TheMem. */
  146. TW_MEMREF TheMem; /* Pointer or handle to the allocated memory buffer. */
  147. } TW_MEMORY, FAR * pTW_MEMORY;
  148. /* No DAT needed. */
  149. typedef struct {
  150. TW_DECODEFUNCTION Decode[3];
  151. TW_FIX32 Mix[3][3];
  152. } TW_TRANSFORMSTAGE, FAR * pTW_TRANSFORMSTAGE;
  153. /* No DAT needed. Describes version of software that's running. */
  154. typedef struct {
  155. TW_UINT16 MajorNum; /* Major revision number of the software. */
  156. TW_UINT16 MinorNum; /* Incremental revision number of the software. */
  157. TW_UINT16 Language; /* e.g. TWLG_SWISSFRENCH */
  158. TW_UINT16 Country; /* e.g. TWCY_SWITZERLAND */
  159. TW_STR32 Info; /* e.g. "1.0b3 Beta release" */
  160. } TW_VERSION, FAR * pTW_VERSION;
  161. /* TWON_ARRAY. Container for array of values (a simplified TW_ENUMERATION) */
  162. typedef struct {
  163. TW_UINT16 ItemType;
  164. TW_UINT32 NumItems; /* How many items in ItemList */
  165. TW_UINT8 ItemList[1]; /* Array of ItemType values starts here */
  166. } TW_ARRAY, FAR * pTW_ARRAY;
  167. /* TWON_ENUMERATION. Container for a collection of values. */
  168. typedef struct {
  169. TW_UINT16 ItemType;
  170. TW_UINT32 NumItems; /* How many items in ItemList */
  171. TW_UINT32 CurrentIndex; /* Current value is in ItemList[CurrentIndex] */
  172. TW_UINT32 DefaultIndex; /* Powerup value is in ItemList[DefaultIndex] */
  173. TW_UINT8 ItemList[1]; /* Array of ItemType values starts here */
  174. } TW_ENUMERATION, FAR * pTW_ENUMERATION;
  175. /* TWON_ONEVALUE. Container for one value. */
  176. typedef struct {
  177. TW_UINT16 ItemType;
  178. TW_UINT32 Item;
  179. } TW_ONEVALUE, FAR * pTW_ONEVALUE;
  180. /* TWON_RANGE. Container for a range of values. */
  181. typedef struct {
  182. TW_UINT16 ItemType;
  183. TW_UINT32 MinValue; /* Starting value in the range. */
  184. TW_UINT32 MaxValue; /* Final value in the range. */
  185. TW_UINT32 StepSize; /* Increment from MinValue to MaxValue. */
  186. TW_UINT32 DefaultValue; /* Power-up value. */
  187. TW_UINT32 CurrentValue; /* The value that is currently in effect. */
  188. } TW_RANGE, FAR * pTW_RANGE;
  189. /* DAT_CAPABILITY. Used by app to get/set capability from/in a data source. */
  190. typedef struct {
  191. TW_UINT16 Cap; /* id of capability to set or get, e.g. CAP_BRIGHTNESS */
  192. TW_UINT16 ConType; /* TWON_ONEVALUE, _RANGE, _ENUMERATION or _ARRAY */
  193. TW_HANDLE hContainer; /* Handle to container of type Dat */
  194. } TW_CAPABILITY, FAR * pTW_CAPABILITY;
  195. /* DAT_CIECOLOR. */
  196. typedef struct {
  197. TW_UINT16 ColorSpace;
  198. TW_INT16 LowEndian;
  199. TW_INT16 DeviceDependent;
  200. TW_INT32 VersionNumber;
  201. TW_TRANSFORMSTAGE StageABC;
  202. TW_TRANSFORMSTAGE StageLMN;
  203. TW_CIEPOINT WhitePoint;
  204. TW_CIEPOINT BlackPoint;
  205. TW_CIEPOINT WhitePaper;
  206. TW_CIEPOINT BlackInk;
  207. TW_FIX32 Samples[1];
  208. } TW_CIECOLOR, FAR * pTW_CIECOLOR;
  209. /* DAT_EVENT. For passing events down from the app to the DS. */
  210. typedef struct {
  211. TW_MEMREF pEvent; /* Windows pMSG or Mac pEvent. */
  212. TW_UINT16 TWMessage; /* TW msg from data source, e.g. MSG_XFERREADY */
  213. } TW_EVENT, FAR * pTW_EVENT;
  214. /* DAT_GRAYRESPONSE */
  215. typedef struct {
  216. TW_ELEMENT8 Response[1];
  217. } TW_GRAYRESPONSE, FAR * pTW_GRAYRESPONSE;
  218. /* DAT_IDENTITY. Identifies the program/library/code resource. */
  219. typedef struct {
  220. TW_UINT32 Id; /* Unique number. In Windows, app hWnd */
  221. TW_VERSION Version; /* Identifies the piece of code */
  222. TW_UINT16 ProtocolMajor; /* App and DS must set to TWON_PROTOCOLMAJOR */
  223. TW_UINT16 ProtocolMinor; /* App and DS must set to TWON_PROTOCOLMINOR */
  224. TW_UINT32 SupportedGroups; /* Bit field OR combination of DG_ constants */
  225. TW_STR32 Manufacturer; /* Manufacturer name, e.g. "Hewlett-Packard" */
  226. TW_STR32 ProductFamily; /* Product family name, e.g. "ScanJet" */
  227. TW_STR32 ProductName; /* Product name, e.g. "ScanJet Plus" */
  228. } TW_IDENTITY, FAR * pTW_IDENTITY;
  229. /* DAT_IMAGEINFO. App gets detailed image info from DS with this. */
  230. typedef struct {
  231. TW_FIX32 XResolution; /* Resolution in the horizontal */
  232. TW_FIX32 YResolution; /* Resolution in the vertical */
  233. TW_INT32 ImageWidth; /* Columns in the image, -1 if unknown by DS*/
  234. TW_INT32 ImageLength; /* Rows in the image, -1 if unknown by DS */
  235. TW_INT16 SamplesPerPixel; /* Number of samples per pixel, 3 for RGB */
  236. TW_INT16 BitsPerSample[8]; /* Number of bits for each sample */
  237. TW_INT16 BitsPerPixel; /* Number of bits for each padded pixel */
  238. TW_BOOL Planar; /* True if Planar, False if chunky */
  239. TW_INT16 PixelType; /* How to interp data; photo interp (TWPT_) */
  240. TW_UINT16 Compression; /* How the data is compressed (TWCP_xxxx) */
  241. } TW_IMAGEINFO, FAR * pTW_IMAGEINFO;
  242. /* DAT_IMAGELAYOUT. Provides image layout information in current units. */
  243. typedef struct {
  244. TW_FRAME Frame; /* Frame coords within larger document */
  245. TW_UINT32 DocumentNumber;
  246. TW_UINT32 PageNumber; /* Reset when you go to next document */
  247. TW_UINT32 FrameNumber; /* Reset when you go to next page */
  248. } TW_IMAGELAYOUT, FAR * pTW_IMAGELAYOUT;
  249. /* DAT_IMAGEMEMXFER. Used to pass image data (e.g. in strips) from DS to app.*/
  250. typedef struct {
  251. TW_UINT16 Compression; /* How the data is compressed */
  252. TW_UINT32 BytesPerRow; /* Number of bytes in a row of data */
  253. TW_UINT32 Columns; /* How many columns */
  254. TW_UINT32 Rows; /* How many rows */
  255. TW_UINT32 XOffset; /* How far from the side of the image */
  256. TW_UINT32 YOffset; /* How far from the top of the image */
  257. TW_UINT32 BytesWritten; /* How many bytes written in Memory */
  258. TW_MEMORY Memory; /* Mem struct used to pass actual image data */
  259. } TW_IMAGEMEMXFER, FAR * pTW_IMAGEMEMXFER;
  260. /* Changed in 1.1: QuantTable, HuffmanDC, HuffmanAC TW_MEMREF -> TW_MEMORY */
  261. /* DAT_JPEGCOMPRESSION. Based on JPEG Draft International Std, ver 10918-1. */
  262. typedef struct {
  263. TW_UINT16 ColorSpace; /* One of the TWPT_xxxx values */
  264. TW_UINT32 SubSampling; /* Two word "array" for subsampling values */
  265. TW_UINT16 NumComponents; /* Number of color components in image */
  266. TW_UINT16 RestartFrequency; /* Frequency of restart marker codes in MDU's */
  267. TW_UINT16 QuantMap[4]; /* Mapping of components to QuantTables */
  268. TW_MEMORY QuantTable[4]; /* Quantization tables */
  269. TW_UINT16 HuffmanMap[4]; /* Mapping of components to Huffman tables */
  270. TW_MEMORY HuffmanDC[2]; /* DC Huffman tables */
  271. TW_MEMORY HuffmanAC[2]; /* AC Huffman tables */
  272. } TW_JPEGCOMPRESSION, FAR * pTW_JPEGCOMPRESSION;
  273. /* DAT_PALETTE8. Color palette when TWPT_PALETTE pixels xfer'd in mem buf. */
  274. typedef struct {
  275. TW_UINT16 NumColors; /* Number of colors in the color table. */
  276. TW_UINT16 PaletteType; /* TWPA_xxxx, specifies type of palette. */
  277. TW_ELEMENT8 Colors[256]; /* Array of palette values starts here. */
  278. } TW_PALETTE8, FAR * pTW_PALETTE8;
  279. /* DAT_PENDINGXFERS. Used with MSG_ENDXFER to indicate additional data. */
  280. typedef struct {
  281. TW_UINT16 Count;
  282. union {
  283. TW_UINT32 EOJ;
  284. TW_UINT32 Reserved;
  285. };
  286. } TW_PENDINGXFERS, FAR *pTW_PENDINGXFERS;
  287. /* DAT_RGBRESPONSE */
  288. typedef struct {
  289. TW_ELEMENT8 Response[1];
  290. } TW_RGBRESPONSE, FAR * pTW_RGBRESPONSE;
  291. /* DAT_SETUPFILEXFER. Sets up DS to app data transfer via a file. */
  292. typedef struct {
  293. TW_STR255 FileName;
  294. TW_UINT16 Format; /* Any TWFF_ constant */
  295. TW_INT16 VRefNum; /* Used for Mac only */
  296. } TW_SETUPFILEXFER, FAR * pTW_SETUPFILEXFER;
  297. /* DAT_SETUPMEMXFER. Sets up DS to app data transfer via a memory buffer. */
  298. typedef struct {
  299. TW_UINT32 MinBufSize;
  300. TW_UINT32 MaxBufSize;
  301. TW_UINT32 Preferred;
  302. } TW_SETUPMEMXFER, FAR * pTW_SETUPMEMXFER;
  303. /* DAT_STATUS. App gets detailed status info from a data source with this. */
  304. typedef struct {
  305. TW_UINT16 ConditionCode; /* Any TWCC_ constant */
  306. TW_UINT16 Reserved; /* Future expansion space */
  307. } TW_STATUS, FAR * pTW_STATUS;
  308. /* DAT_USERINTERFACE. Coordinates UI between app and data source. */
  309. typedef struct {
  310. TW_BOOL ShowUI; /* TRUE if DS should bring up its UI */
  311. TW_BOOL ModalUI; /* For Mac only - true if the DS's UI is modal */
  312. TW_HANDLE hParent; /* For windows only - App window handle */
  313. } TW_USERINTERFACE, FAR * pTW_USERINTERFACE;
  314. /* SDH - 03/21/95 - TWUNK */
  315. /* DAT_TWUNKIDENTITY. Provides DS identity and 'other' information necessary */
  316. /* across thunk link. */
  317. typedef struct {
  318. TW_IDENTITY identity; /* Identity of data source. */
  319. TW_STR255 dsPath; /* Full path and file name of data source. */
  320. } TW_TWUNKIDENTITY, FAR * pTW_TWUNKIDENTITY;
  321. /* SDH - 03/21/95 - TWUNK */
  322. /* Provides DS_Entry parameters over thunk link. */
  323. typedef struct
  324. {
  325. TW_INT8 destFlag; /* TRUE if dest is not NULL */
  326. TW_IDENTITY dest; /* Identity of data source (if used) */
  327. TW_INT32 dataGroup; /* DSM_Entry dataGroup parameter */
  328. TW_INT16 dataArgType; /* DSM_Entry dataArgType parameter */
  329. TW_INT16 message; /* DSM_Entry message parameter */
  330. TW_INT32 pDataSize; /* Size of pData (0 if NULL) */
  331. // TW_MEMREF pData; /* Based on implementation specifics, a */
  332. /* pData parameter makes no sense in this */
  333. /* structure, but data (if provided) will be*/
  334. /* appended in the data block. */
  335. } TW_TWUNKDSENTRYPARAMS, FAR * pTW_TWUNKDSENTRYPARAMS;
  336. /* SDH - 03/21/95 - TWUNK */
  337. /* Provides DS_Entry results over thunk link. */
  338. typedef struct
  339. {
  340. TW_UINT16 returnCode; /* Thunker DsEntry return code. */
  341. TW_UINT16 conditionCode; /* Thunker DsEntry condition code. */
  342. TW_INT32 pDataSize; /* Size of pData (0 if NULL) */
  343. // TW_MEMREF pData; /* Based on implementation specifics, a */
  344. /* pData parameter makes no sense in this */
  345. /* structure, but data (if provided) will be*/
  346. /* appended in the data block. */
  347. } TW_TWUNKDSENTRYRETURN, FAR * pTW_TWUNKDSENTRYRETURN;
  348. /* WJD - 950818 */
  349. /* Added for 1.6 Specification */
  350. /* TWAIN 1.6 CAP_SUPPORTEDCAPSEXT structure */
  351. typedef struct
  352. {
  353. TW_UINT16 Cap; /* Which CAP/ICAP info is relevant to */
  354. TW_UINT16 Properties; /* Messages this CAP/ICAP supports */
  355. } TW_CAPEXT, FAR * pTW_CAPEXT;
  356. /* ----------------------------------------------------------------------- *\
  357. Version 1.7: Added Following data structure for Document Imaging
  358. July 1997 Enhancement.
  359. KHL TW_CUSTOMDSDATA -- For Saving and Restoring Source's
  360. state.
  361. TW_INFO -- Each attribute for extended image
  362. information.
  363. TW_EXTIMAGEINFO -- Extended image information structure.
  364. \* ----------------------------------------------------------------------- */
  365. typedef struct {
  366. TW_UINT32 InfoLength; /* Length of Information in bytes. */
  367. TW_HANDLE hData; /* Place holder for data, DS Allocates */
  368. }TW_CUSTOMDSDATA, FAR *pTW_CUSTOMDSDATA;
  369. typedef struct {
  370. TW_UINT16 InfoID;
  371. TW_UINT16 ItemType;
  372. TW_UINT16 NumItems;
  373. TW_UINT16 CondCode;
  374. TW_UINT32 Item;
  375. }TW_INFO, FAR* pTW_INFO;
  376. typedef struct {
  377. TW_UINT32 NumInfos;
  378. TW_INFO Info[1];
  379. }TW_EXTIMAGEINFO, FAR* pTW_EXTIMAGEINFO;
  380. /****************************************************************************
  381. * Generic Constants *
  382. ****************************************************************************/
  383. #define TWON_ARRAY 3 /* indicates TW_ARRAY container */
  384. #define TWON_ENUMERATION 4 /* indicates TW_ENUMERATION container */
  385. #define TWON_ONEVALUE 5 /* indicates TW_ONEVALUE container */
  386. #define TWON_RANGE 6 /* indicates TW_RANGE container */
  387. #define TWON_ICONID 962 /* res Id of icon used in USERSELECT lbox */
  388. #define TWON_DSMID 461 /* res Id of the DSM version num resource */
  389. #define TWON_DSMCODEID 63 /* res Id of the Mac SM Code resource */
  390. #define TWON_DONTCARE8 0xff
  391. #define TWON_DONTCARE16 0xffff
  392. #define TWON_DONTCARE32 0xffffffff
  393. /* Flags used in TW_MEMORY structure. */
  394. #define TWMF_APPOWNS 0x1
  395. #define TWMF_DSMOWNS 0x2
  396. #define TWMF_DSOWNS 0x4
  397. #define TWMF_POINTER 0x8
  398. #define TWMF_HANDLE 0x10
  399. /* Palette types for TW_PALETTE8 */
  400. #define TWPA_RGB 0
  401. #define TWPA_GRAY 1
  402. #define TWPA_CMY 2
  403. /* There are four containers used for capabilities negotiation:
  404. * TWON_ONEVALUE, TWON_RANGE, TWON_ENUMERATION, TWON_ARRAY
  405. * In each container structure ItemType can be TWTY_INT8, TWTY_INT16, etc.
  406. * The kind of data stored in the container can be determined by doing
  407. * DCItemSize[ItemType] where the following is defined in TWAIN glue code:
  408. * DCItemSize[]= { sizeof(TW_INT8),
  409. * sizeof(TW_INT16),
  410. * etc.
  411. * sizeof(TW_UINT32) };
  412. *
  413. */
  414. #define TWTY_INT8 0x0000 /* Means Item is a TW_INT8 */
  415. #define TWTY_INT16 0x0001 /* Means Item is a TW_INT16 */
  416. #define TWTY_INT32 0x0002 /* Means Item is a TW_INT32 */
  417. #define TWTY_UINT8 0x0003 /* Means Item is a TW_UINT8 */
  418. #define TWTY_UINT16 0x0004 /* Means Item is a TW_UINT16 */
  419. #define TWTY_UINT32 0x0005 /* Means Item is a TW_UINT32 */
  420. #define TWTY_BOOL 0x0006 /* Means Item is a TW_BOOL */
  421. #define TWTY_FIX32 0x0007 /* Means Item is a TW_FIX32 */
  422. #define TWTY_FRAME 0x0008 /* Means Item is a TW_FRAME */
  423. #define TWTY_STR32 0x0009 /* Means Item is a TW_STR32 */
  424. #define TWTY_STR64 0x000a /* Means Item is a TW_STR64 */
  425. #define TWTY_STR128 0x000b /* Means Item is a TW_STR128 */
  426. #define TWTY_STR255 0x000c /* Means Item is a TW_STR255 */
  427. /****************************************************************************
  428. * Capability Constants *
  429. ****************************************************************************/
  430. /* ICAP_BITORDER values (BO_ means Bit Order) */
  431. #define TWBO_LSBFIRST 0
  432. #define TWBO_MSBFIRST 1
  433. /* ICAP_COMPRESSION values (CP_ means ComPression ) */
  434. #define TWCP_NONE 0
  435. #define TWCP_PACKBITS 1
  436. #define TWCP_GROUP31D 2 /* Follows CCITT spec (no End Of Line) */
  437. #define TWCP_GROUP31DEOL 3 /* Follows CCITT spec (has End Of Line) */
  438. #define TWCP_GROUP32D 4 /* Follows CCITT spec (use cap for K Factor) */
  439. #define TWCP_GROUP4 5 /* Follows CCITT spec */
  440. #define TWCP_JPEG 6 /* Use capability for more info */
  441. #define TWCP_LZW 7 /* Must license from Unisys and IBM to use */
  442. #define TWCP_JBIG 8 /* For Bitonal images -- Added 1.7 KHL */
  443. /* ICAP_IMAGEFILEFORMAT values (FF_means File Format) */
  444. #define TWFF_TIFF 0 /* Tagged Image File Format */
  445. #define TWFF_PICT 1 /* Macintosh PICT */
  446. #define TWFF_BMP 2 /* Windows Bitmap */
  447. #define TWFF_XBM 3 /* X-Windows Bitmap */
  448. #define TWFF_JFIF 4 /* JPEG File Interchange Format */
  449. /* ICAP_FILTER values (FT_ means Filter Type) */
  450. #define TWFT_RED 0
  451. #define TWFT_GREEN 1
  452. #define TWFT_BLUE 2
  453. #define TWFT_NONE 3
  454. #define TWFT_WHITE 4
  455. #define TWFT_CYAN 5
  456. #define TWFT_MAGENTA 6
  457. #define TWFT_YELLOW 7
  458. #define TWFT_BLACK 8
  459. /* ICAP_LIGHTPATH values (LP_ means Light Path) */
  460. #define TWLP_REFLECTIVE 0
  461. #define TWLP_TRANSMISSIVE 1
  462. /* ICAP_LIGHTSOURCE values (LS_ means Light Source) */
  463. #define TWLS_RED 0
  464. #define TWLS_GREEN 1
  465. #define TWLS_BLUE 2
  466. #define TWLS_NONE 3
  467. #define TWLS_WHITE 4
  468. #define TWLS_UV 5
  469. #define TWLS_IR 6
  470. /* ICAP_ORIENTATION values (OR_ means ORientation) */
  471. #define TWOR_ROT0 0
  472. #define TWOR_ROT90 1
  473. #define TWOR_ROT180 2
  474. #define TWOR_ROT270 3
  475. #define TWOR_PORTRAIT TWOR_ROT0
  476. #define TWOR_LANDSCAPE TWOR_ROT270
  477. /* ICAP_PLANARCHUNKY values (PC_ means Planar/Chunky ) */
  478. #define TWPC_CHUNKY 0
  479. #define TWPC_PLANAR 1
  480. /* ICAP_PIXELFLAVOR values (PF_ means Pixel Flavor) */
  481. #define TWPF_CHOCOLATE 0 /* zero pixel represents darkest shade */
  482. #define TWPF_VANILLA 1 /* zero pixel represents lightest shade */
  483. /* ICAP_PIXELTYPE values (PT_ means Pixel Type) */
  484. #define TWPT_BW 0 /* Black and White */
  485. #define TWPT_GRAY 1
  486. #define TWPT_RGB 2
  487. #define TWPT_PALETTE 3
  488. #define TWPT_CMY 4
  489. #define TWPT_CMYK 5
  490. #define TWPT_YUV 6
  491. #define TWPT_YUVK 7
  492. #define TWPT_CIEXYZ 8
  493. /* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */
  494. #define TWSS_NONE 0
  495. #define TWSS_A4LETTER 1
  496. #define TWSS_B5LETTER 2
  497. #define TWSS_USLETTER 3
  498. #define TWSS_USLEGAL 4
  499. /* Added 1.5 */
  500. #define TWSS_A5 5
  501. #define TWSS_B4 6
  502. #define TWSS_B6 7
  503. //#define TWSS_B 8
  504. /* Added 1.7 */
  505. #define TWSS_USLEDGER 9
  506. #define TWSS_USEXECUTIVE 10
  507. #define TWSS_A3 11
  508. #define TWSS_B3 12
  509. #define TWSS_A6 13
  510. #define TWSS_C4 14
  511. #define TWSS_C5 15
  512. #define TWSS_C6 16
  513. /* ICAP_XFERMECH values (SX_ means Setup XFer) */
  514. #define TWSX_NATIVE 0
  515. #define TWSX_FILE 1
  516. #define TWSX_MEMORY 2
  517. /* ICAP_UNITS values (UN_ means UNits) */
  518. #define TWUN_INCHES 0
  519. #define TWUN_CENTIMETERS 1
  520. #define TWUN_PICAS 2
  521. #define TWUN_POINTS 3
  522. #define TWUN_TWIPS 4
  523. #define TWUN_PIXELS 5
  524. /* Added 1.5 */
  525. /* ICAP_BITDEPTHREDUCTION values (BR_ means Bitdepth Reduction) */
  526. #define TWBR_THRESHOLD 0
  527. #define TWBR_HALFTONE 1
  528. #define TWBR_CUSTHALFTONE 2
  529. #define TWBR_DIFFUSION 3
  530. /* Added 1.7 */
  531. /* ICAP_DUPLEX values */
  532. #define TWDX_NONE 0
  533. #define TWDX_1PASSDUPLEX 1
  534. #define TWDX_2PASSDUPLEX 2
  535. /* Added 1.7 */
  536. /* TWEI_BARCODETYPE values */
  537. #define TWBT_3OF9 0
  538. #define TWBT_2OF5INTERLEAVED 1
  539. #define TWBT_2OF5NONINTERLEAVED 2
  540. #define TWBT_CODE93 3
  541. #define TWBT_CODE128 4
  542. #define TWBT_UCC128 5
  543. #define TWBT_CODABAR 6
  544. #define TWBT_UPCA 7
  545. #define TWBT_UPCE 8
  546. #define TWBT_EAN8 9
  547. #define TWBT_EAN13 10
  548. #define TWBT_POSTNET 11
  549. #define TWBT_PDF417 12
  550. /* Added 1.7 */
  551. /* TWEI_DESKEWSTATUS values */
  552. #define TWDSK_SUCCESS 0
  553. #define TWDSK_REPORTONLY 1
  554. #define TWDSK_FAIL 2
  555. #define TWDSK_DISABLED 3
  556. /* Added 1.7 */
  557. /* TWEI_PATCHCODE values */
  558. #define TWPCH_PATCH1 0
  559. #define TWPCH_PATCH2 1
  560. #define TWPCH_PATCH3 2
  561. #define TWPCH_PATCH4 3
  562. #define TWPCH_PATCH6 4
  563. #define TWPCH_PATCHT 5
  564. /* Added 1.7 */
  565. /* CAP_JOBCONTROL values */
  566. #define TWJC_NONE 0
  567. #define TWJC_JSIC 1
  568. #define TWJC_JSIS 2
  569. #define TWJC_JSXC 3
  570. #define TWJC_JSXS 4
  571. /****************************************************************************
  572. * Country Constants *
  573. ****************************************************************************/
  574. #define TWCY_AFGHANISTAN 1001
  575. #define TWCY_ALGERIA 213
  576. #define TWCY_AMERICANSAMOA 684
  577. #define TWCY_ANDORRA 033
  578. #define TWCY_ANGOLA 1002
  579. #define TWCY_ANGUILLA 8090
  580. #define TWCY_ANTIGUA 8091
  581. #define TWCY_ARGENTINA 54
  582. #define TWCY_ARUBA 297
  583. #define TWCY_ASCENSIONI 247
  584. #define TWCY_AUSTRALIA 61
  585. #define TWCY_AUSTRIA 43
  586. #define TWCY_BAHAMAS 8092
  587. #define TWCY_BAHRAIN 973
  588. #define TWCY_BANGLADESH 880
  589. #define TWCY_BARBADOS 8093
  590. #define TWCY_BELGIUM 32
  591. #define TWCY_BELIZE 501
  592. #define TWCY_BENIN 229
  593. #define TWCY_BERMUDA 8094
  594. #define TWCY_BHUTAN 1003
  595. #define TWCY_BOLIVIA 591
  596. #define TWCY_BOTSWANA 267
  597. #define TWCY_BRITAIN 6
  598. #define TWCY_BRITVIRGINIS 8095
  599. #define TWCY_BRAZIL 55
  600. #define TWCY_BRUNEI 673
  601. #define TWCY_BULGARIA 359
  602. #define TWCY_BURKINAFASO 1004
  603. #define TWCY_BURMA 1005
  604. #define TWCY_BURUNDI 1006
  605. #define TWCY_CAMAROON 237
  606. #define TWCY_CANADA 2
  607. #define TWCY_CAPEVERDEIS 238
  608. #define TWCY_CAYMANIS 8096
  609. #define TWCY_CENTRALAFREP 1007
  610. #define TWCY_CHAD 1008
  611. #define TWCY_CHILE 56
  612. #define TWCY_CHINA 86
  613. #define TWCY_CHRISTMASIS 1009
  614. #define TWCY_COCOSIS 1009
  615. #define TWCY_COLOMBIA 57
  616. #define TWCY_COMOROS 1010
  617. #define TWCY_CONGO 1011
  618. #define TWCY_COOKIS 1012
  619. #define TWCY_COSTARICA 506
  620. #define TWCY_CUBA 005
  621. #define TWCY_CYPRUS 357
  622. #define TWCY_CZECHOSLOVAKIA 42
  623. #define TWCY_DENMARK 45
  624. #define TWCY_DJIBOUTI 1013
  625. #define TWCY_DOMINICA 8097
  626. #define TWCY_DOMINCANREP 8098
  627. #define TWCY_EASTERIS 1014
  628. #define TWCY_ECUADOR 593
  629. #define TWCY_EGYPT 20
  630. #define TWCY_ELSALVADOR 503
  631. #define TWCY_EQGUINEA 1015
  632. #define TWCY_ETHIOPIA 251
  633. #define TWCY_FALKLANDIS 1016
  634. #define TWCY_FAEROEIS 298
  635. #define TWCY_FIJIISLANDS 679
  636. #define TWCY_FINLAND 358
  637. #define TWCY_FRANCE 33
  638. #define TWCY_FRANTILLES 596
  639. #define TWCY_FRGUIANA 594
  640. #define TWCY_FRPOLYNEISA 689
  641. #define TWCY_FUTANAIS 1043
  642. #define TWCY_GABON 241
  643. #define TWCY_GAMBIA 220
  644. #define TWCY_GERMANY 49
  645. #define TWCY_GHANA 233
  646. #define TWCY_GIBRALTER 350
  647. #define TWCY_GREECE 30
  648. #define TWCY_GREENLAND 299
  649. #define TWCY_GRENADA 8099
  650. #define TWCY_GRENEDINES 8015
  651. #define TWCY_GUADELOUPE 590
  652. #define TWCY_GUAM 671
  653. #define TWCY_GUANTANAMOBAY 5399
  654. #define TWCY_GUATEMALA 502
  655. #define TWCY_GUINEA 224
  656. #define TWCY_GUINEABISSAU 1017
  657. #define TWCY_GUYANA 592
  658. #define TWCY_HAITI 509
  659. #define TWCY_HONDURAS 504
  660. #define TWCY_HONGKONG 852
  661. #define TWCY_HUNGARY 36
  662. #define TWCY_ICELAND 354
  663. #define TWCY_INDIA 91
  664. #define TWCY_INDONESIA 62
  665. #define TWCY_IRAN 98
  666. #define TWCY_IRAQ 964
  667. #define TWCY_IRELAND 353
  668. #define TWCY_ISRAEL 972
  669. #define TWCY_ITALY 39
  670. #define TWCY_IVORYCOAST 225
  671. #define TWCY_JAMAICA 8010
  672. #define TWCY_JAPAN 81
  673. #define TWCY_JORDAN 962
  674. #define TWCY_KENYA 254
  675. #define TWCY_KIRIBATI 1018
  676. #define TWCY_KOREA 82
  677. #define TWCY_KUWAIT 965
  678. #define TWCY_LAOS 1019
  679. #define TWCY_LEBANON 1020
  680. #define TWCY_LIBERIA 231
  681. #define TWCY_LIBYA 218
  682. #define TWCY_LIECHTENSTEIN 41
  683. #define TWCY_LUXENBOURG 352
  684. #define TWCY_MACAO 853
  685. #define TWCY_MADAGASCAR 1021
  686. #define TWCY_MALAWI 265
  687. #define TWCY_MALAYSIA 60
  688. #define TWCY_MALDIVES 960
  689. #define TWCY_MALI 1022
  690. #define TWCY_MALTA 356
  691. #define TWCY_MARSHALLIS 692
  692. #define TWCY_MAURITANIA 1023
  693. #define TWCY_MAURITIUS 230
  694. #define TWCY_MEXICO 3
  695. #define TWCY_MICRONESIA 691
  696. #define TWCY_MIQUELON 508
  697. #define TWCY_MONACO 33
  698. #define TWCY_MONGOLIA 1024
  699. #define TWCY_MONTSERRAT 8011
  700. #define TWCY_MOROCCO 212
  701. #define TWCY_MOZAMBIQUE 1025
  702. #define TWCY_NAMIBIA 264
  703. #define TWCY_NAURU 1026
  704. #define TWCY_NEPAL 977
  705. #define TWCY_NETHERLANDS 31
  706. #define TWCY_NETHANTILLES 599
  707. #define TWCY_NEVIS 8012
  708. #define TWCY_NEWCALEDONIA 687
  709. #define TWCY_NEWZEALAND 64
  710. #define TWCY_NICARAGUA 505
  711. #define TWCY_NIGER 227
  712. #define TWCY_NIGERIA 234
  713. #define TWCY_NIUE 1027
  714. #define TWCY_NORFOLKI 1028
  715. #define TWCY_NORWAY 47
  716. #define TWCY_OMAN 968
  717. #define TWCY_PAKISTAN 92
  718. #define TWCY_PALAU 1029
  719. #define TWCY_PANAMA 507
  720. #define TWCY_PARAGUAY 595
  721. #define TWCY_PERU 51
  722. #define TWCY_PHILLIPPINES 63
  723. #define TWCY_PITCAIRNIS 1030
  724. #define TWCY_PNEWGUINEA 675
  725. #define TWCY_POLAND 48
  726. #define TWCY_PORTUGAL 351
  727. #define TWCY_QATAR 974
  728. #define TWCY_REUNIONI 1031
  729. #define TWCY_ROMANIA 40
  730. #define TWCY_RWANDA 250
  731. #define TWCY_SAIPAN 670
  732. #define TWCY_SANMARINO 39
  733. #define TWCY_SAOTOME 1033
  734. #define TWCY_SAUDIARABIA 966
  735. #define TWCY_SENEGAL 221
  736. #define TWCY_SEYCHELLESIS 1034
  737. #define TWCY_SIERRALEONE 1035
  738. #define TWCY_SINGAPORE 65
  739. #define TWCY_SOLOMONIS 1036
  740. #define TWCY_SOMALI 1037
  741. #define TWCY_SOUTHAFRICA 27
  742. #define TWCY_SPAIN 34
  743. #define TWCY_SRILANKA 94
  744. #define TWCY_STHELENA 1032
  745. #define TWCY_STKITTS 8013
  746. #define TWCY_STLUCIA 8014
  747. #define TWCY_STPIERRE 508
  748. #define TWCY_STVINCENT 8015
  749. #define TWCY_SUDAN 1038
  750. #define TWCY_SURINAME 597
  751. #define TWCY_SWAZILAND 268
  752. #define TWCY_SWEDEN 46
  753. #define TWCY_SWITZERLAND 41
  754. #define TWCY_SYRIA 1039
  755. #define TWCY_TAIWAN 886
  756. #define TWCY_TANZANIA 255
  757. #define TWCY_THAILAND 66
  758. #define TWCY_TOBAGO 8016
  759. #define TWCY_TOGO 228
  760. #define TWCY_TONGAIS 676
  761. #define TWCY_TRINIDAD 8016
  762. #define TWCY_TUNISIA 216
  763. #define TWCY_TURKEY 90
  764. #define TWCY_TURKSCAICOS 8017
  765. #define TWCY_TUVALU 1040
  766. #define TWCY_UGANDA 256
  767. #define TWCY_USSR 7
  768. #define TWCY_UAEMIRATES 971
  769. #define TWCY_UNITEDKINGDOM 44
  770. #define TWCY_USA 1
  771. #define TWCY_URUGUAY 598
  772. #define TWCY_VANUATU 1041
  773. #define TWCY_VATICANCITY 39
  774. #define TWCY_VENEZUELA 58
  775. #define TWCY_WAKE 1042
  776. #define TWCY_WALLISIS 1043
  777. #define TWCY_WESTERNSAHARA 1044
  778. #define TWCY_WESTERNSAMOA 1045
  779. #define TWCY_YEMEN 1046
  780. #define TWCY_YUGOSLAVIA 38
  781. #define TWCY_ZAIRE 243
  782. #define TWCY_ZAMBIA 260
  783. #define TWCY_ZIMBABWE 263
  784. /****************************************************************************
  785. * Language Constants *
  786. ****************************************************************************/
  787. #define TWLG_DAN 0 /* Danish */
  788. #define TWLG_DUT 1 /* Dutch */
  789. #define TWLG_ENG 2 /* International English */
  790. #define TWLG_FCF 3 /* French Canadian */
  791. #define TWLG_FIN 4 /* Finnish */
  792. #define TWLG_FRN 5 /* French */
  793. #define TWLG_GER 6 /* German */
  794. #define TWLG_ICE 7 /* Icelandic */
  795. #define TWLG_ITN 8 /* Italian */
  796. #define TWLG_NOR 9 /* Norwegian */
  797. #define TWLG_POR 10 /* Portuguese */
  798. #define TWLG_SPA 11 /* Spanish */
  799. #define TWLG_SWE 12 /* Swedish */
  800. #define TWLG_USA 13 /* U.S. English */
  801. /****************************************************************************
  802. * Data Groups *
  803. ****************************************************************************/
  804. /* More Data Groups may be added in the future.
  805. * Possible candidates include text, vector graphics, sound, etc.
  806. * NOTE: Data Group constants must be powers of 2 as they are used
  807. * as bitflags when App asks DSM to present a list of DSs.
  808. */
  809. #define DG_CONTROL 0x0001L /* data pertaining to control */
  810. #define DG_IMAGE 0x0002L /* data pertaining to raster images */
  811. /****************************************************************************
  812. * Data Argument Types *
  813. ****************************************************************************/
  814. /* SDH - 03/23/95 - WATCH */
  815. /* The thunker requires knowledge about size of data being passed in the */
  816. /* lpData parameter to DS_Entry (which is not readily available due to */
  817. /* type LPVOID. Thus, we key off the DAT_ argument to determine the size. */
  818. /* This has a couple implications: */
  819. /* 1) Any additional DAT_ features require modifications to the thunk code */
  820. /* for thunker support. */
  821. /* 2) Any applications which use the custom capabailites are not supported */
  822. /* under thunking since we have no way of knowing what size data (if */
  823. /* any) is being passed. */
  824. #define DAT_NULL 0x0000 /* No data or structure. */
  825. #define DAT_CUSTOMBASE 0x8000 /* Base of custom DATs. */
  826. /* Data Argument Types for the DG_CONTROL Data Group. */
  827. #define DAT_CAPABILITY 0x0001 /* TW_CAPABILITY */
  828. #define DAT_EVENT 0x0002 /* TW_EVENT */
  829. #define DAT_IDENTITY 0x0003 /* TW_IDENTITY */
  830. #define DAT_PARENT 0x0004 /* TW_HANDLE, app win handle in Windows */
  831. #define DAT_PENDINGXFERS 0x0005 /* TW_PENDINGXFERS */
  832. #define DAT_SETUPMEMXFER 0x0006 /* TW_SETUPMEMXFER */
  833. #define DAT_SETUPFILEXFER 0x0007 /* TW_SETUPFILEXFER */
  834. #define DAT_STATUS 0x0008 /* TW_STATUS */
  835. #define DAT_USERINTERFACE 0x0009 /* TW_USERINTERFACE */
  836. #define DAT_XFERGROUP 0x000a /* TW_UINT32 */
  837. /* SDH - 03/21/95 - TWUNK */
  838. /* Additional message required for thunker to request the special */
  839. /* identity information. */
  840. #define DAT_TWUNKIDENTITY 0x000b /* TW_TWUNKIDENTITY */
  841. #define DAT_CUSTOMDSDATA 0x000c /* TW_CUSTOMDSDATA. */
  842. /* Data Argument Types for the DG_IMAGE Data Group. */
  843. #define DAT_IMAGEINFO 0x0101 /* TW_IMAGEINFO */
  844. #define DAT_IMAGELAYOUT 0x0102 /* TW_IMAGELAYOUT */
  845. #define DAT_IMAGEMEMXFER 0x0103 /* TW_IMAGEMEMXFER */
  846. #define DAT_IMAGENATIVEXFER 0x0104 /* TW_UINT32 loword is hDIB, PICHandle */
  847. #define DAT_IMAGEFILEXFER 0x0105 /* Null data */
  848. #define DAT_CIECOLOR 0x0106 /* TW_CIECOLOR */
  849. #define DAT_GRAYRESPONSE 0x0107 /* TW_GRAYRESPONSE */
  850. #define DAT_RGBRESPONSE 0x0108 /* TW_RGBRESPONSE */
  851. #define DAT_JPEGCOMPRESSION 0x0109 /* TW_JPEGCOMPRESSION */
  852. #define DAT_PALETTE8 0x010a /* TW_PALETTE8 */
  853. #define DAT_EXTIMAGEINFO 0x010b /* TW_EXTIMAGEINFO -- for 1.7 Spec. */
  854. /****************************************************************************
  855. * Messages *
  856. ****************************************************************************/
  857. /* All message constants are unique.
  858. * Messages are grouped according to which DATs they are used with.*/
  859. #define MSG_NULL 0x0000 /* Used in TW_EVENT structure */
  860. #define MSG_CUSTOMBASE 0x8000 /* Base of custom messages */
  861. /* Generic messages may be used with any of several DATs. */
  862. #define MSG_GET 0x0001 /* Get one or more values */
  863. #define MSG_GETCURRENT 0x0002 /* Get current value */
  864. #define MSG_GETDEFAULT 0x0003 /* Get default (e.g. power up) value */
  865. #define MSG_GETFIRST 0x0004 /* Get first of a series of items, e.g. DSs */
  866. #define MSG_GETNEXT 0x0005 /* Iterate through a series of items. */
  867. #define MSG_SET 0x0006 /* Set one or more values */
  868. #define MSG_RESET 0x0007 /* Set current value to default value */
  869. #define MSG_QUERYSUPPORT 0x0008 /* Get supported operations on the cap. */
  870. /* Messages used with DAT_NULL */
  871. #define MSG_XFERREADY 0x0101 /* The data source has data ready */
  872. #define MSG_CLOSEDSREQ 0x0102 /* Request for App. to close DS */
  873. #define MSG_CLOSEDSOK 0x0103 /* Tell the App. to save the state. */
  874. /* Messages used with a pointer to a DAT_STATUS structure */
  875. #define MSG_CHECKSTATUS 0x0201 /* Get status information */
  876. /* Messages used with a pointer to DAT_PARENT data */
  877. #define MSG_OPENDSM 0x0301 /* Open the DSM */
  878. #define MSG_CLOSEDSM 0x0302 /* Close the DSM */
  879. /* Messages used with a pointer to a DAT_IDENTITY structure */
  880. #define MSG_OPENDS 0x0401 /* Open a data source */
  881. #define MSG_CLOSEDS 0x0402 /* Close a data source */
  882. #define MSG_USERSELECT 0x0403 /* Put up a dialog of all DS */
  883. /* Messages used with a pointer to a DAT_USERINTERFACE structure */
  884. #define MSG_DISABLEDS 0x0501 /* Disable data transfer in the DS */
  885. #define MSG_ENABLEDS 0x0502 /* Enable data transfer in the DS */
  886. #define MSG_ENABLEDSUIONLY 0x0503 /* Enable for saving DS state only. */
  887. /* Messages used with a pointer to a DAT_EVENT structure */
  888. #define MSG_PROCESSEVENT 0x0601
  889. /* Messages used with a pointer to a DAT_PENDINGXFERS structure */
  890. #define MSG_ENDXFER 0x0701
  891. /****************************************************************************
  892. * Capabilities *
  893. ****************************************************************************/
  894. #define CAP_CUSTOMBASE 0x8000 /* Base of custom capabilities */
  895. /* all data sources are REQUIRED to support these caps */
  896. #define CAP_XFERCOUNT 0x0001
  897. /* image data sources are REQUIRED to support these caps */
  898. #define ICAP_COMPRESSION 0x0100
  899. #define ICAP_PIXELTYPE 0x0101
  900. #define ICAP_UNITS 0x0102 /* default is TWUN_INCHES */
  901. #define ICAP_XFERMECH 0x0103
  902. /* all data sources MAY support these caps */
  903. #define CAP_AUTHOR 0x1000
  904. #define CAP_CAPTION 0x1001
  905. #define CAP_FEEDERENABLED 0x1002
  906. #define CAP_FEEDERLOADED 0x1003
  907. #define CAP_TIMEDATE 0x1004
  908. #define CAP_SUPPORTEDCAPS 0x1005
  909. #define CAP_EXTENDEDCAPS 0x1006
  910. #define CAP_AUTOFEED 0x1007
  911. #define CAP_CLEARPAGE 0x1008
  912. #define CAP_FEEDPAGE 0x1009
  913. #define CAP_REWINDPAGE 0x100a
  914. #define CAP_INDICATORS 0x100b /* Added 1.1 */
  915. #define CAP_SUPPORTEDCAPSEXT 0x100c /* Added 1.6 */
  916. #define CAP_PAPERDETECTABLE 0x100d /* Added 1.6 */
  917. #define CAP_UICONTROLLABLE 0x100e /* Added 1.6 */
  918. #define CAP_DEVICEONLINE 0x100f /* Added 1.6 */
  919. #define CAP_AUTOSCAN 0x1010 /* Added 1.6 */
  920. #define CAP_THUMBNAILSENABLED 0x1011 /* Added 1.7 */
  921. #define CAP_DUPLEX 0x1012 /* Added 1.7 */
  922. #define CAP_DUPLEXENABLED 0x1013 /* Added 1.7 */
  923. #define CAP_ENABLEDSUIONLY 0x1014 /* Added 1.7 */
  924. #define CAP_CUSTOMDSDATA 0x1015 /* Added 1.7 */
  925. #define CAP_ENDORSER 0x1016 /* Added 1.7 */
  926. #define CAP_JOBCONTROL 0x1017 /* Added 1.7 */
  927. /* image data sources MAY support these caps */
  928. #define ICAP_AUTOBRIGHT 0x1100
  929. #define ICAP_BRIGHTNESS 0x1101
  930. #define ICAP_CONTRAST 0x1103
  931. #define ICAP_CUSTHALFTONE 0x1104
  932. #define ICAP_EXPOSURETIME 0x1105
  933. #define ICAP_FILTER 0x1106
  934. #define ICAP_FLASHUSED 0x1107
  935. #define ICAP_GAMMA 0x1108
  936. #define ICAP_HALFTONES 0x1109
  937. #define ICAP_HIGHLIGHT 0x110a
  938. #define ICAP_IMAGEFILEFORMAT 0x110c
  939. #define ICAP_LAMPSTATE 0x110d
  940. #define ICAP_LIGHTSOURCE 0x110e
  941. #define ICAP_ORIENTATION 0x1110
  942. #define ICAP_PHYSICALWIDTH 0x1111
  943. #define ICAP_PHYSICALHEIGHT 0x1112
  944. #define ICAP_SHADOW 0x1113
  945. #define ICAP_FRAMES 0x1114
  946. #define ICAP_XNATIVERESOLUTION 0x1116
  947. #define ICAP_YNATIVERESOLUTION 0x1117
  948. #define ICAP_XRESOLUTION 0x1118
  949. #define ICAP_YRESOLUTION 0x1119
  950. #define ICAP_MAXFRAMES 0x111a
  951. #define ICAP_TILES 0x111b
  952. #define ICAP_BITORDER 0x111c
  953. #define ICAP_CCITTKFACTOR 0x111d
  954. #define ICAP_LIGHTPATH 0x111e
  955. #define ICAP_PIXELFLAVOR 0x111f
  956. #define ICAP_PLANARCHUNKY 0x1120
  957. #define ICAP_ROTATION 0x1121
  958. #define ICAP_SUPPORTEDSIZES 0x1122
  959. #define ICAP_THRESHOLD 0x1123
  960. #define ICAP_XSCALING 0x1124
  961. #define ICAP_YSCALING 0x1125
  962. #define ICAP_BITORDERCODES 0x1126
  963. #define ICAP_PIXELFLAVORCODES 0x1127
  964. #define ICAP_JPEGPIXELTYPE 0x1128
  965. #define ICAP_TIMEFILL 0x112a
  966. #define ICAP_BITDEPTH 0x112b
  967. #define ICAP_BITDEPTHREDUCTION 0x112c /* Added 1.5 */
  968. #define ICAP_UNDEFINEDIMAGESIZE 0X112d /* Added 1.6 */
  969. #define ICAP_IMAGEDATASET 0x112e /* Added 1.7 */
  970. #define ICAP_EXTIMAGEINFO 0x112f /* Added 1.7 */
  971. #define ICAP_MINIMUMHEIGHT 0x1130 /* Added 1.7 */
  972. #define ICAP_MINIMUMWIDTH 0x1131 /* Added 1.7 */
  973. /* ----------------------------------------------------------------------- *\
  974. Version 1.7: Following is Extended Image Info Attributes.
  975. July 1997
  976. KHL
  977. \* ----------------------------------------------------------------------- */
  978. #define TWEI_BARCODEX 0x1200
  979. #define TWEI_BARCODEY 0x1201
  980. #define TWEI_BARCODETEXT 0x1202
  981. #define TWEI_BARCODETYPE 0x1203
  982. #define TWEI_DESHADETOP 0x1204
  983. #define TWEI_DESHADELEFT 0x1205
  984. #define TWEI_DESHADEHEIGHT 0x1206
  985. #define TWEI_DESHADEWIDTH 0x1207
  986. #define TWEI_DESHADESIZE 0x1208
  987. #define TWEI_SPECKLESREMOVED 0x1209
  988. #define TWEI_HORZLINEXCOORD 0x120A
  989. #define TWEI_HORZLINEYCOORD 0x120B
  990. #define TWEI_HORZLINELENGTH 0x120C
  991. #define TWEI_HORZLINETHICKNESS 0x120D
  992. #define TWEI_VERTLINEXCOORD 0x120E
  993. #define TWEI_VERTLINEYCOORD 0x120F
  994. #define TWEI_VERTLINELENGTH 0x1210
  995. #define TWEI_VERTLINETHICKNESS 0x1211
  996. #define TWEI_PATCHCODE 0x1212
  997. #define TWEI_ENDORSEDTEXT 0x1213
  998. #define TWEI_FORMCONFIDENCE 0x1214
  999. #define TWEI_FORMTEMPLATEMATCH 0x1215
  1000. #define TWEI_FORMTEMPLATEPAGEMATCH 0x1216
  1001. #define TWEI_FORMHORZDOCOFFSET 0x1217
  1002. #define TWEI_FORMVERTDOCOFFSET 0x1218
  1003. #define TWEI_BARCODECOUNT 0x1219
  1004. #define TWEI_BARCODECONFIDENCE 0x121A
  1005. #define TWEI_BARCODEROTATION 0x121B
  1006. #define TWEI_BARCODETEXTLENGTH 0x121C
  1007. #define TWEI_DESHADECOUNT 0x121D
  1008. #define TWEI_DESHADEBLACKCOUNTOLD 0x121E
  1009. #define TWEI_DESHADEBLACKCOUNTNEW 0x121F
  1010. #define TWEI_DESHADEBLACKRLMIN 0x1220
  1011. #define TWEI_DESHADEBLACKRLMAX 0x1221
  1012. #define TWEI_DESHADEWHITECOUNTOLD 0x1222
  1013. #define TWEI_DESHADEWHITECOUNTNEW 0x1223
  1014. #define TWEI_DESHADEWHITERLMIN 0x1224
  1015. #define TWEI_DESHADEWHITERLAVE 0x1225
  1016. #define TWEI_DESHADEWHITERLMAX 0x1226
  1017. #define TWEI_BLACKSPECKLESREMOVED 0x1227
  1018. #define TWEI_WHITESPECKLESREMOVED 0x1228
  1019. #define TWEI_HORZLINECOUNT 0x1229
  1020. #define TWEI_VERTLINECOUNT 0x122A
  1021. #define TWEI_DESKEWSTATUS 0x122B
  1022. #define TWEI_SKEWORIGINALANGLE 0x122C
  1023. #define TWEI_SKEWFINALANGLE 0x122D
  1024. #define TWEI_SKEWCONFIDENCE 0x122E
  1025. #define TWEI_SKEWWINDOWX1 0x122F
  1026. #define TWEI_SKEWWINDOWY1 0x1230
  1027. #define TWEI_SKEWWINDOWX2 0x1231
  1028. #define TWEI_SKEWWINDOWY2 0x1232
  1029. #define TWEI_SKEWWINDOWX3 0x1233
  1030. #define TWEI_SKEWWINDOWY3 0x1234
  1031. #define TWEI_SKEWWINDOWX4 0x1235
  1032. #define TWEI_SKEWWINDOWY4 0x1236
  1033. #define TWEJ_NONE 0x0000
  1034. #define TWEJ_MIDSEPARATOR 0x0001
  1035. #define TWEJ_PATCH1 0x0002
  1036. #define TWEJ_PATCH2 0x0003
  1037. #define TWEJ_PATCH3 0x0004
  1038. #define TWEJ_PATCH4 0x0005
  1039. #define TWEJ_PATCH6 0x0006
  1040. #define TWEJ_PATCHT 0x0007
  1041. /***************************************************************************
  1042. * Return Codes and Condition Codes section *
  1043. ***************************************************************************/
  1044. /* Return Codes: DSM_Entry and DS_Entry may return any one of these values. */
  1045. #define TWRC_CUSTOMBASE 0x8000
  1046. #define TWRC_SUCCESS 0
  1047. #define TWRC_FAILURE 1 /* App may get TW_STATUS for info on failure */
  1048. #define TWRC_CHECKSTATUS 2 /* "tried hard"; get status */
  1049. #define TWRC_CANCEL 3
  1050. #define TWRC_DSEVENT 4
  1051. #define TWRC_NOTDSEVENT 5
  1052. #define TWRC_XFERDONE 6
  1053. #define TWRC_ENDOFLIST 7 /* After MSG_GETNEXT if nothing left */
  1054. #define TWRC_INFONOTSUPPORTED 8
  1055. #define TWRC_DATANOTAVAILABLE 9
  1056. /* Condition Codes: App gets these by doing DG_CONTROL DAT_STATUS MSG_GET. */
  1057. #define TWCC_CUSTOMBASE 0x8000
  1058. #define TWCC_SUCCESS 0 /* It worked! */
  1059. #define TWCC_BUMMER 1 /* Failure due to unknown causes */
  1060. #define TWCC_LOWMEMORY 2 /* Not enough memory to perform operation */
  1061. #define TWCC_NODS 3 /* No Data Source */
  1062. #define TWCC_MAXCONNECTIONS 4 /* DS is connected to max possible apps */
  1063. #define TWCC_OPERATIONERROR 5 /* DS or DSM reported error, app shouldn't */
  1064. #define TWCC_BADCAP 6 /* Unknown capability */
  1065. #define TWCC_BADPROTOCOL 9 /* Unrecognized MSG DG DAT combination */
  1066. #define TWCC_BADVALUE 10 /* Data parameter out of range */
  1067. #define TWCC_SEQERROR 11 /* DG DAT MSG out of expected sequence */
  1068. #define TWCC_BADDEST 12 /* Unknown destination App/Src in DSM_Entry */
  1069. #define TWCC_CAPUNSUPPORTED 13 /* Capability not supported by source */
  1070. #define TWCC_CAPBADOPERATION 14 /* Operation not supported by capability */
  1071. #define TWCC_CAPSEQERROR 15 /* Capability has dependancy on other capability */
  1072. /* bit patterns: for query the operation that are supported by the data source on a capability */
  1073. /* App gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */
  1074. /* Added 1.6 */
  1075. #define TWQC_GET 0x0001
  1076. #define TWQC_SET 0x0002
  1077. #define TWQC_GETDEFAULT 0x0004
  1078. #define TWQC_GETCURRENT 0x0008
  1079. #define TWQC_RESET 0x0010
  1080. /****************************************************************************
  1081. * Entry Points *
  1082. ****************************************************************************/
  1083. /**********************************************************************
  1084. * Function: DSM_Entry, the only entry point into the Data Source Manager.
  1085. *
  1086. * Parameters:
  1087. * pOrigin Identifies the source module of the message. This could
  1088. * identify an Application, a Source, or the Source Manager.
  1089. *
  1090. * pDest Identifies the destination module for the message.
  1091. * This could identify an application or a data source.
  1092. * If this is NULL, the message goes to the Source Manager.
  1093. *
  1094. * DG The Data Group.
  1095. * Example: DG_IMAGE.
  1096. *
  1097. * DAT The Data Attribute Type.
  1098. * Example: DAT_IMAGEMEMXFER.
  1099. *
  1100. * MSG The message. Messages are interpreted by the destination module
  1101. * with respect to the Data Group and the Data Attribute Type.
  1102. * Example: MSG_GET.
  1103. *
  1104. * pData A pointer to the data structure or variable identified
  1105. * by the Data Attribute Type.
  1106. * Example: (TW_MEMREF)&ImageMemXfer
  1107. * where ImageMemXfer is a TW_IMAGEMEMXFER structure.
  1108. *
  1109. * Returns:
  1110. * ReturnCode
  1111. * Example: TWRC_SUCCESS.
  1112. *
  1113. ********************************************************************/
  1114. /* Don't mangle the name "DSM_Entry" if we're compiling in C++! */
  1115. #ifdef __cplusplus
  1116. extern "C" {
  1117. #endif /* __cplusplus */
  1118. #ifdef _MSWIN_
  1119. #ifdef _WIN32
  1120. TW_UINT16 FAR PASCAL DSM_Entry( pTW_IDENTITY pOrigin,
  1121. pTW_IDENTITY pDest,
  1122. TW_UINT32 DG,
  1123. TW_UINT16 DAT,
  1124. TW_UINT16 MSG,
  1125. TW_MEMREF pData);
  1126. typedef TW_UINT16 (FAR PASCAL *DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY,
  1127. TW_UINT32, TW_UINT16,
  1128. TW_UINT16, TW_MEMREF);
  1129. #else
  1130. TW_UINT16 FAR PASCAL _export DSM_Entry( pTW_IDENTITY pOrigin,
  1131. pTW_IDENTITY pDest,
  1132. TW_UINT32 DG,
  1133. TW_UINT16 DAT,
  1134. TW_UINT16 MSG,
  1135. TW_MEMREF pData);
  1136. typedef TW_UINT16 (FAR PASCAL *DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY,
  1137. TW_UINT32, TW_UINT16,
  1138. TW_UINT16, TW_MEMREF);
  1139. #endif /* _WIN32 */
  1140. #else /* _MSWIN_ */
  1141. FAR PASCAL TW_UINT16 _export DSM_Entry( pTW_IDENTITY pOrigin,
  1142. pTW_IDENTITY pDest,
  1143. TW_UINT32 DG,
  1144. TW_UINT16 DAT,
  1145. TW_UINT16 MSG,
  1146. TW_MEMREF pData);
  1147. typedef TW_UINT16 (*DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY,
  1148. TW_UINT32, TW_UINT16,
  1149. TW_UINT16, TW_MEMREF);
  1150. #endif /* _MSWIN_ */
  1151. #ifdef __cplusplus
  1152. }
  1153. #endif /* cplusplus */
  1154. /**********************************************************************
  1155. * Function: DS_Entry, the entry point provided by a Data Source.
  1156. *
  1157. * Parameters:
  1158. * pOrigin Identifies the source module of the message. This could
  1159. * identify an application or the Data Source Manager.
  1160. *
  1161. * DG The Data Group.
  1162. * Example: DG_IMAGE.
  1163. *
  1164. * DAT The Data Attribute Type.
  1165. * Example: DAT_IMAGEMEMXFER.
  1166. *
  1167. * MSG The message. Messages are interpreted by the data source
  1168. * with respect to the Data Group and the Data Attribute Type.
  1169. * Example: MSG_GET.
  1170. *
  1171. * pData A pointer to the data structure or variable identified
  1172. * by the Data Attribute Type.
  1173. * Example: (TW_MEMREF)&ImageMemXfer
  1174. * where ImageMemXfer is a TW_IMAGEMEMXFER structure.
  1175. *
  1176. * Returns:
  1177. * ReturnCode
  1178. * Example: TWRC_SUCCESS.
  1179. *
  1180. * Note:
  1181. * The DSPROC type is only used by an application when it calls
  1182. * a Data Source directly, bypassing the Data Source Manager.
  1183. *
  1184. ********************************************************************/
  1185. /* Don't mangle the name "DS_Entry" if we're compiling in C++! */
  1186. #ifdef __cplusplus
  1187. extern "C" {
  1188. #endif /* __cplusplus */
  1189. #ifdef _MSWIN_
  1190. #ifdef _WIN32
  1191. #if defined(_TWAIN_NO_EXPORT_) && !defined(_X86_)
  1192. #define _TWAIN_DLL_EXPORT_
  1193. #else
  1194. #define _TWAIN_DLL_EXPORT_ __declspec(dllexport)
  1195. #endif
  1196. _TWAIN_DLL_EXPORT_ TW_UINT16 FAR PASCAL DS_Entry (pTW_IDENTITY pOrigin,
  1197. TW_UINT32 DG,
  1198. TW_UINT16 DAT,
  1199. TW_UINT16 MSG,
  1200. TW_MEMREF pData);
  1201. #else /* _WIN32 */
  1202. TW_UINT16 FAR PASCAL DS_Entry (pTW_IDENTITY pOrigin,
  1203. TW_UINT32 DG,
  1204. TW_UINT16 DAT,
  1205. TW_UINT16 MSG,
  1206. TW_MEMREF pData);
  1207. #endif /* _WIN32 */
  1208. typedef TW_UINT16 (FAR PASCAL *DSENTRYPROC) (pTW_IDENTITY pOrigin,
  1209. TW_UINT32 DG,
  1210. TW_UINT16 DAT,
  1211. TW_UINT16 MSG,
  1212. TW_MEMREF pData);
  1213. #else /* _MSWIN_ */
  1214. FAR PASCAL TW_UINT16 DS_Entry( pTW_IDENTITY pOrigin,
  1215. TW_UINT32 DG,
  1216. TW_UINT16 DAT,
  1217. TW_UINT16 MSG,
  1218. TW_MEMREF pData);
  1219. typedef TW_UINT16 (*DSENTRYPROC)(pTW_IDENTITY,
  1220. TW_UINT32, TW_UINT16,
  1221. TW_UINT16, TW_MEMREF);
  1222. #endif /* _MSWIN_ */
  1223. #ifdef __cplusplus
  1224. }
  1225. #endif /* cplusplus */
  1226. /* SDH - 02/08/95 - TWUNK */
  1227. /* Force 32-bit twain to use same packing of twain structures as existing */
  1228. /* 16-bit twain. This allows 16/32-bit thunking. */
  1229. #ifdef WIN32
  1230. #ifdef __BORLANDC__ //(Mentor June 13, 1996) if we're using a Borland compiler
  1231. #pragma option -a. //(Mentor October 30, 1996) switch back to original alignment
  1232. #else //(Mentor June 13, 1996) if we're NOT using a Borland compiler
  1233. #pragma pack (pop, before_twain)
  1234. #endif //(Mentor June 13, 1996)
  1235. #else /* WIN32 */
  1236. #endif /* WIN32 */
  1237. #endif /* TWAIN */
  1238.