Structure Definitions
/****************************************************************************
* Structure Definitions *
****************************************************************************/
/* Fixed point structure type. */
typedef struct {
TW_INT16 Whole;
TW_UINT16 Frac;
} TW_FIX32, FAR *pTW_FIX32;
/* Defines a frame rectangle in ICAP_UNITS coordinates. */
typedef struct {
TW_FIX32 Left;
TW_FIX32 Top;
TW_FIX32 Right;
TW_FIX32 Bottom;
} TW_FRAME, FAR * pTW_FRAME;
/* Defines the parameters used for channel-specific transformation. */
typedef struct {
TW_FIX32 StartIn;
TW_FIX32 BreakIn;
TW_FIX32 EndIn;
TW_FIX32 StartOut;
TW_FIX32 BreakOut;
TW_FIX32 EndOut;
TW_FIX32 Gamma;
TW_FIX32 SampleCount;
} TW_DECODEFUNCTION, FAR * pTW_DECODEFUNCTION;
/* Stores a Fixed point number in two parts, a whole and a fractional part. */
typedef struct {
TW_DECODEFUNCTION Decode[3];
TW_FIX32 Mix[3][3];
} TW_TRANSFORMSTAGE, FAR * pTW_TRANSFORMSTAGE;
/* Container for array of values */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 NumItems;
TW_UINT8 ItemList[1];
} TW_ARRAY, FAR * pTW_ARRAY;
/* Information about audio data */
typedef struct {
TW_STR255 Name;
TW_UINT32 Reserved;
} TW_AUDIOINFO, FAR * pTW_AUDIOINFO;
/* Used to register callbacks. */
typedef struct {
TW_MEMREF CallBackProc;
TW_UINT32 RefCon;
TW_INT16 Message;
} TW_CALLBACK, FAR * pTW_CALLBACK;
/* Used to register callbacks. */
typedef struct {
TW_MEMREF CallBackProc;
TW_UINTPTR RefCon;
TW_INT16 Message;
} TW_CALLBACK2, FAR * pTW_CALLBACK2;
/* Used by application to get/set capability from/in a data source. */
typedef struct {
TW_UINT16 Cap;
TW_UINT16 ConType;
TW_HANDLE hContainer;
} TW_CAPABILITY, FAR * pTW_CAPABILITY;
/* Defines a CIE XYZ space tri-stimulus value. */
typedef struct {
TW_FIX32 X;
TW_FIX32 Y;
TW_FIX32 Z;
} TW_CIEPOINT, FAR * pTW_CIEPOINT;
/* Defines the mapping from an RGB color space device into CIE 1931 (XYZ) color space. */
typedef struct {
TW_UINT16 ColorSpace;
TW_INT16 LowEndian;
TW_INT16 DeviceDependent;
TW_INT32 VersionNumber;
TW_TRANSFORMSTAGE StageABC;
TW_TRANSFORMSTAGE StageLMN;
TW_CIEPOINT WhitePoint;
TW_CIEPOINT BlackPoint;
TW_CIEPOINT WhitePaper;
TW_CIEPOINT BlackInk;
TW_FIX32 Samples[1];
} TW_CIECOLOR, FAR * pTW_CIECOLOR;
/* Allows for a data source and application to pass custom data to each other. */
typedef struct {
TW_UINT32 InfoLength;
TW_HANDLE hData;
}TW_CUSTOMDSDATA, FAR *pTW_CUSTOMDSDATA;
/* Provides information about the Event that was raised by the Source */
typedef struct {
TW_UINT32 Event;
TW_STR255 DeviceName;
TW_UINT32 BatteryMinutes;
TW_INT16 BatteryPercentage;
TW_INT32 PowerSupply;
TW_FIX32 XResolution;
TW_FIX32 YResolution;
TW_UINT32 FlashUsed2;
TW_UINT32 AutomaticCapture;
TW_UINT32 TimeBeforeFirstCapture;
TW_UINT32 TimeBetweenCaptures;
} TW_DEVICEEVENT, FAR * pTW_DEVICEEVENT;
/* This structure holds the tri-stimulus color palette information for TW_PALETTE8 structures.*/
typedef struct {
TW_UINT8 Index;
TW_UINT8 Channel1;
TW_UINT8 Channel2;
TW_UINT8 Channel3;
} TW_ELEMENT8, FAR * pTW_ELEMENT8;
/* Stores a group of individual values describing a capability. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 NumItems;
TW_UINT32 CurrentIndex;
TW_UINT32 DefaultIndex;
TW_UINT8 ItemList[1];
} TW_ENUMERATION, FAR * pTW_ENUMERATION;
/* Used to pass application events/messages from the application to the Source. */
typedef struct {
TW_MEMREF pEvent;
TW_UINT16 TWMessage;
} TW_EVENT, FAR * pTW_EVENT;
/* This structure is used to pass specific information between the data source and the application. */
typedef struct {
TW_UINT16 InfoID;
TW_UINT16 ItemType;
TW_UINT16 NumItems;
TW_UINT16 ReturnCode;
TW_UINTPTR Item;
}TW_INFO, FAR* pTW_INFO;
typedef struct {
TW_UINT32 NumInfos;
TW_INFO Info[1];
}TW_EXTIMAGEINFO, FAR* pTW_EXTIMAGEINFO;
/* Provides information about the currently selected device */
typedef struct {
TW_STR255 InputName;
TW_STR255 OutputName;
TW_MEMREF Context;
union {
int Recursive;
TW_BOOL Subdirectories;
};
union {
TW_INT32 FileType;
TW_UINT32 FileSystemType;
};
TW_UINT32 Size;
TW_STR32 CreateTimeDate;
TW_STR32 ModifiedTimeDate;
TW_UINT32 FreeSpace;
TW_INT32 NewImageSize;
TW_UINT32 NumberOfFiles;
TW_UINT32 NumberOfSnippets;
TW_UINT32 DeviceGroupMask;
TW_INT8 Reserved[508];
} TW_FILESYSTEM, FAR * pTW_FILESYSTEM;
/* This structure is used by the application to specify a set of mapping values to be applied to grayscale data. */
typedef struct {
TW_ELEMENT8 Response[1];
} TW_GRAYRESPONSE, FAR * pTW_GRAYRESPONSE;
/* A general way to describe the version of software that is running. */
typedef struct {
TW_UINT16 MajorNum;
TW_UINT16 MinorNum;
TW_UINT16 Language;
TW_UINT16 Country;
TW_STR32 Info;
} TW_VERSION, FAR * pTW_VERSION;
/* Provides identification information about a TWAIN entity.*/
typedef struct {
TW_UINT32 Id;
TW_VERSION Version;
TW_UINT16 ProtocolMajor;
TW_UINT16 ProtocolMinor;
TW_UINT32 SupportedGroups;
TW_STR32 Manufacturer;
TW_STR32 ProductFamily;
TW_STR32 ProductName;
} TW_IDENTITY, FAR * pTW_IDENTITY;
/* Describes the 搑eal?image data, that is, the complete image being transferred between the Source and application. */
typedef struct {
TW_FIX32 XResolution;
TW_FIX32 YResolution;
TW_INT32 ImageWidth;
TW_INT32 ImageLength;
TW_INT16 SamplesPerPixel;
TW_INT16 BitsPerSample[8];
TW_INT16 BitsPerPixel;
TW_BOOL Planar;
TW_INT16 PixelType;
TW_UINT16 Compression;
} TW_IMAGEINFO, FAR * pTW_IMAGEINFO;
/* Involves information about the original size of the acquired image. */
typedef struct {
TW_FRAME Frame;
TW_UINT32 DocumentNumber;
TW_UINT32 PageNumber;
TW_UINT32 FrameNumber;
} TW_IMAGELAYOUT, FAR * pTW_IMAGELAYOUT;
/* Provides information for managing memory buffers. */
typedef struct {
TW_UINT32 Flags;
TW_UINT32 Length;
TW_MEMREF TheMem;
} TW_MEMORY, FAR * pTW_MEMORY;
/* Describes the form of the acquired data being passed from the Source to the application.*/
typedef struct {
TW_UINT16 Compression;
TW_UINT32 BytesPerRow;
TW_UINT32 Columns;
TW_UINT32 Rows;
TW_UINT32 XOffset;
TW_UINT32 YOffset;
TW_UINT32 BytesWritten;
TW_MEMORY Memory;
} TW_IMAGEMEMXFER, FAR * pTW_IMAGEMEMXFER;
/* Describes the information necessary to transfer a JPEG-compressed image. */
typedef struct {
TW_UINT16 ColorSpace;
TW_UINT32 SubSampling;
TW_UINT16 NumComponents;
TW_UINT16 RestartFrequency;
TW_UINT16 QuantMap[4];
TW_MEMORY QuantTable[4];
TW_UINT16 HuffmanMap[4];
TW_MEMORY HuffmanDC[2];
TW_MEMORY HuffmanAC[2];
} TW_JPEGCOMPRESSION, FAR * pTW_JPEGCOMPRESSION;
/* Stores a single value (item) which describes a capability. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 Item;
} TW_ONEVALUE, FAR * pTW_ONEVALUE;
/* This structure holds the color palette information. */
typedef struct {
TW_UINT16 NumColors;
TW_UINT16 PaletteType;
TW_ELEMENT8 Colors[256];
} TW_PALETTE8, FAR * pTW_PALETTE8;
/* Used to bypass the TWAIN protocol when communicating with a device */
typedef struct {
TW_MEMREF pCommand;
TW_UINT32 CommandBytes;
TW_INT32 Direction;
TW_MEMREF pData;
TW_UINT32 DataBytes;
TW_UINT32 DataBytesXfered;
} TW_PASSTHRU, FAR * pTW_PASSTHRU;
/* This structure tells the application how many more complete transfers the Source currently has available. */
typedef struct {
TW_UINT16 Count;
union {
TW_UINT32 EOJ;
TW_UINT32 Reserved;
};
} TW_PENDINGXFERS, FAR *pTW_PENDINGXFERS;
/* Stores a range of individual values describing a capability. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 MinValue;
TW_UINT32 MaxValue;
TW_UINT32 StepSize;
TW_UINT32 DefaultValue;
TW_UINT32 CurrentValue;
} TW_RANGE, FAR * pTW_RANGE;
/* This structure is used by the application to specify a set of mapping values to be applied to RGB color data. */
typedef struct {
TW_ELEMENT8 Response[1];
} TW_RGBRESPONSE, FAR * pTW_RGBRESPONSE;
/* Describes the file format and file specification information for a transfer through a disk file. */
typedef struct {
TW_STR255 FileName;
TW_UINT16 Format;
TW_INT16 VRefNum;
} TW_SETUPFILEXFER, FAR * pTW_SETUPFILEXFER;
/* Provides the application information about the Source抯 requirements and preferences regarding allocation of transfer buffer(s). */
typedef struct {
TW_UINT32 MinBufSize;
TW_UINT32 MaxBufSize;
TW_UINT32 Preferred;
} TW_SETUPMEMXFER, FAR * pTW_SETUPMEMXFER;
/* Describes the status of a source. */
typedef struct {
TW_UINT16 ConditionCode;
union {
TW_UINT16 Data;
TW_UINT16 Reserved;
};
} TW_STATUS, FAR * pTW_STATUS;
/* Translates the contents of Status into a localized UTF8string. */
typedef struct {
TW_STATUS Status;
TW_UINT32 Size;
TW_HANDLE UTF8string;
} TW_STATUSUTF8, FAR * pTW_STATUSUTF8;
/* This structure is used to handle the user interface coordination between an application and a Source. */
typedef struct {
TW_BOOL ShowUI;
TW_BOOL ModalUI;
TW_HANDLE hParent;
} TW_USERINTERFACE, FAR * pTW_USERINTERFACE;
* Structure Definitions *
****************************************************************************/
/* Fixed point structure type. */
typedef struct {
TW_INT16 Whole;
TW_UINT16 Frac;
} TW_FIX32, FAR *pTW_FIX32;
/* Defines a frame rectangle in ICAP_UNITS coordinates. */
typedef struct {
TW_FIX32 Left;
TW_FIX32 Top;
TW_FIX32 Right;
TW_FIX32 Bottom;
} TW_FRAME, FAR * pTW_FRAME;
/* Defines the parameters used for channel-specific transformation. */
typedef struct {
TW_FIX32 StartIn;
TW_FIX32 BreakIn;
TW_FIX32 EndIn;
TW_FIX32 StartOut;
TW_FIX32 BreakOut;
TW_FIX32 EndOut;
TW_FIX32 Gamma;
TW_FIX32 SampleCount;
} TW_DECODEFUNCTION, FAR * pTW_DECODEFUNCTION;
/* Stores a Fixed point number in two parts, a whole and a fractional part. */
typedef struct {
TW_DECODEFUNCTION Decode[3];
TW_FIX32 Mix[3][3];
} TW_TRANSFORMSTAGE, FAR * pTW_TRANSFORMSTAGE;
/* Container for array of values */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 NumItems;
TW_UINT8 ItemList[1];
} TW_ARRAY, FAR * pTW_ARRAY;
/* Information about audio data */
typedef struct {
TW_STR255 Name;
TW_UINT32 Reserved;
} TW_AUDIOINFO, FAR * pTW_AUDIOINFO;
/* Used to register callbacks. */
typedef struct {
TW_MEMREF CallBackProc;
TW_UINT32 RefCon;
TW_INT16 Message;
} TW_CALLBACK, FAR * pTW_CALLBACK;
/* Used to register callbacks. */
typedef struct {
TW_MEMREF CallBackProc;
TW_UINTPTR RefCon;
TW_INT16 Message;
} TW_CALLBACK2, FAR * pTW_CALLBACK2;
/* Used by application to get/set capability from/in a data source. */
typedef struct {
TW_UINT16 Cap;
TW_UINT16 ConType;
TW_HANDLE hContainer;
} TW_CAPABILITY, FAR * pTW_CAPABILITY;
/* Defines a CIE XYZ space tri-stimulus value. */
typedef struct {
TW_FIX32 X;
TW_FIX32 Y;
TW_FIX32 Z;
} TW_CIEPOINT, FAR * pTW_CIEPOINT;
/* Defines the mapping from an RGB color space device into CIE 1931 (XYZ) color space. */
typedef struct {
TW_UINT16 ColorSpace;
TW_INT16 LowEndian;
TW_INT16 DeviceDependent;
TW_INT32 VersionNumber;
TW_TRANSFORMSTAGE StageABC;
TW_TRANSFORMSTAGE StageLMN;
TW_CIEPOINT WhitePoint;
TW_CIEPOINT BlackPoint;
TW_CIEPOINT WhitePaper;
TW_CIEPOINT BlackInk;
TW_FIX32 Samples[1];
} TW_CIECOLOR, FAR * pTW_CIECOLOR;
/* Allows for a data source and application to pass custom data to each other. */
typedef struct {
TW_UINT32 InfoLength;
TW_HANDLE hData;
}TW_CUSTOMDSDATA, FAR *pTW_CUSTOMDSDATA;
/* Provides information about the Event that was raised by the Source */
typedef struct {
TW_UINT32 Event;
TW_STR255 DeviceName;
TW_UINT32 BatteryMinutes;
TW_INT16 BatteryPercentage;
TW_INT32 PowerSupply;
TW_FIX32 XResolution;
TW_FIX32 YResolution;
TW_UINT32 FlashUsed2;
TW_UINT32 AutomaticCapture;
TW_UINT32 TimeBeforeFirstCapture;
TW_UINT32 TimeBetweenCaptures;
} TW_DEVICEEVENT, FAR * pTW_DEVICEEVENT;
/* This structure holds the tri-stimulus color palette information for TW_PALETTE8 structures.*/
typedef struct {
TW_UINT8 Index;
TW_UINT8 Channel1;
TW_UINT8 Channel2;
TW_UINT8 Channel3;
} TW_ELEMENT8, FAR * pTW_ELEMENT8;
/* Stores a group of individual values describing a capability. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 NumItems;
TW_UINT32 CurrentIndex;
TW_UINT32 DefaultIndex;
TW_UINT8 ItemList[1];
} TW_ENUMERATION, FAR * pTW_ENUMERATION;
/* Used to pass application events/messages from the application to the Source. */
typedef struct {
TW_MEMREF pEvent;
TW_UINT16 TWMessage;
} TW_EVENT, FAR * pTW_EVENT;
/* This structure is used to pass specific information between the data source and the application. */
typedef struct {
TW_UINT16 InfoID;
TW_UINT16 ItemType;
TW_UINT16 NumItems;
TW_UINT16 ReturnCode;
TW_UINTPTR Item;
}TW_INFO, FAR* pTW_INFO;
typedef struct {
TW_UINT32 NumInfos;
TW_INFO Info[1];
}TW_EXTIMAGEINFO, FAR* pTW_EXTIMAGEINFO;
/* Provides information about the currently selected device */
typedef struct {
TW_STR255 InputName;
TW_STR255 OutputName;
TW_MEMREF Context;
union {
int Recursive;
TW_BOOL Subdirectories;
};
union {
TW_INT32 FileType;
TW_UINT32 FileSystemType;
};
TW_UINT32 Size;
TW_STR32 CreateTimeDate;
TW_STR32 ModifiedTimeDate;
TW_UINT32 FreeSpace;
TW_INT32 NewImageSize;
TW_UINT32 NumberOfFiles;
TW_UINT32 NumberOfSnippets;
TW_UINT32 DeviceGroupMask;
TW_INT8 Reserved[508];
} TW_FILESYSTEM, FAR * pTW_FILESYSTEM;
/* This structure is used by the application to specify a set of mapping values to be applied to grayscale data. */
typedef struct {
TW_ELEMENT8 Response[1];
} TW_GRAYRESPONSE, FAR * pTW_GRAYRESPONSE;
/* A general way to describe the version of software that is running. */
typedef struct {
TW_UINT16 MajorNum;
TW_UINT16 MinorNum;
TW_UINT16 Language;
TW_UINT16 Country;
TW_STR32 Info;
} TW_VERSION, FAR * pTW_VERSION;
/* Provides identification information about a TWAIN entity.*/
typedef struct {
TW_UINT32 Id;
TW_VERSION Version;
TW_UINT16 ProtocolMajor;
TW_UINT16 ProtocolMinor;
TW_UINT32 SupportedGroups;
TW_STR32 Manufacturer;
TW_STR32 ProductFamily;
TW_STR32 ProductName;
} TW_IDENTITY, FAR * pTW_IDENTITY;
/* Describes the 搑eal?image data, that is, the complete image being transferred between the Source and application. */
typedef struct {
TW_FIX32 XResolution;
TW_FIX32 YResolution;
TW_INT32 ImageWidth;
TW_INT32 ImageLength;
TW_INT16 SamplesPerPixel;
TW_INT16 BitsPerSample[8];
TW_INT16 BitsPerPixel;
TW_BOOL Planar;
TW_INT16 PixelType;
TW_UINT16 Compression;
} TW_IMAGEINFO, FAR * pTW_IMAGEINFO;
/* Involves information about the original size of the acquired image. */
typedef struct {
TW_FRAME Frame;
TW_UINT32 DocumentNumber;
TW_UINT32 PageNumber;
TW_UINT32 FrameNumber;
} TW_IMAGELAYOUT, FAR * pTW_IMAGELAYOUT;
/* Provides information for managing memory buffers. */
typedef struct {
TW_UINT32 Flags;
TW_UINT32 Length;
TW_MEMREF TheMem;
} TW_MEMORY, FAR * pTW_MEMORY;
/* Describes the form of the acquired data being passed from the Source to the application.*/
typedef struct {
TW_UINT16 Compression;
TW_UINT32 BytesPerRow;
TW_UINT32 Columns;
TW_UINT32 Rows;
TW_UINT32 XOffset;
TW_UINT32 YOffset;
TW_UINT32 BytesWritten;
TW_MEMORY Memory;
} TW_IMAGEMEMXFER, FAR * pTW_IMAGEMEMXFER;
/* Describes the information necessary to transfer a JPEG-compressed image. */
typedef struct {
TW_UINT16 ColorSpace;
TW_UINT32 SubSampling;
TW_UINT16 NumComponents;
TW_UINT16 RestartFrequency;
TW_UINT16 QuantMap[4];
TW_MEMORY QuantTable[4];
TW_UINT16 HuffmanMap[4];
TW_MEMORY HuffmanDC[2];
TW_MEMORY HuffmanAC[2];
} TW_JPEGCOMPRESSION, FAR * pTW_JPEGCOMPRESSION;
/* Stores a single value (item) which describes a capability. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 Item;
} TW_ONEVALUE, FAR * pTW_ONEVALUE;
/* This structure holds the color palette information. */
typedef struct {
TW_UINT16 NumColors;
TW_UINT16 PaletteType;
TW_ELEMENT8 Colors[256];
} TW_PALETTE8, FAR * pTW_PALETTE8;
/* Used to bypass the TWAIN protocol when communicating with a device */
typedef struct {
TW_MEMREF pCommand;
TW_UINT32 CommandBytes;
TW_INT32 Direction;
TW_MEMREF pData;
TW_UINT32 DataBytes;
TW_UINT32 DataBytesXfered;
} TW_PASSTHRU, FAR * pTW_PASSTHRU;
/* This structure tells the application how many more complete transfers the Source currently has available. */
typedef struct {
TW_UINT16 Count;
union {
TW_UINT32 EOJ;
TW_UINT32 Reserved;
};
} TW_PENDINGXFERS, FAR *pTW_PENDINGXFERS;
/* Stores a range of individual values describing a capability. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 MinValue;
TW_UINT32 MaxValue;
TW_UINT32 StepSize;
TW_UINT32 DefaultValue;
TW_UINT32 CurrentValue;
} TW_RANGE, FAR * pTW_RANGE;
/* This structure is used by the application to specify a set of mapping values to be applied to RGB color data. */
typedef struct {
TW_ELEMENT8 Response[1];
} TW_RGBRESPONSE, FAR * pTW_RGBRESPONSE;
/* Describes the file format and file specification information for a transfer through a disk file. */
typedef struct {
TW_STR255 FileName;
TW_UINT16 Format;
TW_INT16 VRefNum;
} TW_SETUPFILEXFER, FAR * pTW_SETUPFILEXFER;
/* Provides the application information about the Source抯 requirements and preferences regarding allocation of transfer buffer(s). */
typedef struct {
TW_UINT32 MinBufSize;
TW_UINT32 MaxBufSize;
TW_UINT32 Preferred;
} TW_SETUPMEMXFER, FAR * pTW_SETUPMEMXFER;
/* Describes the status of a source. */
typedef struct {
TW_UINT16 ConditionCode;
union {
TW_UINT16 Data;
TW_UINT16 Reserved;
};
} TW_STATUS, FAR * pTW_STATUS;
/* Translates the contents of Status into a localized UTF8string. */
typedef struct {
TW_STATUS Status;
TW_UINT32 Size;
TW_HANDLE UTF8string;
} TW_STATUSUTF8, FAR * pTW_STATUSUTF8;
/* This structure is used to handle the user interface coordination between an application and a Source. */
typedef struct {
TW_BOOL ShowUI;
TW_BOOL ModalUI;
TW_HANDLE hParent;
} TW_USERINTERFACE, FAR * pTW_USERINTERFACE;