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(HAVE_JPEGLIB_H)
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
49 # ifndef SONAME_LIBJPEG
50 # define SONAME_LIBJPEG "libjpeg.so"
60 #include "wine/list.h"
62 extern HINSTANCE GPHOTO2_instance
;
69 BOOL download
; /* flag for downloading, set by GUI or so */
72 /* internal information about an active data source */
75 TW_IDENTITY identity
; /* identity */
76 TW_UINT16 currentState
; /* current state */
77 TW_EVENT pendingEvent
; /* pending event to be sent to
79 TW_UINT16 twCC
; /* condition code */
80 HWND hwndOwner
; /* window handle of the app */
81 HWND progressWnd
; /* window handle of the scanning window */
89 TW_UINT32 capXferMech
; /* ICAP_XFERMECH */
90 TW_UINT16 pixeltype
; /* ICAP_PIXELTYPE */
91 TW_UINT16 pixelflavor
; /* ICAP_PIXELFLAVOR */
95 /* Download and decode JPEG STATE */
100 struct jpeg_source_mgr xjsm
;
101 struct jpeg_decompress_struct jd
;
102 struct jpeg_error_mgr jerr
;
106 /* Helper functions */
107 extern TW_UINT16
GPHOTO2_SaneCapability (pTW_CAPABILITY pCapability
, TW_UINT16 action
);
110 extern TW_UINT16
GPHOTO2_ControlGroupHandler (
111 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
112 extern TW_UINT16
GPHOTO2_ImageGroupHandler (
113 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
114 extern TW_UINT16
GPHOTO2_AudioGroupHandler (
115 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
116 extern TW_UINT16
GPHOTO2_SourceManagerHandler (
117 pTW_IDENTITY pOrigin
, TW_UINT16 DAT
, TW_UINT16 MSG
, TW_MEMREF pData
);
119 /* Implementation of operation triplets
120 * From Application to Source (Control Information) */
121 TW_UINT16
GPHOTO2_CapabilityGet (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
122 TW_UINT16 GPHOTO2_CapabilityGetCurrent
123 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
124 TW_UINT16 GPHOTO2_CapabilityGetDefault
125 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
126 TW_UINT16 GPHOTO2_CapabilityQuerySupport
127 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
128 TW_UINT16 GPHOTO2_CapabilityReset
129 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
130 TW_UINT16 GPHOTO2_CapabilitySet
131 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
132 TW_UINT16 GPHOTO2_CustomDSDataGet
133 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
134 TW_UINT16 GPHOTO2_CustomDSDataSet
135 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
136 TW_UINT16 GPHOTO2_AutomaticCaptureDirectory
137 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
138 TW_UINT16 GPHOTO2_ChangeDirectory
139 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
140 TW_UINT16 GPHOTO2_FileSystemCopy
141 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
142 TW_UINT16 GPHOTO2_CreateDirectory
143 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
144 TW_UINT16 GPHOTO2_FileSystemDelete
145 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
146 TW_UINT16 GPHOTO2_FormatMedia
147 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
148 TW_UINT16 GPHOTO2_FileSystemGetClose
149 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
150 TW_UINT16 GPHOTO2_FileSystemGetFirstFile
151 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
152 TW_UINT16 GPHOTO2_FileSystemGetInfo
153 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
154 TW_UINT16 GPHOTO2_FileSystemGetNextFile
155 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
156 TW_UINT16 GPHOTO2_FileSystemRename
157 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
158 TW_UINT16 GPHOTO2_ProcessEvent
159 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
160 TW_UINT16 GPHOTO2_PassThrough
161 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
162 TW_UINT16 GPHOTO2_PendingXfersEndXfer
163 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
164 TW_UINT16 GPHOTO2_PendingXfersGet
165 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
166 TW_UINT16 GPHOTO2_PendingXfersReset
167 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
168 TW_UINT16 GPHOTO2_PendingXfersStopFeeder
169 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
170 TW_UINT16 GPHOTO2_SetupFileXferGet
171 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
172 TW_UINT16 GPHOTO2_SetupFileXferGetDefault
173 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
174 TW_UINT16 GPHOTO2_SetupFileXferReset
175 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
176 TW_UINT16 GPHOTO2_SetupFileXferSet
177 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
178 TW_UINT16 GPHOTO2_SetupFileXfer2Get
179 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
180 TW_UINT16 GPHOTO2_SetupFileXfer2GetDefault
181 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
182 TW_UINT16 GPHOTO2_SetupFileXfer2Reset
183 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
184 TW_UINT16 GPHOTO2_SetupFileXfer2Set
185 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
186 TW_UINT16 GPHOTO2_SetupMemXferGet
187 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
188 TW_UINT16 GPHOTO2_GetDSStatus
189 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
190 TW_UINT16 GPHOTO2_DisableDSUserInterface
191 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
192 TW_UINT16 GPHOTO2_EnableDSUserInterface
193 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
194 TW_UINT16 GPHOTO2_EnableDSUIOnly
195 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
196 TW_UINT16 GPHOTO2_XferGroupGet
197 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
198 TW_UINT16 GPHOTO2_XferGroupSet
199 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
201 /* Implementation of operation triplets
202 * From Application to Source (Image Information) */
203 TW_UINT16 GPHOTO2_CIEColorGet
204 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
205 TW_UINT16 GPHOTO2_ExtImageInfoGet
206 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
207 TW_UINT16 GPHOTO2_GrayResponseReset
208 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
209 TW_UINT16 GPHOTO2_GrayResponseSet
210 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
211 TW_UINT16 GPHOTO2_ImageFileXferGet
212 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
213 TW_UINT16 GPHOTO2_ImageInfoGet
214 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
215 TW_UINT16 GPHOTO2_ImageLayoutGet
216 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
217 TW_UINT16 GPHOTO2_ImageLayoutGetDefault
218 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
219 TW_UINT16 GPHOTO2_ImageLayoutReset
220 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
221 TW_UINT16 GPHOTO2_ImageLayoutSet
222 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
223 TW_UINT16 GPHOTO2_ImageMemXferGet
224 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
225 TW_UINT16 GPHOTO2_ImageNativeXferGet
226 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
227 TW_UINT16 GPHOTO2_JPEGCompressionGet
228 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
229 TW_UINT16 GPHOTO2_JPEGCompressionGetDefault
230 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
231 TW_UINT16 GPHOTO2_JPEGCompressionReset
232 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
233 TW_UINT16 GPHOTO2_JPEGCompressionSet
234 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
235 TW_UINT16 GPHOTO2_Palette8Get
236 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
237 TW_UINT16 GPHOTO2_Palette8GetDefault
238 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
239 TW_UINT16 GPHOTO2_Palette8Reset
240 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
241 TW_UINT16 GPHOTO2_Palette8Set
242 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
243 TW_UINT16 GPHOTO2_RGBResponseReset
244 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
245 TW_UINT16 GPHOTO2_RGBResponseSet
246 (pTW_IDENTITY pOrigin
, TW_MEMREF pData
);
249 BOOL
DoCameraUI(void);
250 HWND
TransferringDialogBox(HWND dialog
, DWORD progress
);
253 /* Helper function for GUI */
255 _get_gphoto2_file_as_DIB(
256 const char *folder
, const char *filename
, CameraFileType type
,
257 HWND hwnd
, HBITMAP
*hDIB