sane_i.h 10.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright 2000 Corel Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 18 19 20 21 22 23 24 25
 */

#ifndef _TWAIN32_H
#define _TWAIN32_H

#ifndef __WINE_CONFIG_H
# error You must include config.h first
#endif

26 27
#include <stdarg.h>

28
#ifdef SONAME_LIBSANE
29
# include <sane/sane.h>
30
# include <sane/saneopts.h>
31 32 33 34 35 36
#endif

#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "twain.h"
37

38
#ifdef SONAME_LIBSANE
39
#define MAKE_FUNCPTR(f) typeof(f) * p##f DECLSPEC_HIDDEN;
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
MAKE_FUNCPTR(sane_init)
MAKE_FUNCPTR(sane_exit)
MAKE_FUNCPTR(sane_get_devices)
MAKE_FUNCPTR(sane_open)
MAKE_FUNCPTR(sane_close)
MAKE_FUNCPTR(sane_get_option_descriptor)
MAKE_FUNCPTR(sane_control_option)
MAKE_FUNCPTR(sane_get_parameters)
MAKE_FUNCPTR(sane_start)
MAKE_FUNCPTR(sane_read)
MAKE_FUNCPTR(sane_cancel)
MAKE_FUNCPTR(sane_set_io_mode)
MAKE_FUNCPTR(sane_get_select_fd)
MAKE_FUNCPTR(sane_strstatus)
#undef MAKE_FUNCPTR
55 56
#endif

57
extern HINSTANCE SANE_instance DECLSPEC_HIDDEN;
58

59 60
#define TWCC_CHECKSTATUS     (TWCC_CUSTOMBASE + 1)

61 62 63 64
/* internal information about an active data source */
struct tagActiveDS
{
    struct tagActiveDS	*next;			/* next active DS */
65
    TW_IDENTITY		identity;		/* identity of the DS */
66 67
    TW_UINT16		currentState;		/* current state */
    TW_UINT16		twCC;			/* condition code */
68
    TW_IDENTITY         appIdentity;            /* identity of the app */
69 70
    HWND		hwndOwner;		/* window handle of the app */
    HWND		progressWnd;		/* window handle of the scanning window */
71
#ifdef SONAME_LIBSANE
72 73 74 75
    SANE_Handle		deviceHandle;		/* device handle */
    SANE_Parameters     sane_param;             /* parameters about the image
                                                   transferred */
    BOOL                sane_param_valid;  /* true if valid sane_param*/
76
    BOOL                sane_started;      /* If sane_start has been called */
77 78
    INT                 deviceIndex;    /* index of the current device */
#endif
Austin English's avatar
Austin English committed
79
    /* Capabilities */
80
    TW_UINT16		capXferMech;		/* ICAP_XFERMECH */
81 82
    BOOL                PixelTypeSet;
    TW_UINT16		defaultPixelType;		/* ICAP_PIXELTYPE */
83 84 85 86
    BOOL                XResolutionSet;
    TW_FIX32            defaultXResolution;
    BOOL                YResolutionSet;
    TW_FIX32            defaultYResolution;
87
} activeDS DECLSPEC_HIDDEN;
88 89

/* Helper functions */
90 91
extern TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action) DECLSPEC_HIDDEN;
extern TW_UINT16 SANE_SaneSetDefaults (void) DECLSPEC_HIDDEN;
92
extern void SANE_Notify (TW_UINT16 message) DECLSPEC_HIDDEN;
93 94 95

/* Implementation of operation triplets
 * From Application to Source (Control Information) */
