Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef __TTWAIN_H__
Toshihiro Shimizu 890ddd
#define __TTWAIN_H__
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
#include <windows.h></windows.h>
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#ifndef _UNIX_
Toshihiro Shimizu 890ddd
#define _UNIX_
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "twain.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tnztypes.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TRUE
Toshihiro Shimizu 890ddd
#define TRUE 1
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef FALSE
Toshihiro Shimizu 890ddd
#define FALSE 0
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef UCHAR
Toshihiro Shimizu 890ddd
#define UCHAR unsigned char
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef USHORT
Toshihiro Shimizu 890ddd
#define USHORT unsigned short
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TTWAIN_PIXTYPE {
Shinya Kitaoka 120a6e
  TTWAIN_BW,    /* 1-bit per pixel, B&W     */
Shinya Kitaoka 120a6e
  TTWAIN_WB,    /* 1-bit per pixel, W&B     */
Shinya Kitaoka 120a6e
  TTWAIN_GRAY8, /* 1,4, or 8-bit grayscale  */
Shinya Kitaoka 120a6e
  TTWAIN_RGB24, /* 24-bit RGB color         */
Shinya Kitaoka 120a6e
  TTWAIN_PIXTYPE_HOWMANY,
Shinya Kitaoka 120a6e
  TTWAIN_PIXUNKNOWN = -1,
Toshihiro Shimizu 890ddd
} TTWAIN_PIXTYPE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TTWAIN_BITORDER {
Shinya Kitaoka 120a6e
  TTWAIN_LSBFIRST = TWBO_LSBFIRST,
Shinya Kitaoka 120a6e
  TTWAIN_MSBFIRST = TWBO_MSBFIRST
Toshihiro Shimizu 890ddd
} TTWAIN_BITORDER;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TWAINAVAILABLE {
Shinya Kitaoka 120a6e
  AVAIABLE_DONTKNOW = -1,
Shinya Kitaoka 120a6e
  AVAIABLE_YES,
Shinya Kitaoka 120a6e
  AVAIABLE_NO
Toshihiro Shimizu 890ddd
} TWAINAVAILABLE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TTWAIN_TRANSFER_MECH {
Shinya Kitaoka 120a6e
  TTWAIN_TRANSFERMODE_NATIVE = TWSX_NATIVE,
Shinya Kitaoka 120a6e
  TTWAIN_TRANSFERMODE_MEMORY = TWSX_MEMORY,
Shinya Kitaoka 120a6e
  TTWAIN_TRANSFERMODE_FILE   = TWSX_FILE
Toshihiro Shimizu 890ddd
} TTWAIN_TRANSFER_MECH;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TTWAIN_USAGE_MODE {
Shinya Kitaoka 120a6e
  TTWAIN_MODE_LEASHED,
Shinya Kitaoka 120a6e
  TTWAIN_MODE_UNLEASHED
Toshihiro Shimizu 890ddd
} TTWAIN_USAGE_MODE;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
/* application should return 0 to stop the scanning process, any other value
Shinya Kitaoka 120a6e
 * elsewhere */
Shinya Kitaoka 120a6e
typedef int TTWAIN_ONDONE_CB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx,
Shinya Kitaoka 120a6e
                             int ly, int wrap, float xdpi, float ydpi,
Shinya Kitaoka 120a6e
                             void *usrData);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef void TTWAIN_ONERROR_CB(void *usrData, void *alwaysZero);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int TTWAIN_IsAvailable(void);
Campbell Barton 9c30a0
void TTWAIN_RegisterApp(
Shinya Kitaoka 120a6e
    int majorNum, int minorNum, /* app. revision*/
Shinya Kitaoka 120a6e
    int nLanguage,    /* (human) language (use TWLG_xxx from TWAIN.H) */
Shinya Kitaoka 120a6e
    int nCountry,     /* country (use TWCY_xxx from TWAIN.H)	     */
Shinya Kitaoka 120a6e
    char *version,    /* version info string                          */
Shinya Kitaoka 120a6e
    char *manufacter, /* name of manufacter			     */
Shinya Kitaoka 120a6e
    char *family,     /* product family				     */
Shinya Kitaoka 120a6e
    char *product);   /* specific product			     */
Toshihiro Shimizu 890ddd
int TTWAIN_SelectImageSource(void *hwnd);
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
void *TTWAIN_AcquireNative(void *hwnd);
Toshihiro Shimizu 890ddd
int TTWAIN_AcquireMemory(void *hwnd);
Toshihiro Shimizu 890ddd
void TTWAIN_StopAcquire(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
nb. AcquireMemory returns: an upside-down bitmap :)
Shinya Kitaoka 120a6e
nb. AcquireNative returns:
Shinya Kitaoka 120a6e
                          under Windows an HBITMAP
Shinya Kitaoka 120a6e
                          under Mac     a  PICT
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
void TTWAIN_SetTwainUsage(TTWAIN_USAGE_MODE um);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void TTWAIN_FreeMemory(void *hMem);
Toshihiro Shimizu 890ddd
int TTWAIN_CloseAll(void *hwnd);
Toshihiro Shimizu 890ddd
int TTWAIN_OpenSourceManager(void *hwnd);
Toshihiro Shimizu 890ddd
int TTWAIN_OpenDefaultSource(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int TTWAIN_GetHideUI(void);
Toshihiro Shimizu 890ddd
void TTWAIN_SetHideUI(int flag);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void TTWAIN_SetOnDoneCallback(TTWAIN_ONDONE_CB *proc, void *arg);
Toshihiro Shimizu 890ddd
void TTWAIN_SetOnErrorCallback(TTWAIN_ONERROR_CB *proc, void *arg);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif