Updated struct mapping for TWAIN 2.3

This commit is contained in:
soukoku
2014-04-02 21:39:33 -04:00
parent 6f4e70ae7b
commit 2565ac21e1
7 changed files with 1086 additions and 1057 deletions

View File

@@ -1,26 +1,39 @@
// This file contains all the structs defined in the twain.h file. // This file contains all the structs defined in the twain.h file.
// The TWAIN numeric types are mapped with "using"
// to aid in mapping against the twin.h file (copy/paste!).
// It also makes it easy to change all the types that
// uses it if I made a mistake in the mapped value type.
// Consumers will not see those names.
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using TW_BOOL = System.UInt16;
// use HandleRef instead?
using TW_HANDLE = System.IntPtr;
using TW_INT16 = System.Int16;
using TW_INT32 = System.Int32;
using TW_MEMREF = System.IntPtr;
using TW_UINT16 = System.UInt16;
using TW_UINT32 = System.UInt32;
using TW_UINT8 = System.Byte;
// iffy
using TW_UINTPTR = System.UIntPtr;
using NTwain.Values; using NTwain.Values;
// The following TWAIN basic types are mapped with "using"
// to aid in mapping against the twain.h file using copy-paste.
// Consumers will not see those names.
#if WIN32
// use HandleRef instead?
using TW_HANDLE = System.IntPtr; // HANDLE
using TW_MEMREF = System.IntPtr; // LPVOID
// iffy
using TW_UINTPTR = System.UIntPtr; // UINT_PTR
using TW_INT8 = System.SByte; // char
using TW_INT16 = System.Int16; // short
using TW_INT32 = System.Int32; // long
using TW_UINT8 = System.Byte; // unsigned char
using TW_UINT16 = System.UInt16; // unsigned short
using TW_UINT32 = System.UInt32; // unsigned long
using TW_BOOL = System.UInt16; // unsigned short
#elif GNUC
#elif APPLE
#endif
// This mono doc is awesome. An interop must-read // This mono doc is awesome. An interop must-read
// http://www.mono-project.com/Interop_with_Native_Libraries // http://www.mono-project.com/Interop_with_Native_Libraries
@@ -36,473 +49,496 @@ using NTwain.Values;
namespace NTwain.Data namespace NTwain.Data
{ {
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial struct TWFix32 partial struct TWFix32
{ {
/// <summary> TW_INT16 _whole;
/// The Whole part of the floating point number. This number is signed. TW_UINT16 _frac;
/// </summary> }
TW_INT16 _whole;
/// <summary>
/// The Fractional part of the floating point number. This number is unsigned.
/// </summary>
TW_UINT16 _frac;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial struct TWFrame partial struct TWFrame
{ {
TWFix32 _left; TWFix32 _left;
TWFix32 _top; TWFix32 _top;
TWFix32 _right; TWFix32 _right;
TWFix32 _bottom; TWFix32 _bottom;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial struct TWDecodeFunction partial struct TWDecodeFunction
{ {
TWFix32 _startIn; TWFix32 _startIn;
TWFix32 _breakIn; TWFix32 _breakIn;
TWFix32 _endIn; TWFix32 _endIn;
TWFix32 _startOut; TWFix32 _startOut;
TWFix32 _breakOut; TWFix32 _breakOut;
TWFix32 _endOut; TWFix32 _endOut;
TWFix32 _gamma; TWFix32 _gamma;
TWFix32 _sampleCount; TWFix32 _sampleCount;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial struct TWTransformStage partial struct TWTransformStage
{ {
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
TWDecodeFunction[] _decode; TWDecodeFunction[] _decode;
// TODO: research jagged aray mapping. maybe use ptr? // TODO: research jagged aray mapping (3x3).
[MarshalAs(UnmanagedType.ByValArray)] // maybe can only have 1-D
TWFix32[][] _mix; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
} TWFix32[][] _mix;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWArray partial class TWArray
{ {
TW_UINT16 _itemType; TW_UINT16 _itemType;
TW_UINT32 _numItems; TW_UINT32 _numItems;
object[] _itemList; object[] _itemList;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2), [StructLayout(LayoutKind.Sequential, Pack = 2),
BestFitMapping(false, ThrowOnUnmappableChar = true)] BestFitMapping(false, ThrowOnUnmappableChar = true)]
public partial class TWAudioInfo partial class TWAudioInfo
{ {
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)] // TODO: this may be wrong
string _name; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]
TW_UINT32 _reserved; string _name;
} TW_UINT32 _reserved;
}
delegate ReturnCode CallbackDelegate(TWIdentity origin, TWIdentity destination,
DataGroups dg, DataArgumentType dat, Message msg, TW_MEMREF data);
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWCallback partial class TWCallback
{ {
[MarshalAs(UnmanagedType.FunctionPtr)] [MarshalAs(UnmanagedType.FunctionPtr)]
CallbackDelegate _callBackProc; CallbackDelegate _callBackProc;
TW_UINT32 _refCon; TW_UINT32 _refCon;
TW_INT16 _message; TW_INT16 _message;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWCallback2 partial class TWCallback2
{ {
[MarshalAs(UnmanagedType.FunctionPtr)] [MarshalAs(UnmanagedType.FunctionPtr)]
CallbackDelegate _callBackProc; CallbackDelegate _callBackProc;
TW_UINTPTR _refCon; TW_UINTPTR _refCon;
TW_INT16 _message; TW_INT16 _message;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWCapability partial class TWCapability
{ {
TW_UINT16 _cap; TW_UINT16 _cap;
TW_UINT16 _conType; TW_UINT16 _conType;
IntPtr _hContainer; TW_HANDLE _hContainer;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial struct TWCiePoint partial struct TWCiePoint
{ {
TWFix32 _x; TWFix32 _x;
TWFix32 _y; TWFix32 _y;
TWFix32 _z; TWFix32 _z;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWCieColor partial class TWCieColor
{ {
TW_UINT16 _colorSpace; TW_UINT16 _colorSpace;
TW_INT16 _lowEndian; TW_INT16 _lowEndian;
TW_INT16 _deviceDependent; TW_INT16 _deviceDependent;
TW_INT32 _versionNumber; TW_INT32 _versionNumber;
TWTransformStage _stageABC; TWTransformStage _stageABC;
TWTransformStage _stageLMN; TWTransformStage _stageLMN;
TWCiePoint _whitePoint; TWCiePoint _whitePoint;
TWCiePoint _blackPoint; TWCiePoint _blackPoint;
TWCiePoint _whitePaper; TWCiePoint _whitePaper;
TWCiePoint _whiteInk; TWCiePoint _blackInk;
TWFix32[] _samples; // TODO: may be totally wrong
} [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
TWFix32[] _samples;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWCustomDSData partial class TWCustomDSData
{ {
TW_UINT32 _infoLength; TW_UINT32 _infoLength;
TW_HANDLE _hData; TW_HANDLE _hData;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2), [StructLayout(LayoutKind.Sequential, Pack = 2),
BestFitMapping(false, ThrowOnUnmappableChar = true)] BestFitMapping(false, ThrowOnUnmappableChar = true)]
public partial class TWDeviceEvent partial class TWDeviceEvent
{ {
TW_UINT32 _event; TW_UINT32 _event;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)] // TODO: may be wrong
string _deviceName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]
TW_UINT32 _batteryMinutes; string _deviceName;
TW_INT16 _batteryPercentage; TW_UINT32 _batteryMinutes;
TW_INT32 _powerSupply; TW_INT16 _batteryPercentage;
TWFix32 _xResolution; TW_INT32 _powerSupply;
TWFix32 _yResolution; TWFix32 _xResolution;
TW_UINT32 _flashUsed2; TWFix32 _yResolution;
TW_UINT32 _automaticCapture; TW_UINT32 _flashUsed2;
TW_UINT32 _timeBeforeFirstCapture; TW_UINT32 _automaticCapture;
TW_UINT32 _timeBetweenCaptures; TW_UINT32 _timeBeforeFirstCapture;
} TW_UINT32 _timeBetweenCaptures;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWEntryPoint partial struct TWElement8
{ {
TW_UINT32 _size; TW_UINT8 _index;
// this is not a delegate cuz it's not used by the app TW_UINT8 _channel1;
IntPtr _dSM_Entry; TW_UINT8 _channel2;
TW_UINT8 _channel3;
}
[MarshalAs(UnmanagedType.FunctionPtr)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
MemAllocateDelegate _dSM_MemAllocate; partial class TWEnumeration
[MarshalAs(UnmanagedType.FunctionPtr)] {
MemFreeDelegate _dSM_MemFree; TW_UINT16 _itemType;
[MarshalAs(UnmanagedType.FunctionPtr)] TW_UINT32 _numItems;
MemLockDelegate _dSM_MemLock; TW_UINT32 _currentIndex;
[MarshalAs(UnmanagedType.FunctionPtr)] TW_UINT32 _defaultIndex;
MemUnlockDelegate _dSM_MemUnlock; object[] _itemList;
}
public delegate IntPtr MemAllocateDelegate(uint size); [StructLayout(LayoutKind.Sequential, Pack = 2)]
public delegate void MemFreeDelegate(IntPtr handle); partial class TWEvent
public delegate IntPtr MemLockDelegate(IntPtr handle); {
public delegate void MemUnlockDelegate(IntPtr handle); TW_MEMREF _pEvent;
} TW_UINT16 _tWMessage;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial struct TWElement8 partial struct TWInfo
{ {
TW_UINT8 _index; TW_UINT16 _infoID;
TW_UINT8 _channel1; TW_UINT16 _itemType;
TW_UINT8 _channel2; TW_UINT16 _numItems;
TW_UINT8 _channel3;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] TW_UINT16 _returnCode;
public partial class TWEnumeration
{
TW_UINT16 _itemType;
TW_UINT32 _numItems;
TW_UINT32 _currentIndex;
TW_UINT32 _defaultIndex;
object[] _itemList;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] TW_UINTPTR _item;
public partial class TWEvent }
{
TW_MEMREF _pEvent;
TW_UINT16 _tWMessage;
}
[StructLayout(LayoutKind.Explicit, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial struct TWInfo partial class TWExtImageInfo
{ {
[FieldOffset(0)] TW_UINT32 _numInfos;
TW_UINT16 _infoID; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 200)]
[FieldOffset(2)] TWInfo[] _info;
TW_UINT16 _itemType; }
[FieldOffset(4)]
TW_UINT16 _numItems;
[FieldOffset(6)] [StructLayout(LayoutKind.Explicit, Pack = 2),
TW_UINT16 _condCode; BestFitMapping(false, ThrowOnUnmappableChar = true)]
[FieldOffset(6)] partial class TWFileSystem
TW_UINT16 _returnCode; /* TWAIN 2.1 and newer */ {
// TODO: verify all field offset #s
[FieldOffset(8)] [FieldOffset(0)]
TW_UINTPTR Item; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]
} string _inputName;
[StructLayout(LayoutKind.Sequential, Pack = 2)] [FieldOffset(TwainConst.String255)]
public partial class TWExtImageInfo [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]
{ string _outputName;
TW_UINT32 _numInfos;
TWInfo[] _info;
}
[StructLayout(LayoutKind.Sequential, Pack = 2), [FieldOffset(512)]
BestFitMapping(false, ThrowOnUnmappableChar = true)] TW_MEMREF _context;
public partial class TWFileSystem
{
/* DG_CONTROL / DAT_FILESYSTEM / MSG_xxxx fields */
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]
string _inputName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]
string _outputName;
TW_MEMREF _context;
/* DG_CONTROL / DAT_FILESYSTEM / MSG_DELETE field */
//TODO: verify this field
short _recursive; /* recursively delete all sub-directories */
/* DG_CONTROL / DAT_FILESYSTEM / MSG_GETInfo fields */
TW_INT32 _fileType; /* One of the TWFY_xxxx values */
TW_UINT32 _size; /* Size of current FileType */
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _createTimeDate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _modifiedTimeDate;
TW_UINT32 _freeSpace;
TW_INT32 _newImageSize;
TW_UINT32 _numberOfFiles;
TW_UINT32 _numberOfSnippets;
TW_UINT32 _deviceGroupMask;
//TODO: verify this field, check if can just not use it
//char _reserved[508]; /**/
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 508)]
byte[] _reserved;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] //TODO: verify this field offset in 64bit
public partial class TWGrayResponse [FieldOffset(520)]
{ short _recursive;
TWElement8[] _response; [FieldOffset(520)]
} TW_BOOL _subdirectories;
[StructLayout(LayoutKind.Sequential, Pack = 2), [FieldOffset(524)]
BestFitMapping(false, ThrowOnUnmappableChar = true)] TW_INT32 _fileType;
public partial struct TWVersion [FieldOffset(524)]
{ TW_UINT32 _fileSystemType;
TW_UINT16 _majorNum;
TW_UINT16 _minorNum;
TW_UINT16 _language;
TW_UINT16 _country;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _info;
}
[StructLayout(LayoutKind.Sequential, Pack = 2), [FieldOffset(528)]
BestFitMapping(false, ThrowOnUnmappableChar = true)] TW_UINT32 _size;
public partial class TWIdentity
{
TW_UINT32 _id;
TWVersion _version;
TW_UINT16 _protocolMajor;
TW_UINT16 _protocolMinor;
TW_UINT32 _supportedGroups;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _manufacturer;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _productFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _productName;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [FieldOffset(532)]
public partial class TWImageInfo [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
{ string _createTimeDate;
TWFix32 _xResolution;
TWFix32 _yResolution;
TW_INT32 _imageWidth;
TW_INT32 _imageLength;
TW_INT16 _samplesPerPixel;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
TW_INT16[] _bitsPerSample;
TW_INT16 _bitsPerPixel;
TW_BOOL _planar;
TW_INT16 _pixelType;
TW_UINT16 _compression;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [FieldOffset(566)]
public partial class TWImageLayout [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
{ string _modifiedTimeDate;
TWFrame _frame;
TW_UINT32 _documentNumber;
TW_UINT32 _pageNumber;
TW_UINT32 _frameNumber;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [FieldOffset(600)]
public partial struct TWMemory TW_UINT32 _freeSpace;
{
// not a class due to embedded
TW_UINT32 _flags; [FieldOffset(604)]
TW_UINT32 _length; TW_INT32 _newImageSize;
TW_MEMREF _theMem;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [FieldOffset(608)]
public partial class TWImageMemXfer TW_UINT32 _numberOfFiles;
{
TW_UINT16 _compression;
TW_UINT32 _bytesPerRow;
TW_UINT32 _columns;
TW_UINT32 _rows;
TW_UINT32 _xOffset;
TW_UINT32 _yOffset;
TW_UINT32 _bytesWritten;
TWMemory _memory;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [FieldOffset(612)]
public partial class TWJpegCompression TW_UINT32 _numberOfSnippets;
{
TW_UINT16 _colorSpace;
TW_UINT32 _subSampling;
TW_UINT16 _numComponents;
TW_UINT16 _restartFrequency;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
TW_UINT16[] _quantMap;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
TWMemory[] _quantTable;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
TW_UINT16[] _huffmanMap;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
TWMemory[] _huffmanDC;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
TWMemory[] _huffmanAC;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [FieldOffset(616)]
public partial class TWOneValue TW_UINT32 _deviceGroupMask;
{
TW_UINT16 _itemType;
TW_UINT32 _item;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] //TODO: verify this field, check if can just not use it
public partial class TWPalette8 //char _reserved[508]; /**/
{ [FieldOffset(620)]
TW_UINT16 _numColors; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 508)]
TW_UINT16 _paletteType; TW_INT8[] _reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] }
TWElement8[] _colors;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWPassThru partial class TWGrayResponse
{ {
TW_MEMREF _pCommand; // TODO: may be totally wrong
TW_UINT32 _commandBytes; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
TW_INT32 _direction; TWElement8[] _response;
TW_MEMREF _pData; }
TW_UINT32 _dataBytes;
TW_UINT32 _dataBytesXfered; [StructLayout(LayoutKind.Sequential, Pack = 2),
} BestFitMapping(false, ThrowOnUnmappableChar = true)]
partial struct TWVersion
{
TW_UINT16 _majorNum;
TW_UINT16 _minorNum;
TW_UINT16 _language;
TW_UINT16 _country;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _info;
}
[StructLayout(LayoutKind.Sequential, Pack = 2),
BestFitMapping(false, ThrowOnUnmappableChar = true)]
partial class TWIdentity
{
TW_UINT32 _id;
TWVersion _version;
TW_UINT16 _protocolMajor;
TW_UINT16 _protocolMinor;
TW_UINT32 _supportedGroups;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _manufacturer;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _productFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String32)]
string _productName;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWImageInfo
{
TWFix32 _xResolution;
TWFix32 _yResolution;
TW_INT32 _imageWidth;
TW_INT32 _imageLength;
TW_INT16 _samplesPerPixel;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
TW_INT16[] _bitsPerSample;
TW_INT16 _bitsPerPixel;
TW_BOOL _planar;
TW_INT16 _pixelType;
TW_UINT16 _compression;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWImageLayout
{
TWFrame _frame;
TW_UINT32 _documentNumber;
TW_UINT32 _pageNumber;
TW_UINT32 _frameNumber;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial struct TWMemory
{
// not a class due to embedded
TW_UINT32 _flags;
TW_UINT32 _length;
TW_MEMREF _theMem;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWImageMemXfer
{
TW_UINT16 _compression;
TW_UINT32 _bytesPerRow;
TW_UINT32 _columns;
TW_UINT32 _rows;
TW_UINT32 _xOffset;
TW_UINT32 _yOffset;
TW_UINT32 _bytesWritten;
TWMemory _memory;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWJpegCompression
{
TW_UINT16 _colorSpace;
TW_UINT32 _subSampling;
TW_UINT16 _numComponents;
TW_UINT16 _restartFrequency;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
TW_UINT16[] _quantMap;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
TWMemory[] _quantTable;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
TW_UINT16[] _huffmanMap;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
TWMemory[] _huffmanDC;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
TWMemory[] _huffmanAC;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWOneValue
{
TW_UINT16 _itemType;
TW_UINT32 _item;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWPalette8
{
TW_UINT16 _numColors;
TW_UINT16 _paletteType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
TWElement8[] _colors;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWPassThru
{
TW_MEMREF _pCommand;
TW_UINT32 _commandBytes;
TW_INT32 _direction;
TW_MEMREF _pData;
TW_UINT32 _dataBytes;
TW_UINT32 _dataBytesXfered;
}
//[StructLayout(LayoutKind.Explicit, Pack = 2)] //[StructLayout(LayoutKind.Explicit, Pack = 2)]
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWPendingXfers partial class TWPendingXfers
{ {
//[FieldOffset(0)] //[FieldOffset(0)]
//TW_INT16 _count; //TW_INT16 _count;
TW_UINT16 _count; TW_UINT16 _count;
//[FieldOffset(2)] //[FieldOffset(2)]
TW_UINT32 _eOJ; TW_UINT32 _eOJ;
//[FieldOffset(2)] //[FieldOffset(2)]
//TW_UINT32 _reserved; //TW_UINT32 _reserved;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWRange partial class TWRange
{ {
TW_UINT16 _itemType; TW_UINT16 _itemType;
TW_UINT32 _minValue; TW_UINT32 _minValue;
TW_UINT32 _maxValue; TW_UINT32 _maxValue;
TW_UINT32 _stepSize; TW_UINT32 _stepSize;
TW_UINT32 _defaultValue; TW_UINT32 _defaultValue;
TW_UINT32 _currentValue; TW_UINT32 _currentValue;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWRgbResponse partial class TWRgbResponse
{ {
TWElement8[] _response; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
} TWElement8[] _response;
}
[StructLayout(LayoutKind.Sequential, Pack = 2), [StructLayout(LayoutKind.Sequential, Pack = 2),
BestFitMapping(false, ThrowOnUnmappableChar = true)] BestFitMapping(false, ThrowOnUnmappableChar = true)]
public partial class TWSetupFileXfer partial class TWSetupFileXfer
{ {
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TwainConst.String255)]
string _fileName; string _fileName;
TW_UINT16 _format; TW_UINT16 _format;
TW_INT16 _vRefNum = -1; TW_INT16 _vRefNum = -1;
} }
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWSetupMemXfer partial class TWSetupMemXfer
{ {
TW_UINT32 _minBufSize; TW_UINT32 _minBufSize;
TW_UINT32 _maxBufSize; TW_UINT32 _maxBufSize;
TW_UINT32 _preferred; TW_UINT32 _preferred;
} }
[StructLayout(LayoutKind.Explicit, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWStatus partial class TWStatus
{ {
[FieldOffset(0)] //[FieldOffset(0)]
TW_UINT16 _conditionCode; TW_UINT16 _conditionCode;
[FieldOffset(2)] //[FieldOffset(2)]
TW_UINT16 _data; TW_UINT16 _data;
[FieldOffset(2)] //[FieldOffset(2)]
TW_UINT16 _reserved; //TW_UINT16 _reserved;
} }
[StructLayout(LayoutKind.Explicit, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
public partial class TWStatusUtf8 partial class TWStatusUtf8
{ {
// rather than embedding the twstatus directly use its fields instead // NOTE: rather than embedding the twstatus directly use its fields instead
// so the twstatus could become an object. If twstatus changes // so the twstatus could become a class object. If twstatus changes
// definition remember to change it here // definition remember to change it here
TW_UINT16 _conditionCode;
TW_UINT16 _data;
///// <summary> TW_UINT32 _size;
///// <see cref="TWStatus"/> data received from a previous call.
///// </summary>
//TWStatus Status;
[FieldOffset(0)]
TW_UINT16 _statusConditionCode;
[FieldOffset(2)]
TW_UINT16 _statusData;
[FieldOffset(2)]
TW_UINT16 _status_reserved;
[FieldOffset(4)] TW_HANDLE _uTF8string;
TW_UINT32 _size; }
[FieldOffset(8)]
TW_HANDLE _uTF8string;
}
[StructLayout(LayoutKind.Sequential, Pack = 2)] [StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWUserInterface partial class TWUserInterface
{ {
TW_BOOL _showUI; TW_BOOL _showUI;
TW_BOOL _modalUI; TW_BOOL _modalUI;
TW_HANDLE _hParent; TW_HANDLE _hParent;
//HandleRef _hParent; //HandleRef _hParent;
} }
delegate ReturnCode CallbackDelegate(TWIdentity origin, TWIdentity destination,
DataGroups dg, DataArgumentType dat, Message msg, TW_MEMREF data);
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWEntryPoint
{
TW_UINT32 _size;
// this is not a delegate cuz it's not used by the app
IntPtr _dSM_Entry;
[MarshalAs(UnmanagedType.FunctionPtr)]
MemAllocateDelegate _dSM_MemAllocate;
[MarshalAs(UnmanagedType.FunctionPtr)]
MemFreeDelegate _dSM_MemFree;
[MarshalAs(UnmanagedType.FunctionPtr)]
MemLockDelegate _dSM_MemLock;
[MarshalAs(UnmanagedType.FunctionPtr)]
MemUnlockDelegate _dSM_MemUnlock;
public delegate IntPtr MemAllocateDelegate(uint size);
public delegate void MemFreeDelegate(IntPtr handle);
public delegate IntPtr MemLockDelegate(IntPtr handle);
public delegate void MemUnlockDelegate(IntPtr handle);
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>TRACE;DEBUG;WIN32</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<RunCodeAnalysis>false</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>

View File

@@ -11,7 +11,7 @@
<!--<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>--> <!--<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>-->
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description> <description>$description$</description>
<releaseNotes></releaseNotes> <releaseNotes>This release is updated for TWAIN 2.3.</releaseNotes>
<copyright>$copyright$</copyright> <copyright>$copyright$</copyright>
<tags>TWAIN</tags> <tags>TWAIN</tags>
</metadata> </metadata>

View File

@@ -306,16 +306,16 @@
PdfA2 = 16 PdfA2 = 16
} }
/// <summary> ///// <summary>
/// Audio file format values. ///// Audio file format values.
/// </summary> ///// </summary>
public enum AudioFileFormat : ushort //public enum AudioFileFormat : ushort
{ //{
Wav = 0, // Wav = 0,
Aiff = 1, // Aiff = 1,
AU = 3, // AU = 3,
Snd = 4, // Snd = 4,
} //}
/// <summary> /// <summary>
/// ICapImageFilter values. /// ICapImageFilter values.
@@ -360,7 +360,7 @@
CieXYZ = 8, CieXYZ = 8,
Lab = 9, Lab = 9,
SRGB = 10, SRGB = 10,
ScRGB = 11, //ScRGB = 11,
Infrared = 16 Infrared = 16
} }

View File

@@ -423,7 +423,7 @@ namespace NTwain.Values
CapFeedPage = 0x1009, CapFeedPage = 0x1009,
CapRewindPage = 0x100a, CapRewindPage = 0x100a,
CapIndicators = 0x100b, /* Added 1.1 */ CapIndicators = 0x100b, /* Added 1.1 */
CapSupportedCapsExt = 0x100c, /* Added 1.6 */ //CapSupportedCapsExt = 0x100c, /* Added 1.6 */
CapPaperDetectable = 0x100d, /* Added 1.6 */ CapPaperDetectable = 0x100d, /* Added 1.6 */
CapUIControllable = 0x100e, /* Added 1.6 */ CapUIControllable = 0x100e, /* Added 1.6 */
CapDeviceOnline = 0x100f, /* Added 1.6 */ CapDeviceOnline = 0x100f, /* Added 1.6 */
@@ -705,8 +705,8 @@ namespace NTwain.Values
/// Means Item is a char string shorter than 255. /// Means Item is a char string shorter than 255.
/// </summary> /// </summary>
String255 = 0xc, String255 = 0xc,
String1024 = 0xd, //String1024 = 0xd,
Unicode512 = 0xe, //Unicode512 = 0xe,
/// <summary> /// <summary>
/// Means Item is a handle (pointer). /// Means Item is a handle (pointer).
/// </summary> /// </summary>

View File

@@ -25,7 +25,8 @@
/// </summary> /// </summary>
public const int String255 = 256; public const int String255 = 256;
public const int String1024 = 1026; // deprecated
//public const int String1024 = 1026;
/// <summary> /// <summary>
/// Don't care value for 8 bit types. /// Don't care value for 8 bit types.
@@ -47,7 +48,7 @@
/// <summary> /// <summary>
/// The minor version number of TWAIN supported by this library. /// The minor version number of TWAIN supported by this library.
/// </summary> /// </summary>
public const short ProtocolMinor = 2; public const short ProtocolMinor = 3;
/// <summary> /// <summary>
/// Value for false where applicable. /// Value for false where applicable.