forked from poode/twain-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwain.h
2253 lines (2018 loc) · 76.2 KB
/
twain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* ======================================================================== *\
Copyright (C) 2007 TWAIN Working Group: Adobe Systems Incorporated,
AnyDoc Software Inc., Eastman Kodak Company, Fujitsu Computer Products
of America, JFL Peripheral Solutions Inc., Ricoh Corporation, and
Xerox Corporation. All rights reserved.
Copyright (C) 1991, 1992 TWAIN Working Group: Aldus, Caere, Eastman-Kodak,
Hewlett-Packard and Logitech Corporations. All rights reserved.
Copyright (C) 1997 TWAIN Working Group: Bell+Howell, Canon, DocuMagix,
Fujitsu, Genoa Technology, Hewlett-Packard, Kofax Imaging Products, and
Ricoh Corporation. All rights reserved.
Copyright (C) 1998 TWAIN Working Group: Adobe Systems Incorporated,
Canon Information Systems, Eastman Kodak Company,
Fujitsu Computer Products of America, Genoa Technology,
Hewlett-Packard Company, Intel Corporation, Kofax Image Products,
JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation.
All rights reserved.
Copyright (C) 2000 TWAIN Working Group: Adobe Systems Incorporated,
Canon Information Systems, Digimarc Corporation, Eastman Kodak Company,
Fujitsu Computer Products of America, Hewlett-Packard Company,
JFL Peripheral Solutions Inc., Ricoh Corporation, and Xerox Corporation.
All rights reserved.
TWAIN.h - This is the definitive include file for applications and
data sources written to the TWAIN specification.
It defines constants, data structures, messages etc.
for the public interface to TWAIN.
Revision History:
version 1.0, March 6, 1992. TWAIN 1.0.
version 1.1, January 1993. Tech Notes 1.1
version 1.5, June 1993. Specification Update 1.5
Change DC to TW
Change filename from DC.H to TWAIN.H
version 1.5, July 1993. Remove spaces from country identifiers
version 1.7, July 1997 Added Capabilities and data structure for
document imaging and digital cameras.
KHL.
version 1.7, July 1997 Inserted Borland compatibile structure packing
directives provided by Mentor. JMH
version 1.7, Aug 1997 Expanded file tabs to spaces.
NOTE: future authors should be sure to have
their editors set to automatically expand tabs
to spaces (original tab setting was 4 spaces).
version 1.7, Sept 1997 Added job control values
Added return codes
version 1.7, Sept 1997 changed definition of pRGBRESPONSE to
pTW_RGBRESPONSE
version 1.7 Aug 1998 Added missing TWEI_BARCODEROTATION values
TWBCOR_ types JMH
version 1.8 August 1998 Added new types and definitions required
for 1.8 Specification JMH
version 1.8 January 1999 Changed search mode from SRCH_ to TWBD_ as
in 1.8 Specification, added TWBT_MAXICODE JMH
version 1.8 January 1999 Removed undocumented duplicate AUTO<cap> JMH
version 1.8 March 1999 Removed undocumented 1.8 caps:
CAP_FILESYSTEM
CAP_PAPERBINDING
CAP_PASSTHRU
CAP_POWERDOWNTIME
ICAP_AUTODISCARDBLANKPAGES
* CAP_PAGEMULTIPLEACQUIRE - is CAP_REACQUIREALLOWED,
requires spec change. JMH
Added Mac structure packing modifications JMH
version 1.9 March 2000 Added new types and definations required
for 1.9 Specification MLM
version 1.9 March 2000 Added ICAP_JPEGQUALITY, TWJQ_ values,
updated TWON_PROTOCOLMINOR for Release v1.9 MN
version 1.91 August 2007 Added new types and definitions required
for 1.91 Specification MLM
version 2.0 Sept 2007 Added new types and definitions required
for 2.0 Specification FHH
version 2.0 Mar 2008 Depreciated ICAP_PIXELTYPEs TWPT_SRGB64, TWPT_BGR,
TWPT_CIELAB, TWPT_CIELUV, and TWPT_YCBCR JMW
version 2.0 Mar 2008 Added missing new 2.0 CAP_ definitions JMW
version 2.0 Dec 2008 Updated TW_INFO structure for 64bit JMW
version 2.1 Mar 2009 Added new types and definitions required
for 2.1 Specification JMW
version 2.2 Nov 2010 Added new types and definitions required
for 2.2 Specification MSM
version 2.3 Feb 2013 Added new types and definitions required
for 2.3 Specification MLM
version 2.3a Apr 2015 Errata fixes to TWCY_ANDORRA and TWCY_CUBA
version 2.4 Aug 2015 Added new types and definitions required
for 2.4 Specification MLM
\* ======================================================================== */
#ifndef TWAIN
#define TWAIN
/****************************************************************************
* TWAIN Version *
****************************************************************************/
#define TWON_PROTOCOLMINOR 4 /* Changed for Version 2.4 */
#define TWON_PROTOCOLMAJOR 2
/****************************************************************************
* Platform Dependent Definitions and Typedefs *
****************************************************************************/
/* Microsoft C/C++ Compiler */
#if defined(WIN32) || defined(WIN64) || defined (_WINDOWS)
#define TWH_CMP_MSC
#if defined(_WIN64) || defined(WIN64)
#define TWH_64BIT
#elif defined(WIN32) || defined(_WIN32)
#define TWH_32BIT
#endif
/* GNU C/C++ Compiler */
#elif defined(__GNUC__)
#define TWH_CMP_GNU
#if defined(__alpha__)\
||defined(__ia64__)\
||defined(__ppc64__)\
||defined(__s390x__)\
||defined(__x86_64__)
#define TWH_64BIT
#else
#define TWH_32BIT
#endif
/* Borland C/C++ Compiler */
#elif defined(__BORLAND__)
#define TWH_CMP_BORLAND
#define TWH_32BIT
/* Unrecognized */
#else
#error Unrecognized compiler
#endif
/* Apple Compiler (which is GNU now) */
#if defined(__APPLE__)
#define TWH_CMP_XCODE
#ifdef __MWERKS__
#include <Carbon.h>
#else
#include <Carbon/Carbon.h>
#endif
#endif
/* Win32 and Win64 systems */
#if defined(TWH_CMP_MSC) | defined(TWH_CMP_BORLAND)
typedef HANDLE TW_HANDLE;
typedef LPVOID TW_MEMREF;
typedef UINT_PTR TW_UINTPTR;
/* MacOS/X... */
#elif defined(TWH_CMP_XCODE)
#define PASCAL pascal
#define FAR
typedef Handle TW_HANDLE;
typedef char *TW_MEMREF;
typedef unsigned char BYTE;
#ifdef TWH_32BIT
//32 bit GNU
typedef unsigned long TW_UINTPTR;
#else
//64 bit GNU
typedef unsigned long long TW_UINTPTR;
#endif
/* Everything else... */
#else
#define PASCAL
#define FAR
typedef void* TW_HANDLE;
typedef void* TW_MEMREF;
typedef unsigned char BYTE;
#ifdef TWH_32BIT
//32 bit GNU
typedef unsigned long TW_UINTPTR;
#else
//64 bit GNU
typedef unsigned long long TW_UINTPTR;
#endif
#endif
/* Set the packing: this occurs before any structures are defined */
#ifdef TWH_CMP_MSC
#pragma pack (push, before_twain)
#pragma pack (2)
#elif defined(TWH_CMP_GNU)
#if defined(__APPLE__) /* cf: Mac version of TWAIN.h */
#pragma options align = power
#else
#pragma pack (push, before_twain)
#pragma pack (2)
#endif
#elif defined(TWH_CMP_BORLAND)
#pragma option -a2
#endif
/****************************************************************************
* Type Definitions *
****************************************************************************/
/* String types. These include room for the strings and a NULL char, *
* or, on the Mac, a length byte followed by the string. *
* TW_STR255 must hold less than 256 chars so length fits in first byte. */
#if defined(__APPLE__)/* cf: Mac version of TWAIN.h */
typedef unsigned char TW_STR32[34], FAR *pTW_STR32;
typedef unsigned char TW_STR64[66], FAR *pTW_STR64;
typedef unsigned char TW_STR128[130], FAR *pTW_STR128;
typedef unsigned char TW_STR255[256], FAR *pTW_STR255;
#else
typedef char TW_STR32[34], FAR *pTW_STR32;
typedef char TW_STR64[66], FAR *pTW_STR64;
typedef char TW_STR128[130], FAR *pTW_STR128;
typedef char TW_STR255[256], FAR *pTW_STR255;
#endif
/* Numeric types. */
typedef char TW_INT8, FAR *pTW_INT8;
typedef short TW_INT16, FAR *pTW_INT16;
typedef int TW_INT32, FAR *pTW_INT32;
typedef unsigned char TW_UINT8, FAR *pTW_UINT8;
typedef unsigned short TW_UINT16, FAR *pTW_UINT16;
typedef unsigned int TW_UINT32, FAR *pTW_UINT32;
typedef unsigned short TW_BOOL, FAR *pTW_BOOL;
/****************************************************************************
* 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;
#if defined(__APPLE__) /* cf: Mac version of TWAIN.h */
TW_MEMREF RefCon;
#else
TW_UINT32 RefCon;
#endif
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;
union {
TW_UINT16 ReturnCode;
TW_UINT16 CondCode; // Deprecated, do not use
};
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 {
#if defined(__APPLE__) /* cf: Mac version of TWAIN.h */
TW_MEMREF Id;
#else
TW_UINT32 Id;
#endif
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 "real" 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;
/* Collects scanning metrics after returning to state 4 */
typedef struct {
TW_UINT32 SizeOf;
TW_UINT32 ImageCount;
TW_UINT32 SheetCount;
} TW_METRICS, FAR * pTW_METRICS;
/* 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;
#if defined(__APPLE__) /* cf: Mac version of TWAIN.h */
union {
TW_UINT32 EOJ;
TW_UINT32 Reserved;
} TW_JOBCONTROL;
#endif
};
} 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's 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;
typedef struct {
TW_UINT32 SizeOf;
TW_UINT16 CommunicationManager;
TW_HANDLE Send;
TW_UINT32 SendSize;
TW_HANDLE Receive;
TW_UINT32 ReceiveSize;
} TW_TWAINDIRECT, FAR * pTW_TWAINDIRECT;
/* 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;
/****************************************************************************
* Generic Constants *
****************************************************************************/
#define TWON_ARRAY 3
#define TWON_ENUMERATION 4
#define TWON_ONEVALUE 5
#define TWON_RANGE 6
#define TWON_ICONID 962
#define TWON_DSMID 461
#define TWON_DSMCODEID 63
#define TWON_DONTCARE8 0xff
#define TWON_DONTCARE16 0xffff
#define TWON_DONTCARE32 0xffffffff
/* Flags used in TW_MEMORY structure. */
#define TWMF_APPOWNS 0x0001
#define TWMF_DSMOWNS 0x0002
#define TWMF_DSOWNS 0x0004
#define TWMF_POINTER 0x0008
#define TWMF_HANDLE 0x0010
#define TWTY_INT8 0x0000
#define TWTY_INT16 0x0001
#define TWTY_INT32 0x0002
#define TWTY_UINT8 0x0003
#define TWTY_UINT16 0x0004
#define TWTY_UINT32 0x0005
#define TWTY_BOOL 0x0006
#define TWTY_FIX32 0x0007
#define TWTY_FRAME 0x0008
#define TWTY_STR32 0x0009
#define TWTY_STR64 0x000a
#define TWTY_STR128 0x000b
#define TWTY_STR255 0x000c
#define TWTY_HANDLE 0x000f
/****************************************************************************
* Capability Constants *
****************************************************************************/
/* CAP_ALARMS values */
#define TWAL_ALARM 0
#define TWAL_FEEDERERROR 1
#define TWAL_FEEDERWARNING 2
#define TWAL_BARCODE 3
#define TWAL_DOUBLEFEED 4
#define TWAL_JAM 5
#define TWAL_PATCHCODE 6
#define TWAL_POWER 7
#define TWAL_SKEW 8
/* ICAP_AUTOSIZE values */
#define TWAS_NONE 0
#define TWAS_AUTO 1
#define TWAS_CURRENT 2
/* TWEI_BARCODEROTATION values */
#define TWBCOR_ROT0 0
#define TWBCOR_ROT90 1
#define TWBCOR_ROT180 2
#define TWBCOR_ROT270 3
#define TWBCOR_ROTX 4
/* ICAP_BARCODESEARCHMODE values */
#define TWBD_HORZ 0
#define TWBD_VERT 1
#define TWBD_HORZVERT 2
#define TWBD_VERTHORZ 3
/* ICAP_BITORDER values */
#define TWBO_LSBFIRST 0
#define TWBO_MSBFIRST 1
/* ICAP_AUTODISCARDBLANKPAGES values */
#define TWBP_DISABLE -2
#define TWBP_AUTO -1
/* ICAP_BITDEPTHREDUCTION values */
#define TWBR_THRESHOLD 0
#define TWBR_HALFTONE 1
#define TWBR_CUSTHALFTONE 2
#define TWBR_DIFFUSION 3
#define TWBR_DYNAMICTHRESHOLD 4
/* ICAP_SUPPORTEDBARCODETYPES and TWEI_BARCODETYPE values*/
#define TWBT_3OF9 0
#define TWBT_2OF5INTERLEAVED 1
#define TWBT_2OF5NONINTERLEAVED 2
#define TWBT_CODE93 3
#define TWBT_CODE128 4
#define TWBT_UCC128 5
#define TWBT_CODABAR 6
#define TWBT_UPCA 7
#define TWBT_UPCE 8
#define TWBT_EAN8 9
#define TWBT_EAN13 10
#define TWBT_POSTNET 11
#define TWBT_PDF417 12
#define TWBT_2OF5INDUSTRIAL 13
#define TWBT_2OF5MATRIX 14
#define TWBT_2OF5DATALOGIC 15
#define TWBT_2OF5IATA 16
#define TWBT_3OF9FULLASCII 17
#define TWBT_CODABARWITHSTARTSTOP 18
#define TWBT_MAXICODE 19
#define TWBT_QRCODE 20
/* ICAP_COMPRESSION values*/
#define TWCP_NONE 0
#define TWCP_PACKBITS 1
#define TWCP_GROUP31D 2
#define TWCP_GROUP31DEOL 3
#define TWCP_GROUP32D 4
#define TWCP_GROUP4 5
#define TWCP_JPEG 6
#define TWCP_LZW 7
#define TWCP_JBIG 8
#define TWCP_PNG 9
#define TWCP_RLE4 10
#define TWCP_RLE8 11
#define TWCP_BITFIELDS 12
#define TWCP_ZIP 13
#define TWCP_JPEG2000 14
/* CAP_CAMERASIDE and TWEI_PAGESIDE values */
#define TWCS_BOTH 0
#define TWCS_TOP 1
#define TWCS_BOTTOM 2
/* CAP_DEVICEEVENT values */
#define TWDE_CUSTOMEVENTS 0x8000
#define TWDE_CHECKAUTOMATICCAPTURE 0
#define TWDE_CHECKBATTERY 1
#define TWDE_CHECKDEVICEONLINE 2
#define TWDE_CHECKFLASH 3
#define TWDE_CHECKPOWERSUPPLY 4
#define TWDE_CHECKRESOLUTION 5
#define TWDE_DEVICEADDED 6
#define TWDE_DEVICEOFFLINE 7
#define TWDE_DEVICEREADY 8
#define TWDE_DEVICEREMOVED 9
#define TWDE_IMAGECAPTURED 10
#define TWDE_IMAGEDELETED 11
#define TWDE_PAPERDOUBLEFEED 12
#define TWDE_PAPERJAM 13
#define TWDE_LAMPFAILURE 14
#define TWDE_POWERSAVE 15
#define TWDE_POWERSAVENOTIFY 16
/* TW_PASSTHRU.Direction values. */
#define TWDR_GET 1
#define TWDR_SET 2
/* TWEI_DESKEWSTATUS values. */
#define TWDSK_SUCCESS 0
#define TWDSK_REPORTONLY 1
#define TWDSK_FAIL 2
#define TWDSK_DISABLED 3
/* CAP_DUPLEX values */
#define TWDX_NONE 0
#define TWDX_1PASSDUPLEX 1
#define TWDX_2PASSDUPLEX 2
/* CAP_FEEDERALIGNMENT values */
#define TWFA_NONE 0
#define TWFA_LEFT 1
#define TWFA_CENTER 2
#define TWFA_RIGHT 3
/* ICAP_FEEDERTYPE values*/
#define TWFE_GENERAL 0
#define TWFE_PHOTO 1
/* ICAP_IMAGEFILEFORMAT values */
#define TWFF_TIFF 0
#define TWFF_PICT 1
#define TWFF_BMP 2
#define TWFF_XBM 3
#define TWFF_JFIF 4
#define TWFF_FPX 5
#define TWFF_TIFFMULTI 6
#define TWFF_PNG 7
#define TWFF_SPIFF 8
#define TWFF_EXIF 9
#define TWFF_PDF 10
#define TWFF_JP2 11
#define TWFF_JPX 13
#define TWFF_DEJAVU 14
#define TWFF_PDFA 15
#define TWFF_PDFA2 16
#define TWFF_PDFRASTER 17
/* ICAP_FLASHUSED2 values */
#define TWFL_NONE 0
#define TWFL_OFF 1
#define TWFL_ON 2
#define TWFL_AUTO 3
#define TWFL_REDEYE 4
/* CAP_FEEDERORDER values */
#define TWFO_FIRSTPAGEFIRST 0
#define TWFO_LASTPAGEFIRST 1
/* CAP_FEEDERPOCKET values*/
#define TWFP_POCKETERROR 0
#define TWFP_POCKET1 1
#define TWFP_POCKET2 2
#define TWFP_POCKET3 3
#define TWFP_POCKET4 4
#define TWFP_POCKET5 5
#define TWFP_POCKET6 6
#define TWFP_POCKET7 7
#define TWFP_POCKET8 8
#define TWFP_POCKET9 9
#define TWFP_POCKET10 10
#define TWFP_POCKET11 11
#define TWFP_POCKET12 12
#define TWFP_POCKET13 13
#define TWFP_POCKET14 14
#define TWFP_POCKET15 15
#define TWFP_POCKET16 16
/* ICAP_FLIPROTATION values */
#define TWFR_BOOK 0
#define TWFR_FANFOLD 1
/* ICAP_FILTER values */
#define TWFT_RED 0
#define TWFT_GREEN 1
#define TWFT_BLUE 2
#define TWFT_NONE 3
#define TWFT_WHITE 4
#define TWFT_CYAN 5
#define TWFT_MAGENTA 6
#define TWFT_YELLOW 7
#define TWFT_BLACK 8
/* TW_FILESYSTEM.FileType values */
#define TWFY_CAMERA 0
#define TWFY_CAMERATOP 1
#define TWFY_CAMERABOTTOM 2
#define TWFY_CAMERAPREVIEW 3
#define TWFY_DOMAIN 4
#define TWFY_HOST 5
#define TWFY_DIRECTORY 6
#define TWFY_IMAGE 7
#define TWFY_UNKNOWN 8
/* ICAP_ICCPROFILE values */
#define TWIC_NONE 0
#define TWIC_LINK 1
#define TWIC_EMBED 2
/* ICAP_IMAGEFILTER values */
#define TWIF_NONE 0
#define TWIF_AUTO 1
#define TWIF_LOWPASS 2
#define TWIF_BANDPASS 3
#define TWIF_HIGHPASS 4
#define TWIF_TEXT TWIF_BANDPASS
#define TWIF_FINELINE TWIF_HIGHPASS
/* ICAP_IMAGEMERGE values */
#define TWIM_NONE 0
#define TWIM_FRONTONTOP 1
#define TWIM_FRONTONBOTTOM 2
#define TWIM_FRONTONLEFT 3
#define TWIM_FRONTONRIGHT 4
/* CAP_JOBCONTROL values */
#define TWJC_NONE 0
#define TWJC_JSIC 1
#define TWJC_JSIS 2
#define TWJC_JSXC 3
#define TWJC_JSXS 4
/* ICAP_JPEGQUALITY values */
#define TWJQ_UNKNOWN -4
#define TWJQ_LOW -3
#define TWJQ_MEDIUM -2
#define TWJQ_HIGH -1
/* ICAP_LIGHTPATH values */
#define TWLP_REFLECTIVE 0
#define TWLP_TRANSMISSIVE 1
/* ICAP_LIGHTSOURCE values */
#define TWLS_RED 0
#define TWLS_GREEN 1
#define TWLS_BLUE 2
#define TWLS_NONE 3
#define TWLS_WHITE 4
#define TWLS_UV 5
#define TWLS_IR 6
/* TWEI_MAGTYPE values */
#define TWMD_MICR 0
#define TWMD_RAW 1
#define TWMD_INVALID 2
/* ICAP_NOISEFILTER values */
#define TWNF_NONE 0
#define TWNF_AUTO 1
#define TWNF_LONEPIXEL 2
#define TWNF_MAJORITYRULE 3
/* ICAP_ORIENTATION values */
#define TWOR_ROT0 0
#define TWOR_ROT90 1
#define TWOR_ROT180 2
#define TWOR_ROT270 3
#define TWOR_PORTRAIT TWOR_ROT0
#define TWOR_LANDSCAPE TWOR_ROT270
#define TWOR_AUTO 4
#define TWOR_AUTOTEXT 5
#define TWOR_AUTOPICTURE 6
/* ICAP_OVERSCAN values */
#define TWOV_NONE 0
#define TWOV_AUTO 1
#define TWOV_TOPBOTTOM 2
#define TWOV_LEFTRIGHT 3
#define TWOV_ALL 4
/* Palette types for TW_PALETTE8 */
#define TWPA_RGB 0
#define TWPA_GRAY 1
#define TWPA_CMY 2
/* ICAP_PLANARCHUNKY values */
#define TWPC_CHUNKY 0
#define TWPC_PLANAR 1
/* TWEI_PATCHCODE values*/
#define TWPCH_PATCH1 0
#define TWPCH_PATCH2 1
#define TWPCH_PATCH3 2
#define TWPCH_PATCH4 3
#define TWPCH_PATCH6 4
#define TWPCH_PATCHT 5
/* ICAP_PIXELFLAVOR values */
#define TWPF_CHOCOLATE 0
#define TWPF_VANILLA 1
/* CAP_PRINTERMODE values */
#define TWPM_SINGLESTRING 0
#define TWPM_MULTISTRING 1
#define TWPM_COMPOUNDSTRING 2
/* CAP_PRINTER values */
#define TWPR_IMPRINTERTOPBEFORE 0
#define TWPR_IMPRINTERTOPAFTER 1
#define TWPR_IMPRINTERBOTTOMBEFORE 2
#define TWPR_IMPRINTERBOTTOMAFTER 3
#define TWPR_ENDORSERTOPBEFORE 4
#define TWPR_ENDORSERTOPAFTER 5
#define TWPR_ENDORSERBOTTOMBEFORE 6
#define TWPR_ENDORSERBOTTOMAFTER 7
/* CAP_PRINTERFONTSTYLE Added 2.3 */
#define TWPF_NORMAL 0
#define TWPF_BOLD 1
#define TWPF_ITALIC 2
#define TWPF_LARGESIZE 3
#define TWPF_SMALLSIZE 4
/* CAP_PRINTERINDEXTRIGGER Added 2.3 */
#define TWCT_PAGE 0
#define TWCT_PATCH1 1
#define TWCT_PATCH2 2
#define TWCT_PATCH3 3
#define TWCT_PATCH4 4
#define TWCT_PATCHT 5
#define TWCT_PATCH6 6
/* CAP_POWERSUPPLY values */
#define TWPS_EXTERNAL 0
#define TWPS_BATTERY 1
/* ICAP_PIXELTYPE values (PT_ means Pixel Type) */
#define TWPT_BW 0
#define TWPT_GRAY 1
#define TWPT_RGB 2
#define TWPT_PALETTE 3