home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d5 / SGSCAN.ZIP / TWAIN.H < prev   
C/C++ Source or Header  |  1998-07-12  |  48KB  |  1,223 lines

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