gphoto2_i.h 5.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * Copyright 2000 Corel Corporation
 * Copyright 2006 Marcus Meissner
 *
 * 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
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 19 20 21 22 23 24 25 26
 */

#ifndef _TWAIN32_H
#define _TWAIN32_H

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

27
#if defined(HAVE_GPHOTO2) && !defined(SONAME_LIBJPEG)
28
# warning "gphoto2 support in twain needs jpeg development headers"
29 30 31 32
# undef HAVE_GPHOTO2
#endif

#ifdef HAVE_GPHOTO2
33
/* Hack for gphoto2, which changes behaviour when WIN32 is set. */
34 35 36 37 38 39 40
#undef WIN32
#include <gphoto2/gphoto2-camera.h>
#define WIN32
#endif

#include <stdio.h>

41
#ifdef SONAME_LIBJPEG
42 43 44 45 46
/* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
# define XMD_H
# define UINT8 JPEG_UINT8
# define UINT16 JPEG_UINT16
# undef FAR
47
# undef HAVE_STDLIB_H
48
#  include <jpeglib.h>
49 50
# undef HAVE_STDLIB_H
# define HAVE_STDLIB_H 1
51
# undef UINT8
52 53 54 55 56 57 58 59 60 61 62
# undef UINT16
#endif

#include <stdarg.h>

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

#include "wine/list.h"

63
extern HINSTANCE GPHOTO2_instance DECLSPEC_HIDDEN;
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

struct gphoto2_file  {
    struct list entry;

    char	*folder;
    char	*filename;
    BOOL	download;	/* flag for downloading, set by GUI or so */
};

/* internal information about an active data source */
struct tagActiveDS
{
    TW_IDENTITY		identity;		/* identity */
    TW_UINT16		currentState;		/* current state */
    TW_EVENT		pendingEvent;		/* pending event to be sent to
                                                   application */
    TW_UINT16		twCC;			/* condition code */
    HWND		hwndOwner;		/* window handle of the app */
    HWND		progressWnd;		/* window handle of the scanning window */

#ifdef HAVE_GPHOTO2
    Camera		*camera;
    GPContext		*context;
#endif

Austin English's avatar
Austin English committed
89
    /* Capabilities */
90 91 92 93 94 95 96 97 98 99
    TW_UINT32		capXferMech;		/* ICAP_XFERMECH */
    TW_UINT16		pixeltype;		/* ICAP_PIXELTYPE */
    TW_UINT16		pixelflavor;		/* ICAP_PIXELFLAVOR */

    struct list 	files;

    /* Download and decode JPEG STATE */
#ifdef HAVE_GPHOTO2
    CameraFile				*file;
#endif
100
#ifdef SONAME_LIBJPEG
101 102 103 104
    struct jpeg_source_mgr		xjsm;
    struct jpeg_decompress_struct	jd;
    struct jpeg_error_mgr		jerr;
#endif
105
} activeDS DECLSPEC_HIDDEN;
106 107

/* Helper functions */
108
extern TW_UINT16 GPHOTO2_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action) DECLSPEC_HIDDEN;
109 110 111 112

/* Implementation of operation triplets
 * From Application to Source (Image Information) */
TW_UINT16 GPHOTO2_CIEColorGet
113
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
114
TW_UINT16 GPHOTO2_ExtImageInfoGet
115
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
116
TW_UINT16 GPHOTO2_GrayResponseReset
117
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
118
TW_UINT16 GPHOTO2_GrayResponseSet
119
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
120
TW_UINT16 GPHOTO2_ImageFileXferGet
121
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
122
TW_UINT16 GPHOTO2_ImageInfoGet
123
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
124
TW_UINT16 GPHOTO2_ImageLayoutGet
125
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
126
TW_UINT16 GPHOTO2_ImageLayoutGetDefault
127
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
128
TW_UINT16 GPHOTO2_ImageLayoutReset
129
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
130
TW_UINT16 GPHOTO2_ImageLayoutSet
131
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
132
TW_UINT16 GPHOTO2_ImageMemXferGet
133
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
134
TW_UINT16 GPHOTO2_ImageNativeXferGet
135
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
136
TW_UINT16 GPHOTO2_JPEGCompressionGet
137
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
138
TW_UINT16 GPHOTO2_JPEGCompressionGetDefault
139
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
140
TW_UINT16 GPHOTO2_JPEGCompressionReset
141
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
142
TW_UINT16 GPHOTO2_JPEGCompressionSet
143
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
144
TW_UINT16 GPHOTO2_Palette8Get
145
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
146
TW_UINT16 GPHOTO2_Palette8GetDefault
147
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
148
TW_UINT16 GPHOTO2_Palette8Reset
149
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
150
TW_UINT16 GPHOTO2_Palette8Set
151
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
152
TW_UINT16 GPHOTO2_RGBResponseReset
153
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
154
TW_UINT16 GPHOTO2_RGBResponseSet
155
    (pTW_IDENTITY pOrigin, TW_MEMREF pData) DECLSPEC_HIDDEN;
156 157

/* UI function */
158 159
BOOL DoCameraUI(void) DECLSPEC_HIDDEN;
HWND TransferringDialogBox(HWND dialog, LONG progress) DECLSPEC_HIDDEN;
160 161 162 163 164 165 166

#ifdef HAVE_GPHOTO2
/* Helper function for GUI */
TW_UINT16
_get_gphoto2_file_as_DIB(
        const char *folder, const char *filename, CameraFileType type,
        HWND hwnd, HBITMAP *hDIB
167
) DECLSPEC_HIDDEN;
168 169
#endif
#endif