-
Notifications
You must be signed in to change notification settings - Fork 16
/
TWAIN.H
1969 lines (1782 loc) · 80 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) 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 © 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 © 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
\* ======================================================================== */
#ifndef TWAIN
#define TWAIN
/* SDH - 02/08/95 - TWUNK */
/* Force 32-bit twain to use same packing of twain structures as existing */
/* 16-bit twain. This allows 16/32-bit thunking. */
#ifdef WIN32
#ifdef __BORLANDC__ //(Mentor June 13, 1996) if using a Borland compiler
#pragma option -a2 //(Mentor June 13, 1996) switch to word alignment
#else //(Mentor June 13, 1996) if we're using some other compiler
#pragma pack (push, before_twain)
#pragma pack (2)
#endif //(Mentor June 13, 1996)
#else /* WIN32 */
#endif /* WIN32 */
/****************************************************************************
* TWAIN Version *
****************************************************************************/
#define TWON_PROTOCOLMINOR 9 /* Changed for Version 1.9 */
#define TWON_PROTOCOLMAJOR 1
/****************************************************************************
* Platform Dependent Definitions and Typedefs *
****************************************************************************/
/* Define one of the following, depending on the platform */
/* #define _MAC_ */
/* #define _UNIX_ */
#define _MSWIN_
#ifdef _MSWIN_
typedef HANDLE TW_HANDLE;
typedef LPVOID TW_MEMREF;
/* SDH - 05/05/95 - TWUNK */
/* For common code between 16 and 32 bits. */
#ifdef WIN32
#define TW_HUGE
#else /* WIN32 */
#define TW_HUGE huge
#endif /* WIN32 */
typedef BYTE TW_HUGE * HPBYTE;
typedef void TW_HUGE * HPVOID;
#endif /* _MSWIN_ */
#ifdef _MAC_
/*
* NOTE:
* Corrected to allow building of TWAIN MacOS PowerPC Applications
* and MacOS PowerPC TWAIN sources.
*
* The modification allows a PowerPC Application to use a
* TWAIN 68k Source and a PowerPC Source to be used by a 68k Application.
*
* The modification concerns the data alignment of the C-Structures used by
* TWAIN during the communication between the Application and Source.
*
* The Data Alignment must be 68k code and not PowerPC.
* - Paul Plaquette, LOGi 27, FRANCE-Montpellier
*/
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
#pragma pack(2)
#endif
#define PASCAL pascal
#define FAR
typedef Handle TW_HANDLE;
typedef char *TW_MEMREF;
#endif /* _MAC_ */
#ifdef _UNIX_
#define PASCAL pascal
typedef unsigned char *TW_HANDLE;
typedef unsigned char *TW_MEMREF;
#endif /* _UNIX_ */
/****************************************************************************
* 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. */
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;
typedef char TW_STR1024[1026], FAR *pTW_STR1024; /* added 1.9 */
typedef wchar_t TW_UNI512[512], FAR *pTW_UNI512; /* added 1.9 */
/* Numeric types. */
typedef char TW_INT8, FAR *pTW_INT8;
typedef short TW_INT16, FAR *pTW_INT16;
typedef long TW_INT32, FAR *pTW_INT32;
typedef unsigned char TW_UINT8, FAR *pTW_UINT8;
typedef unsigned short TW_UINT16, FAR *pTW_UINT16;
typedef unsigned long TW_UINT32, FAR *pTW_UINT32;
typedef unsigned short TW_BOOL, FAR *pTW_BOOL;
/* Fixed point structure type. */
typedef struct {
TW_INT16 Whole; /* maintains the sign */
TW_UINT16 Frac;
} TW_FIX32, FAR *pTW_FIX32;
/****************************************************************************
* Structure Definitions *
****************************************************************************/
/* No DAT needed. */
typedef struct {
TW_FIX32 X;
TW_FIX32 Y;
TW_FIX32 Z;
} TW_CIEPOINT, FAR * pTW_CIEPOINT;
/* No DAT needed. */
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; /* if =0 use the gamma */
} TW_DECODEFUNCTION, FAR * pTW_DECODEFUNCTION;
/* No DAT needed. */
typedef struct {
TW_UINT8 Index; /* Value used to index into the color table. */
TW_UINT8 Channel1; /* First tri-stimulus value (e.g Red) */
TW_UINT8 Channel2; /* Second tri-stimulus value (e.g Green) */
TW_UINT8 Channel3; /* Third tri-stimulus value (e.g Blue) */
} TW_ELEMENT8, FAR * pTW_ELEMENT8;
/* No DAT. 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;
/* No DAT needed. Used to manage memory buffers. */
typedef struct {
TW_UINT32 Flags; /* Any combination of the TWMF_ constants. */
TW_UINT32 Length; /* Number of bytes stored in buffer TheMem. */
TW_MEMREF TheMem; /* Pointer or handle to the allocated memory buffer. */
} TW_MEMORY, FAR * pTW_MEMORY;
/* No DAT needed. */
typedef struct {
TW_DECODEFUNCTION Decode[3];
TW_FIX32 Mix[3][3];
} TW_TRANSFORMSTAGE, FAR * pTW_TRANSFORMSTAGE;
/* No DAT needed. Describes version of software currently running. */
typedef struct {
TW_UINT16 MajorNum; /* Major revision number of the software. */
TW_UINT16 MinorNum; /* Incremental revision number of the software. */
TW_UINT16 Language; /* e.g. TWLG_SWISSFRENCH */
TW_UINT16 Country; /* e.g. TWCY_SWITZERLAND */
TW_STR32 Info; /* e.g. "1.0b3 Beta release" */
} TW_VERSION, FAR * pTW_VERSION;
/* TWON_ARRAY. Container for array of values (a simplified TW_ENUMERATION) */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 NumItems; /* How many items in ItemList */
TW_UINT8 ItemList[1]; /* Array of ItemType values starts here */
} TW_ARRAY, FAR * pTW_ARRAY;
/* TWON_ENUMERATION. Container for a collection of values. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 NumItems; /* How many items in ItemList */
TW_UINT32 CurrentIndex; /* Current value is in ItemList[CurrentIndex] */
TW_UINT32 DefaultIndex; /* Powerup value is in ItemList[DefaultIndex] */
TW_UINT8 ItemList[1]; /* Array of ItemType values starts here */
} TW_ENUMERATION, FAR * pTW_ENUMERATION;
/* TWON_ONEVALUE. Container for one value. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 Item;
} TW_ONEVALUE, FAR * pTW_ONEVALUE;
/* TWON_RANGE. Container for a range of values. */
typedef struct {
TW_UINT16 ItemType;
TW_UINT32 MinValue; /* Starting value in the range. */
TW_UINT32 MaxValue; /* Final value in the range. */
TW_UINT32 StepSize; /* Increment from MinValue to MaxValue. */
TW_UINT32 DefaultValue; /* Power-up value. */
TW_UINT32 CurrentValue; /* The value that is currently in effect. */
} TW_RANGE, FAR * pTW_RANGE;
/* DAT_CAPABILITY. Used by application to get/set capability from/in a data source. */
typedef struct {
TW_UINT16 Cap; /* id of capability to set or get, e.g. CAP_BRIGHTNESS */
TW_UINT16 ConType; /* TWON_ONEVALUE, _RANGE, _ENUMERATION or _ARRAY */
TW_HANDLE hContainer; /* Handle to container of type Dat */
} TW_CAPABILITY, FAR * pTW_CAPABILITY;
/* DAT_CIECOLOR. */
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;
/* DAT_EVENT. For passing events down from the application to the DS. */
typedef struct {
TW_MEMREF pEvent; /* Windows pMSG or Mac pEvent. */
TW_UINT16 TWMessage; /* TW msg from data source, e.g. MSG_XFERREADY */
} TW_EVENT, FAR * pTW_EVENT;
/* DAT_GRAYRESPONSE */
typedef struct {
TW_ELEMENT8 Response[1];
} TW_GRAYRESPONSE, FAR * pTW_GRAYRESPONSE;
/* DAT_IDENTITY. Identifies the program/library/code resource. */
typedef struct {
TW_UINT32 Id; /* Unique number. In Windows, application hWnd */
TW_VERSION Version; /* Identifies the piece of code */
TW_UINT16 ProtocolMajor; /* Application and DS must set to TWON_PROTOCOLMAJOR */
TW_UINT16 ProtocolMinor; /* Application and DS must set to TWON_PROTOCOLMINOR */
TW_UINT32 SupportedGroups; /* Bit field OR combination of DG_ constants */
TW_STR32 Manufacturer; /* Manufacturer name, e.g. "Hewlett-Packard" */
TW_STR32 ProductFamily; /* Product family name, e.g. "ScanJet" */
TW_STR32 ProductName; /* Product name, e.g. "ScanJet Plus" */
} TW_IDENTITY, FAR * pTW_IDENTITY;
/* DAT_IMAGEINFO. Application gets detailed image info from DS with this. */
typedef struct {
TW_FIX32 XResolution; /* Resolution in the horizontal */
TW_FIX32 YResolution; /* Resolution in the vertical */
TW_INT32 ImageWidth; /* Columns in the image, -1 if unknown by DS*/
TW_INT32 ImageLength; /* Rows in the image, -1 if unknown by DS */
TW_INT16 SamplesPerPixel; /* Number of samples per pixel, 3 for RGB */
TW_INT16 BitsPerSample[8]; /* Number of bits for each sample */
TW_INT16 BitsPerPixel; /* Number of bits for each padded pixel */
TW_BOOL Planar; /* True if Planar, False if chunky */
TW_INT16 PixelType; /* How to interp data; photo interp (TWPT_) */
TW_UINT16 Compression; /* How the data is compressed (TWCP_xxxx) */
} TW_IMAGEINFO, FAR * pTW_IMAGEINFO;
/* DAT_IMAGELAYOUT. Provides image layout information in current units. */
typedef struct {
TW_FRAME Frame; /* Frame coords within larger document */
TW_UINT32 DocumentNumber;
TW_UINT32 PageNumber; /* Reset when you go to next document */
TW_UINT32 FrameNumber; /* Reset when you go to next page */
} TW_IMAGELAYOUT, FAR * pTW_IMAGELAYOUT;
/* DAT_IMAGEMEMXFER. Used to pass image data (e.g. in strips) from DS to application.*/
typedef struct {
TW_UINT16 Compression; /* How the data is compressed */
TW_UINT32 BytesPerRow; /* Number of bytes in a row of data */
TW_UINT32 Columns; /* How many columns */
TW_UINT32 Rows; /* How many rows */
TW_UINT32 XOffset; /* How far from the side of the image */
TW_UINT32 YOffset; /* How far from the top of the image */
TW_UINT32 BytesWritten; /* How many bytes written in Memory */
TW_MEMORY Memory; /* Mem struct used to pass actual image data */
} TW_IMAGEMEMXFER, FAR * pTW_IMAGEMEMXFER;
/* Changed in 1.1: QuantTable, HuffmanDC, HuffmanAC TW_MEMREF -> TW_MEMORY */
/* DAT_JPEGCOMPRESSION. Based on JPEG Draft International Std, ver 10918-1. */
typedef struct {
TW_UINT16 ColorSpace; /* One of the TWPT_xxxx values */
TW_UINT32 SubSampling; /* Two word "array" for subsampling values */
TW_UINT16 NumComponents; /* Number of color components in image */
TW_UINT16 RestartFrequency; /* Frequency of restart marker codes in MDU's */
TW_UINT16 QuantMap[4]; /* Mapping of components to QuantTables */
TW_MEMORY QuantTable[4]; /* Quantization tables */
TW_UINT16 HuffmanMap[4]; /* Mapping of components to Huffman tables */
TW_MEMORY HuffmanDC[2]; /* DC Huffman tables */
TW_MEMORY HuffmanAC[2]; /* AC Huffman tables */
} TW_JPEGCOMPRESSION, FAR * pTW_JPEGCOMPRESSION;
/* DAT_PALETTE8. Color palette when TWPT_PALETTE pixels xfer'd in mem buf. */
typedef struct {
TW_UINT16 NumColors; /* Number of colors in the color table. */
TW_UINT16 PaletteType; /* TWPA_xxxx, specifies type of palette. */
TW_ELEMENT8 Colors[256]; /* Array of palette values starts here. */
} TW_PALETTE8, FAR * pTW_PALETTE8;
/* DAT_PENDINGXFERS. Used with MSG_ENDXFER to indicate additional data. */
typedef struct {
TW_UINT16 Count;
union {
TW_UINT32 EOJ;
TW_UINT32 Reserved;
};
} TW_PENDINGXFERS, FAR *pTW_PENDINGXFERS;
/* DAT_RGBRESPONSE */
typedef struct {
TW_ELEMENT8 Response[1];
} TW_RGBRESPONSE, FAR * pTW_RGBRESPONSE;
/* DAT_SETUPFILEXFER. Sets up DS to application data transfer via a file. */
typedef struct {
TW_STR255 FileName;
TW_UINT16 Format; /* Any TWFF_ constant */
TW_INT16 VRefNum; /* Used for Mac only */
} TW_SETUPFILEXFER, FAR * pTW_SETUPFILEXFER;
/* DAT_SETUPFILEXFER2. Sets up DS to application data transfer via a file. */
/* Added 1.9 */
typedef struct {
TW_MEMREF FileName; /* Pointer to file name text */
TW_UINT16 FileNameType; /* TWTY_STR1024 or TWTY_UNI512 */
TW_UINT16 Format; /* Any TWFF_ constant */
TW_INT16 VRefNum; /* Used for Mac only */
TW_UINT32 parID; /* Used for Mac only */
} TW_SETUPFILEXFER2, FAR * pTW_SETUPFILEXFER2;
/* DAT_SETUPMEMXFER. Sets up DS to application data transfer via a memory buffer. */
typedef struct {
TW_UINT32 MinBufSize;
TW_UINT32 MaxBufSize;
TW_UINT32 Preferred;
} TW_SETUPMEMXFER, FAR * pTW_SETUPMEMXFER;
/* DAT_STATUS. Application gets detailed status info from a data source with this. */
typedef struct {
TW_UINT16 ConditionCode; /* Any TWCC_ constant */
TW_UINT16 Reserved; /* Future expansion space */
} TW_STATUS, FAR * pTW_STATUS;
/* DAT_USERINTERFACE. Coordinates UI between application and data source. */
typedef struct {
TW_BOOL ShowUI; /* TRUE if DS should bring up its UI */
TW_BOOL ModalUI; /* For Mac only - true if the DS's UI is modal */
TW_HANDLE hParent; /* For windows only - Application window handle */
} TW_USERINTERFACE, FAR * pTW_USERINTERFACE;
/* SDH - 03/21/95 - TWUNK */
/* DAT_TWUNKIDENTITY. Provides DS identity and 'other' information necessary */
/* across thunk link. */
typedef struct {
TW_IDENTITY identity; /* Identity of data source. */
TW_STR255 dsPath; /* Full path and file name of data source. */
} TW_TWUNKIDENTITY, FAR * pTW_TWUNKIDENTITY;
/* SDH - 03/21/95 - TWUNK */
/* Provides DS_Entry parameters over thunk link. */
typedef struct
{
TW_INT8 destFlag; /* TRUE if dest is not NULL */
TW_IDENTITY dest; /* Identity of data source (if used) */
TW_INT32 dataGroup; /* DSM_Entry dataGroup parameter */
TW_INT16 dataArgType; /* DSM_Entry dataArgType parameter */
TW_INT16 message; /* DSM_Entry message parameter */
TW_INT32 pDataSize; /* Size of pData (0 if NULL) */
// TW_MEMREF pData; /* Based on implementation specifics, a */
/* pData parameter makes no sense in this */
/* structure, but data (if provided) will be*/
/* appended in the data block. */
} TW_TWUNKDSENTRYPARAMS, FAR * pTW_TWUNKDSENTRYPARAMS;
/* SDH - 03/21/95 - TWUNK */
/* Provides DS_Entry results over thunk link. */
typedef struct
{
TW_UINT16 returnCode; /* Thunker DsEntry return code. */
TW_UINT16 conditionCode; /* Thunker DsEntry condition code. */
TW_INT32 pDataSize; /* Size of pData (0 if NULL) */
// TW_MEMREF pData; /* Based on implementation specifics, a */
/* pData parameter makes no sense in this */
/* structure, but data (if provided) will be*/
/* appended in the data block. */
} TW_TWUNKDSENTRYRETURN, FAR * pTW_TWUNKDSENTRYRETURN;
/* WJD - 950818 */
/* Added for 1.6 Specification */
/* TWAIN 1.6 CAP_SUPPORTEDCAPSEXT structure */
typedef struct
{
TW_UINT16 Cap; /* Which CAP/ICAP info is relevant to */
TW_UINT16 Properties; /* Messages this CAP/ICAP supports */
} TW_CAPEXT, FAR * pTW_CAPEXT;
/* ----------------------------------------------------------------------- *\
Version 1.7: Added Following data structure for Document Imaging
July 1997 Enhancement.
KHL TW_CUSTOMDSDATA -- For Saving and Restoring Source's
state.
TW_INFO -- Each attribute for extended image
information.
TW_EXTIMAGEINFO -- Extended image information structure.
\* ----------------------------------------------------------------------- */
typedef struct {
TW_UINT32 InfoLength; /* Length of Information in bytes. */
TW_HANDLE hData; /* Place holder for data, DS Allocates */
}TW_CUSTOMDSDATA, FAR *pTW_CUSTOMDSDATA;
typedef struct {
TW_UINT16 InfoID;
TW_UINT16 ItemType;
TW_UINT16 NumItems;
TW_UINT16 CondCode;
TW_UINT32 Item;
}TW_INFO, FAR* pTW_INFO;
typedef struct {
TW_UINT32 NumInfos;
TW_INFO Info[1];
}TW_EXTIMAGEINFO, FAR* pTW_EXTIMAGEINFO;
/* Added 1.8 */
/* DAT_AUDIOINFO, information about audio data */
typedef struct {
TW_STR255 Name; /* name of audio data */
TW_UINT32 Reserved; /* reserved space */
} TW_AUDIOINFO, FAR * pTW_AUDIOINFO;
/* DAT_DEVICEEVENT, information about events */
typedef struct {
TW_UINT32 Event; /* One of the TWDE_xxxx values. */
TW_STR255 DeviceName; /* The name of the device that generated the event */
TW_UINT32 BatteryMinutes; /* Battery Minutes Remaining */
TW_INT16 BatteryPercentage; /* Battery Percentage Remaining */
TW_INT32 PowerSupply; /* Power Supply */
TW_FIX32 XResolution; /* Resolution */
TW_FIX32 YResolution; /* Resolution */
TW_UINT32 FlashUsed2; /* Flash Used2 */
TW_UINT32 AutomaticCapture; /* Automatic Capture */
TW_UINT32 TimeBeforeFirstCapture; /* Automatic Capture */
TW_UINT32 TimeBetweenCaptures; /* Automatic Capture */
} TW_DEVICEEVENT, FAR * pTW_DEVICEEVENT;
/* DAT_FILESYSTEM, information about TWAIN file system */
typedef struct {
/* DG_CONTROL / DAT_FILESYSTEM / MSG_xxxx fields */
TW_STR255 InputName; /* The name of the input or source file */
TW_STR255 OutputName; /* The result of an operation or the name of a destination file */
TW_MEMREF Context; /* Source specific data used to remember state information */
/* DG_CONTROL / DAT_FILESYSTEM / MSG_DELETE field */
int Recursive; /* recursively delete all sub-directories */
/* DG_CONTROL / DAT_FILESYSTEM / MSG_GETINFO fields */
TW_INT32 FileType; /* One of the TWFT_xxxx values */
TW_UINT32 Size; /* Size of current FileType */
TW_STR32 CreateTimeDate; /* creation date of the file */
TW_STR32 ModifiedTimeDate; /* last date the file was modified */
TW_UINT32 FreeSpace; /* bytes of free space on the current device */
TW_INT32 NewImageSize; /* estimate of the amount of space a new image would take up */
TW_UINT32 NumberOfFiles; /* number of files, depends on FileType */
TW_UINT32 NumberOfSnippets; /* number of audio snippets */
TW_UINT32 DeviceGroupMask; /* used to group cameras (ex: front/rear bitonal, front/rear grayscale...) */
char Reserved[508]; /**/
} TW_FILESYSTEM, FAR * pTW_FILESYSTEM;
/* DAT_PASSTHRU, device dependant data to pass through Data Source */
typedef struct {
TW_MEMREF pCommand; /* Pointer to Command buffer */
TW_UINT32 CommandBytes; /* Number of bytes in Command buffer */
TW_INT32 Direction; /* One of the TWDR_xxxx values. Defines the direction of data flow */
TW_MEMREF pData; /* Pointer to Data buffer */
TW_UINT32 DataBytes; /* Number of bytes in Data buffer */
TW_UINT32 DataBytesXfered; /* Number of bytes successfully transferred */
} TW_PASSTHRU, FAR * pTW_PASSTHRU;
/* DAT_SETUPAUDIOFILEXFER, information required to setup an audio file transfer */
typedef struct {
TW_STR255 FileName; /* full path target file */
TW_UINT16 Format; /* one of TWAF_xxxx */
TW_INT16 VRefNum;
} TW_SETUPAUDIOFILEXFER, FAR * pTW_SETUPAUDIOFILEXFER;
#ifdef _MAC_
/*
* Restore original Macintosh structure packing
*/
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
#pragma pack()
#endif
#endif /* _MAC_ */
/****************************************************************************
* Generic Constants *
****************************************************************************/
#define TWON_ARRAY 3 /* indicates TW_ARRAY container */
#define TWON_ENUMERATION 4 /* indicates TW_ENUMERATION container */
#define TWON_ONEVALUE 5 /* indicates TW_ONEVALUE container */
#define TWON_RANGE 6 /* indicates TW_RANGE container */
#define TWON_ICONID 962 /* res Id of icon used in USERSELECT lbox */
#define TWON_DSMID 461 /* res Id of the DSM version num resource */
#define TWON_DSMCODEID 63 /* res Id of the Mac SM Code resource */
#define TWON_DONTCARE8 0xff
#define TWON_DONTCARE16 0xffff
#define TWON_DONTCARE32 0xffffffff
/* Flags used in TW_MEMORY structure. */
#define TWMF_APPOWNS 0x1
#define TWMF_DSMOWNS 0x2
#define TWMF_DSOWNS 0x4
#define TWMF_POINTER 0x8
#define TWMF_HANDLE 0x10
/* Palette types for TW_PALETTE8 */
#define TWPA_RGB 0
#define TWPA_GRAY 1
#define TWPA_CMY 2
/* There are four containers used for capabilities negotiation:
* TWON_ONEVALUE, TWON_RANGE, TWON_ENUMERATION, TWON_ARRAY
* In each container structure ItemType can be TWTY_INT8, TWTY_INT16, etc.
* The kind of data stored in the container can be determined by doing
* DCItemSize[ItemType] where the following is defined in TWAIN glue code:
* DCItemSize[]= { sizeof(TW_INT8),
* sizeof(TW_INT16),
* etc.
* sizeof(TW_UINT32) };
*
*/
#define TWTY_INT8 0x0000 /* Means Item is a TW_INT8 */
#define TWTY_INT16 0x0001 /* Means Item is a TW_INT16 */
#define TWTY_INT32 0x0002 /* Means Item is a TW_INT32 */
#define TWTY_UINT8 0x0003 /* Means Item is a TW_UINT8 */
#define TWTY_UINT16 0x0004 /* Means Item is a TW_UINT16 */
#define TWTY_UINT32 0x0005 /* Means Item is a TW_UINT32 */
#define TWTY_BOOL 0x0006 /* Means Item is a TW_BOOL */
#define TWTY_FIX32 0x0007 /* Means Item is a TW_FIX32 */
#define TWTY_FRAME 0x0008 /* Means Item is a TW_FRAME */
#define TWTY_STR32 0x0009 /* Means Item is a TW_STR32 */
#define TWTY_STR64 0x000a /* Means Item is a TW_STR64 */
#define TWTY_STR128 0x000b /* Means Item is a TW_STR128 */
#define TWTY_STR255 0x000c /* Means Item is a TW_STR255 */
#define TWTY_STR1024 0x000d /* Means Item is a TW_STR1024...added 1.9 */
#define TWTY_UNI512 0x000e /* Means Item is a TW_UNI512...added 1.9 */
/****************************************************************************
* Capability Constants *
****************************************************************************/
/* ICAP_BITORDER values (BO_ means Bit Order) */
#define TWBO_LSBFIRST 0
#define TWBO_MSBFIRST 1
/* ICAP_COMPRESSION values (CP_ means ComPression ) */
#define TWCP_NONE 0
#define TWCP_PACKBITS 1
#define TWCP_GROUP31D 2 /* Follows CCITT spec (no End Of Line) */
#define TWCP_GROUP31DEOL 3 /* Follows CCITT spec (has End Of Line) */
#define TWCP_GROUP32D 4 /* Follows CCITT spec (use cap for K Factor) */
#define TWCP_GROUP4 5 /* Follows CCITT spec */
#define TWCP_JPEG 6 /* Use capability for more info */
#define TWCP_LZW 7 /* Must license from Unisys and IBM to use */
#define TWCP_JBIG 8 /* For Bitonal images -- Added 1.7 KHL */
/* Added 1.8 */
#define TWCP_PNG 9
#define TWCP_RLE4 10
#define TWCP_RLE8 11
#define TWCP_BITFIELDS 12
/* ICAP_IMAGEFILEFORMAT values (FF_means File Format) */
#define TWFF_TIFF 0 /* Tagged Image File Format */
#define TWFF_PICT 1 /* Macintosh PICT */
#define TWFF_BMP 2 /* Windows Bitmap */
#define TWFF_XBM 3 /* X-Windows Bitmap */
#define TWFF_JFIF 4 /* JPEG File Interchange Format */
#define TWFF_FPX 5 /* Flash Pix */
#define TWFF_TIFFMULTI 6 /* Multi-page tiff file */
#define TWFF_PNG 7
#define TWFF_SPIFF 8
#define TWFF_EXIF 9
/* ICAP_FILTER values (FT_ means Filter Type) */
#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
/* ICAP_LIGHTPATH values (LP_ means Light Path) */
#define TWLP_REFLECTIVE 0
#define TWLP_TRANSMISSIVE 1
/* ICAP_LIGHTSOURCE values (LS_ means Light Source) */
#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
/* ICAP_ORIENTATION values (OR_ means ORientation) */
#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
/* ICAP_PLANARCHUNKY values (PC_ means Planar/Chunky ) */
#define TWPC_CHUNKY 0
#define TWPC_PLANAR 1
/* ICAP_PIXELFLAVOR values (PF_ means Pixel Flavor) */
#define TWPF_CHOCOLATE 0 /* zero pixel represents darkest shade */
#define TWPF_VANILLA 1 /* zero pixel represents lightest shade */
/* ICAP_PIXELTYPE values (PT_ means Pixel Type) */
#define TWPT_BW 0 /* Black and White */
#define TWPT_GRAY 1
#define TWPT_RGB 2
#define TWPT_PALETTE 3
#define TWPT_CMY 4
#define TWPT_CMYK 5
#define TWPT_YUV 6
#define TWPT_YUVK 7
#define TWPT_CIEXYZ 8
/* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */
#define TWSS_NONE 0
#define TWSS_A4LETTER 1
#define TWSS_B5LETTER 2
#define TWSS_USLETTER 3
#define TWSS_USLEGAL 4
/* Added 1.5 */
#define TWSS_A5 5
#define TWSS_B4 6
#define TWSS_B6 7
//#define TWSS_B 8
/* Added 1.7 */
#define TWSS_USLEDGER 9
#define TWSS_USEXECUTIVE 10
#define TWSS_A3 11
#define TWSS_B3 12
#define TWSS_A6 13
#define TWSS_C4 14
#define TWSS_C5 15
#define TWSS_C6 16
/* Added 1.8 */
#define TWSS_4A0 17
#define TWSS_2A0 18
#define TWSS_A0 19
#define TWSS_A1 20
#define TWSS_A2 21
#define TWSS_A4 TWSS_A4LETTER
#define TWSS_A7 22
#define TWSS_A8 23
#define TWSS_A9 24
#define TWSS_A10 25
#define TWSS_ISOB0 26
#define TWSS_ISOB1 27
#define TWSS_ISOB2 28
#define TWSS_ISOB3 TWSS_B3
#define TWSS_ISOB4 TWSS_B4
#define TWSS_ISOB5 29
#define TWSS_ISOB6 TWSS_B6
#define TWSS_ISOB7 30
#define TWSS_ISOB8 31
#define TWSS_ISOB9 32
#define TWSS_ISOB10 33
#define TWSS_JISB0 34
#define TWSS_JISB1 35
#define TWSS_JISB2 36
#define TWSS_JISB3 37
#define TWSS_JISB4 38
#define TWSS_JISB5 TWSS_B5LETTER
#define TWSS_JISB6 39
#define TWSS_JISB7 40
#define TWSS_JISB8 41
#define TWSS_JISB9 42
#define TWSS_JISB10 43
#define TWSS_C0 44
#define TWSS_C1 45
#define TWSS_C2 46
#define TWSS_C3 47
#define TWSS_C7 48
#define TWSS_C8 49
#define TWSS_C9 50
#define TWSS_C10 51
#define TWSS_USSTATEMENT 52
#define TWSS_BUSINESSCARD 53
/* ICAP_XFERMECH values (SX_ means Setup XFer) */
#define TWSX_NATIVE 0
#define TWSX_FILE 1
#define TWSX_MEMORY 2
#define TWSX_FILE2 3 /* added 1.9 */
/* ICAP_UNITS values (UN_ means UNits) */
#define TWUN_INCHES 0
#define TWUN_CENTIMETERS 1
#define TWUN_PICAS 2
#define TWUN_POINTS 3
#define TWUN_TWIPS 4
#define TWUN_PIXELS 5
/* Added 1.5 */
/* ICAP_BITDEPTHREDUCTION values (BR_ means Bitdepth Reduction) */
#define TWBR_THRESHOLD 0
#define TWBR_HALFTONE 1
#define TWBR_CUSTHALFTONE 2
#define TWBR_DIFFUSION 3
/* Added 1.7 */
/* ICAP_DUPLEX values */
#define TWDX_NONE 0
#define TWDX_1PASSDUPLEX 1
#define TWDX_2PASSDUPLEX 2
/* Added 1.7 */
/* 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
/* Added 1.8 */
#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
/* Added 1.7 */
/* TWEI_DESKEWSTATUS values */
#define TWDSK_SUCCESS 0
#define TWDSK_REPORTONLY 1
#define TWDSK_FAIL 2
#define TWDSK_DISABLED 3
/* Added 1.7 */
/* 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
/* Added 1.7 */
/* CAP_JOBCONTROL values */
#define TWJC_NONE 0
#define TWJC_JSIC 1
#define TWJC_JSIS 2
#define TWJC_JSXC 3
#define TWJC_JSXS 4
/* Added 1.7 */
/* TWEI_BARCODEROTATION values (BCOR_ means barcode rotation) */
#define TWBCOR_ROT0 0
#define TWBCOR_ROT90 1
#define TWBCOR_ROT180 2
#define TWBCOR_ROT270 3
#define TWBCOR_ROTX 4
/* Added 1.8 */
/* ACAP_AUDIOFILEFORMAT values (AF_ means audio format) */
#define TWAF_WAV 0
#define TWAF_AIFF 1
#define TWAF_AU 3
#define TWAF_SND 4
/* CAP_ALARMS values (AL_ means alarms) */
#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
/* CAP_CLEARBUFFERS values (CB_ means clear buffers) */
#define TWCB_AUTO 0
#define TWCB_CLEAR 1
#define TWCB_NOCLEAR 2
/* CAP_DEVICEEVENT values (DE_ means device event) */
#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
/* CAP_FEEDERALIGNMENT values (FA_ means feeder alignment) */
#define TWFA_NONE 0
#define TWFA_LEFT 1
#define TWFA_CENTER 2
#define TWFA_RIGHT 3
/* CAP_FEEDERORDER values (FO_ means feeder order) */
#define TWFO_FIRSTPAGEFIRST 0
#define TWFO_LASTPAGEFIRST 1
/* CAP_FILESYSTEM values (FS_ means file system) */
#define TWFS_FILESYSTEM 0
#define TWFS_RECURSIVEDELETE 1
/* CAP_POWERSUPPLY values (PS_ means power supply) */
#define TWPS_EXTERNAL 0
#define TWPS_BATTERY 1
/* CAP_PRINTER values (PR_ means printer) */
#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_PRINTERMODE values (PM_ means printer mode) */
#define TWPM_SINGLESTRING 0
#define TWPM_MULTISTRING 1
#define TWPM_COMPOUNDSTRING 2
/* ICAP_BARCODESEARCHMODE values (TWBD_ means search) */
#define TWBD_HORZ 0
#define TWBD_VERT 1
#define TWBD_HORZVERT 2
#define TWBD_VERTHORZ 3
/* ICAP_FLASHUSED2 values (FL_ means flash) */
#define TWFL_NONE 0
#define TWFL_OFF 1
#define TWFL_ON 2
#define TWFL_AUTO 3
#define TWFL_REDEYE 4
/* ICAP_FLIPROTATION values (FR_ means flip rotation) */
#define TWFR_BOOK 0
#define TWFR_FANFOLD 1
/* ICAP_IMAGEFILTER values (IF_ means image filter) */
#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_NOISEFILTER values (NF_ means noise filter) */
#define TWNF_NONE 0
#define TWNF_AUTO 1
#define TWNF_LONEPIXEL 2
#define TWNF_MAJORITYRULE 3
/* ICAP_OVERSCAN values (OV_ means overscan) */
#define TWOV_NONE 0
#define TWOV_AUTO 1
#define TWOV_TOPBOTTOM 2
#define TWOV_LEFTRIGHT 3
#define TWOV_ALL 4
/* TW_FILESYSTEM.FileType values (FT_ means file type) */
#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_JPEGQUALITY values (JQ_ means jpeg quality) */