96
TW_UINT16 SANE_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
97
TW_UINT16 SANE_CapabilityGetCurrent
98
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
99
TW_UINT16 SANE_CapabilityGetDefault
100
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
101
TW_UINT16 SANE_CapabilityQuerySupport
102
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
103
TW_UINT16 SANE_CapabilityReset
104
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
105
TW_UINT16 SANE_CapabilitySet
106
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
107
TW_UINT16 SANE_CustomDSDataGet
108
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
109
TW_UINT16 SANE_CustomDSDataSet
110
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
111
TW_UINT16 SANE_AutomaticCaptureDirectory
112
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
113
TW_UINT16 SANE_ChangeDirectory
114
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
115
TW_UINT16 SANE_FileSystemCopy
116
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
117
TW_UINT16 SANE_CreateDirectory
118
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
119
TW_UINT16 SANE_FileSystemDelete
120
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
121
TW_UINT16 SANE_FormatMedia
122
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
123
TW_UINT16 SANE_FileSystemGetClose
124
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
125
TW_UINT16 SANE_FileSystemGetFirstFile
126
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
127
TW_UINT16 SANE_FileSystemGetInfo
128
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
129
TW_UINT16 SANE_FileSystemGetNextFile
130
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
131
TW_UINT16 SANE_FileSystemRename
132
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
133
TW_UINT16 SANE_ProcessEvent
134
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
135
TW_UINT16 SANE_PassThrough
136
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
137
TW_UINT16 SANE_PendingXfersEndXfer
138
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
139
TW_UINT16 SANE_PendingXfersGet
140
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
141
TW_UINT16 SANE_PendingXfersReset
142
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
143
TW_UINT16 SANE_PendingXfersStopFeeder
144
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
145
TW_UINT16 SANE_SetupFileXferGet
146
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
147
TW_UINT16 SANE_SetupFileXferGetDefault
148
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
149
TW_UINT16 SANE_SetupFileXferReset
150
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
151
TW_UINT16 SANE_SetupFileXferSet
152
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
153
TW_UINT16 SANE_SetupFileXfer2Get
154
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
155
TW_UINT16 SANE_SetupFileXfer2GetDefault
156
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
157
TW_UINT16 SANE_SetupFileXfer2Reset
158
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
159
TW_UINT16 SANE_SetupFileXfer2Set
160
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
161
TW_UINT16 SANE_SetupMemXferGet
162
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
163
TW_UINT16 SANE_GetDSStatus
164
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
165
TW_UINT16 SANE_DisableDSUserInterface
166
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
167
TW_UINT16 SANE_EnableDSUserInterface
168
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
169
TW_UINT16 SANE_EnableDSUIOnly
170
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
171
TW_UINT16 SANE_XferGroupGet
172
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
173
TW_UINT16 SANE_XferGroupSet
174
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
175 176 177 178

/* Implementation of operation triplets
 * From Application to Source (Image Information) */
TW_UINT16 SANE_CIEColorGet
179
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
180
TW_UINT16 SANE_ExtImageInfoGet
181
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
182
TW_UINT16 SANE_GrayResponseReset
183
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
184
TW_UINT16 SANE_GrayResponseSet
185
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
186
TW_UINT16 SANE_ImageFileXferGet
187
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
188
TW_UINT16 SANE_ImageInfoGet
189
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
190
TW_UINT16 SANE_ImageLayoutGet
191
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
192
TW_UINT16 SANE_ImageLayoutGetDefault
193
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
194
TW_UINT16 SANE_ImageLayoutReset
195
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
196
TW_UINT16 SANE_ImageLayoutSet
197
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
198
TW_UINT16 SANE_ImageMemXferGet
199
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
200
TW_UINT16 SANE_ImageNativeXferGet
201
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
202
TW_UINT16 SANE_JPEGCompressionGet
203
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
204
TW_UINT16 SANE_JPEGCompressionGetDefault
205
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
206
TW_UINT16 SANE_JPEGCompressionReset
207
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
208
TW_UINT16 SANE_JPEGCompressionSet
209
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
210
TW_UINT16 SANE_Palette8Get
211
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
212
TW_UINT16 SANE_Palette8GetDefault
213
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
214
TW_UINT16 SANE_Palette8Reset
215
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
216
TW_UINT16 SANE_Palette8Set
217
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
218
TW_UINT16 SANE_RGBResponseReset
219
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
220
TW_UINT16 SANE_RGBResponseSet
221
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
222 223

/* UI function */
224 225
BOOL DoScannerUI(void) DECLSPEC_HIDDEN;
HWND ScanningDialogBox(HWND dialog, LONG progress) DECLSPEC_HIDDEN;
226

227 228
/* Option functions */
#ifdef SONAME_LIBSANE
229 230 231 232 233 234
SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val) DECLSPEC_HIDDEN;
SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status) DECLSPEC_HIDDEN;
SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status) DECLSPEC_HIDDEN;
SANE_Status sane_option_set_str(SANE_Handle h, const char *option_name, SANE_String val, SANE_Int *status) DECLSPEC_HIDDEN;
SANE_Status sane_option_probe_resolution(SANE_Handle h, const char *option_name, SANE_Int *minval, SANE_Int *maxval, SANE_Int *quant) DECLSPEC_HIDDEN;
SANE_Status sane_option_probe_mode(SANE_Handle h, SANE_String_Const **choices, char *current, int current_size) DECLSPEC_HIDDEN;
235
SANE_Status sane_option_probe_scan_area(SANE_Handle h, const char *option_name, SANE_Fixed *val,
236 237 238 239 240 241
                                        SANE_Unit *unit, SANE_Fixed *min, SANE_Fixed *max, SANE_Fixed *quant) DECLSPEC_HIDDEN;
SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bool *val, SANE_Int *status) DECLSPEC_HIDDEN;
SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bool val, SANE_Int *status) DECLSPEC_HIDDEN;
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status) DECLSPEC_HIDDEN;
TW_UINT16 sane_status_to_twcc(SANE_Status rc) DECLSPEC_HIDDEN;
BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype) DECLSPEC_HIDDEN;
242 243 244
#endif


245
#endif