1 #pragma once
2 
3 #ifndef __TTWAIN_UTIL_H__
4 #define __TTWAIN_UTIL_H__
5 
6 #include "ttwain.h"
7 
8 #undef TNZAPI
9 #ifdef TNZ_IS_DEVICELIB
10 #define TNZ_EXPORT_API
11 #else
12 #define TNZ_IMPORT_API
13 #endif
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 int TTWAIN_IsAvailable(void);
20 void TTWAIN_SetAvailable(TWAINAVAILABLE status);
21 char *TTWAIN_GetLastError(TUINT32 *rc, TUINT32 *cc);
22 
23 int TTWAIN_GetResolution(float *min, float *max, float *step, float *def);
24 int TTWAIN_GetOpticalResolution(float *min, float *max, float *step,
25                                 float *def);
26 
27 int TTWAIN_GetBrightness(float *min, float *max, float *step, float *def);
28 int TTWAIN_GetContrast(float *min, float *max, float *step, float *def);
29 int TTWAIN_GetThreshold(float *min, float *max, float *step, float *def);
30 
31 int TTWAIN_GetPhysicalWidthWAdf(float *width);
32 int TTWAIN_GetPhysicalHeightWAdf(float *height);
33 
34 int TTWAIN_GetMinimumWidthWAdf(float *width);
35 int TTWAIN_GetMinimumHeightWAdf(float *height);
36 
37 int TTWAIN_GetPhysicalWidthWoAdf(float *width);
38 int TTWAIN_GetPhysicalHeightWoAdf(float *height);
39 
40 int TTWAIN_GetMinimumWidthWoAdf(float *width);
41 int TTWAIN_GetMinimumHeightWoAdf(float *height);
42 
43 int TTWAIN_SupportsPixelType(TTWAIN_PIXTYPE pix);
44 int TTWAIN_SupportsFeeder(void);
45 int TTWAIN_SupportsCompressionType(TW_UINT16 comprType);
46 
47 int TTWAIN_GetSupportedCaps(void);
48 int TTWAIN_GetFeeder(void);
49 int TTWAIN_IsFeederLoaded(void);
50 /* this function should return the current value */
51 int TTWAIN_GetCurrentPixelType(TTWAIN_PIXTYPE *pixType);
52 /*                                          */
53 
54 int TTWAIN_IsCapResolutionSupported(void);
55 int TTWAIN_IsCapOpticalResolutionSupported(void);
56 int TTWAIN_IsCapBrightnessSupported(void);
57 int TTWAIN_IsCapContrastSupported(void);
58 int TTWAIN_IsCapThresholdSupported(void);
59 int TTWAIN_IsCapPhysicalWidthSupported(void);
60 int TTWAIN_IsCapPhysicalHeightSupported(void);
61 int TTWAIN_IsCapMinimumWidthSupported(void);
62 int TTWAIN_IsCapMinimumHeightSupported(void);
63 int TTWAIN_IsCapPixelTypeSupported(void);
64 int TTWAIN_IsCapFeederSupported(void);
65 int TTWAIN_IsCapImageLayoutSupported(void);
66 int TTWAIN_IsCapOrientationSupported(void);
67 int TTWAIN_IsCapDeviceOnLineSupported(void);
68 int TTWAIN_IsCapBitDepthSupported(void);
69 int TTWAIN_IsCapBitOrderSupported(void);
70 int TTWAIN_IsCapCompressionSupported(void);
71 
72 int TTWAIN_SetResolution(float resolution);
73 int TTWAIN_SetContrast(float contrast);
74 int TTWAIN_SetBrightness(float brightness);
75 int TTWAIN_SetThreshold(float threshold);
76 
77 int TTWAIN_SetXScaling(float scale);
78 int TTWAIN_SetYScaling(float scale);
79 
80 int TTWAIN_SetPixelType(TTWAIN_PIXTYPE pixtype);
81 int TTWAIN_SetBitDepth(USHORT bitDepth);
82 int TTWAIN_SetBitOrder(TTWAIN_BITORDER bitOrder);
83 
84 int TTWAIN_SetImageLayout(float L, float T, float R, float B);
85 int TTWAIN_SetOrientation(USHORT orientation);
86 
87 int TTWAIN_SetFeeder(int status); /* TRUE->enabled */
88 int TTWAIN_SetPage(void);
89 
90 void TTWAIN_DumpCapabilities(void (*trace_fun)(const char *fmt, ...));
91 
92 /*  USER INTERFACE */
93 int TTWAIN_HasControllableUI(void);
94 /* Return 1 if source claims UI can be hidden (see SetUIStatus above)
95    Return 0 if source says UI *cannot* be hidden
96    Return -1 if source (pre TWAIN 1.6) cannot answer the question. */
97 int TTWAIN_GetUIStatus(void);
98 void TTWAIN_SetUIStatus(int status);
99 
100 int TTWAIN_IsDeviceOnLine(void); /* -1 unknown, 0 no, 1 yes      */
101 /* info about the twain driver              */
102 char *TTWAIN_GetManufacturer(void);  /*                              */
103 char *TTWAIN_GetProductFamily(void); /* return an internal static var*/
104 char *TTWAIN_GetProductName(void);   /* don't free ret. value        */
105 char *TTWAIN_GetVersion(void);       /*                              */
106 char *TTWAIN_GetTwainVersion(void);  /*                              */
107 
108 int TTWAIN_Native2Raster(void *handle, void *the_ras, int *lx, int *ly);
109 
110 int TTWAIN_SetXferMech(TTWAIN_TRANSFER_MECH mech, void *ptr, TUINT32 size,
111                        int preferredLx, int preferredLy,
112                        TUINT32 numberOfImages);
113 /*            NATIVE  BUFFERED	       FILE
114 mech          the transfer mechanism
115 ptr	       0       memory buffer      ?Not Impl.  filename ?
116 size	       0       size of the buffer ?Not Impl.?
117 preferredLx    lx      lx                 ?Not Impl.? lx?
118 preferredLy    ly      ly                 ?Not Impl.? ly?
119 numberOfImages 1,2,.... or -1 for all in the ADF
120 */
121 #endif
122 
123 #ifdef NOTES
124 here
125 /* The XScaling cap. should be negotiated before the YScaling, this is because
126    some Sources may set the YScaling capability whenever XScaling capability
127    is set, to maintain a square aspect ratio for Applications that do not
128    bother to negotiate YScaling capability. (note from Twain Spec 1.9 draft)
129 */
130 #endif
131 
132 #ifdef __cplusplus
133 }
134 #endif
135