2 * Copyright 2000 Corel Corporation
3 * Copyright 2006 Marcus Meissner
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifndef __WINE_CONFIG_H
24 # error You must include config.h first
27 #if defined(HAVE_GPHOTO2) && !defined(SONAME_LIBJPEG)
28 # warning "gphoto2 support in twain needs jpeg development headers"
33 /* Hack for gphoto2, which changes behaviour when WIN32 is set. */
35 #include <gphoto2/gphoto2-camera.h>
42 /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
44 # define UINT8 JPEG_UINT8
45 # define UINT16 JPEG_UINT16
57 #include "wine/list.h"
59 extern HINSTANCE GPHOTO2_instance;
66 BOOL download; /* flag for downloading, set by GUI or so */
69 /* internal information about an active data source */
72 TW_IDENTITY identity; /* identity */
73 TW_UINT16 currentState; /* current state */
74 TW_EVENT pendingEvent; /* pending event to be sent to
76 TW_UINT16 twCC; /* condition code */
77 HWND hwndOwner; /* window handle of the app */
78 HWND progressWnd; /* window handle of the scanning window */
86 TW_UINT32 capXferMech; /* ICAP_XFERMECH */
87 TW_UINT16 pixeltype; /* ICAP_PIXELTYPE */
88 TW_UINT16 pixelflavor; /* ICAP_PIXELFLAVOR */
92 /* Download and decode JPEG STATE */
97 struct jpeg_source_mgr xjsm;
98 struct jpeg_decompress_struct jd;
99 struct jpeg_error_mgr jerr;
103 /* Helper functions */
104 extern TW_UINT16 GPHOTO2_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action);
107 extern TW_UINT16 GPHOTO2_ControlGroupHandler (
108 pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
109 extern TW_UINT16 GPHOTO2_ImageGroupHandler (
110 pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
111 extern TW_UINT16 GPHOTO2_AudioGroupHandler (
112 pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
113 extern TW_UINT16 GPHOTO2_SourceManagerHandler (
114 pTW_IDENTITY pOrigin, TW_UINT16 DAT, TW_UINT16 MSG, TW_MEMREF pData);
116 /* Implementation of operation triplets
117 * From Application to Source (Control Information) */
118 TW_UINT16 GPHOTO2_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData);
119 TW_UINT16 GPHOTO2_CapabilityGetCurrent
120 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
121 TW_UINT16 GPHOTO2_CapabilityGetDefault
122 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
123 TW_UINT16 GPHOTO2_CapabilityQuerySupport
124 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
125 TW_UINT16 GPHOTO2_CapabilityReset
126 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
127 TW_UINT16 GPHOTO2_CapabilitySet
128 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
129 TW_UINT16 GPHOTO2_CustomDSDataGet
130 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
131 TW_UINT16 GPHOTO2_CustomDSDataSet
132 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
133 TW_UINT16 GPHOTO2_AutomaticCaptureDirectory
134 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
135 TW_UINT16 GPHOTO2_ChangeDirectory
136 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
137 TW_UINT16 GPHOTO2_FileSystemCopy
138 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
139 TW_UINT16 GPHOTO2_CreateDirectory
140 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
141 TW_UINT16 GPHOTO2_FileSystemDelete
142 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
143 TW_UINT16 GPHOTO2_FormatMedia
144 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
145 TW_UINT16 GPHOTO2_FileSystemGetClose
146 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
147 TW_UINT16 GPHOTO2_FileSystemGetFirstFile
148 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
149 TW_UINT16 GPHOTO2_FileSystemGetInfo
150 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
151 TW_UINT16 GPHOTO2_FileSystemGetNextFile
152 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
153 TW_UINT16 GPHOTO2_FileSystemRename
154 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
155 TW_UINT16 GPHOTO2_ProcessEvent
156 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
157 TW_UINT16 GPHOTO2_PassThrough
158 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
159 TW_UINT16 GPHOTO2_PendingXfersEndXfer
160 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
161 TW_UINT16 GPHOTO2_PendingXfersGet
162 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
163 TW_UINT16 GPHOTO2_PendingXfersReset
164 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
165 TW_UINT16 GPHOTO2_PendingXfersStopFeeder
166 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
167 TW_UINT16 GPHOTO2_SetupFileXferGet
168 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
169 TW_UINT16 GPHOTO2_SetupFileXferGetDefault
170 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
171 TW_UINT16 GPHOTO2_SetupFileXferReset
172 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
173 TW_UINT16 GPHOTO2_SetupFileXferSet
174 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
175 TW_UINT16 GPHOTO2_SetupFileXfer2Get
176 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
177 TW_UINT16 GPHOTO2_SetupFileXfer2GetDefault
178 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
179 TW_UINT16 GPHOTO2_SetupFileXfer2Reset
180 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
181 TW_UINT16 GPHOTO2_SetupFileXfer2Set
182 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
183 TW_UINT16 GPHOTO2_SetupMemXferGet
184 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
185 TW_UINT16 GPHOTO2_GetDSStatus
186 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
187 TW_UINT16 GPHOTO2_DisableDSUserInterface
188 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
189 TW_UINT16 GPHOTO2_EnableDSUserInterface
190 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
191 TW_UINT16 GPHOTO2_EnableDSUIOnly
192 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
193 TW_UINT16 GPHOTO2_XferGroupGet
194 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
195 TW_UINT16 GPHOTO2_XferGroupSet
196 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
198 /* Implementation of operation triplets
199 * From Application to Source (Image Information) */
200 TW_UINT16 GPHOTO2_CIEColorGet
201 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
202 TW_UINT16 GPHOTO2_ExtImageInfoGet
203 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
204 TW_UINT16 GPHOTO2_GrayResponseReset
205 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
206 TW_UINT16 GPHOTO2_GrayResponseSet
207 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
208 TW_UINT16 GPHOTO2_ImageFileXferGet
209 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
210 TW_UINT16 GPHOTO2_ImageInfoGet
211 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
212 TW_UINT16 GPHOTO2_ImageLayoutGet
213 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
214 TW_UINT16 GPHOTO2_ImageLayoutGetDefault
215 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
216 TW_UINT16 GPHOTO2_ImageLayoutReset
217 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
218 TW_UINT16 GPHOTO2_ImageLayoutSet
219 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
220 TW_UINT16 GPHOTO2_ImageMemXferGet
221 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
222 TW_UINT16 GPHOTO2_ImageNativeXferGet
223 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
224 TW_UINT16 GPHOTO2_JPEGCompressionGet
225 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
226 TW_UINT16 GPHOTO2_JPEGCompressionGetDefault
227 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
228 TW_UINT16 GPHOTO2_JPEGCompressionReset
229 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
230 TW_UINT16 GPHOTO2_JPEGCompressionSet
231 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
232 TW_UINT16 GPHOTO2_Palette8Get
233 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
234 TW_UINT16 GPHOTO2_Palette8GetDefault
235 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
236 TW_UINT16 GPHOTO2_Palette8Reset
237 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
238 TW_UINT16 GPHOTO2_Palette8Set
239 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
240 TW_UINT16 GPHOTO2_RGBResponseReset
241 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
242 TW_UINT16 GPHOTO2_RGBResponseSet
243 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
246 BOOL DoCameraUI(void);
247 HWND TransferringDialogBox(HWND dialog, DWORD progress);
250 /* Helper function for GUI */
252 _get_gphoto2_file_as_DIB(
253 const char *folder, const char *filename, CameraFileType type,
254 HWND hwnd, HBITMAP *hDIB