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 {
Toshihiro Shimizu 890ddd
	TTWAIN_BW,	/* 1-bit per pixel, B&W     */
Toshihiro Shimizu 890ddd
	TTWAIN_WB,	/* 1-bit per pixel, W&B     */
Toshihiro Shimizu 890ddd
	TTWAIN_GRAY8, /* 1,4, or 8-bit grayscale  */
Toshihiro Shimizu 890ddd
	TTWAIN_RGB24, /* 24-bit RGB color         */
Toshihiro Shimizu 890ddd
	TTWAIN_PIXTYPE_HOWMANY,
Toshihiro Shimizu 890ddd
	TTWAIN_PIXUNKNOWN = -1,
Toshihiro Shimizu 890ddd
} TTWAIN_PIXTYPE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TTWAIN_BITORDER {
Toshihiro Shimizu 890ddd
	TTWAIN_LSBFIRST = TWBO_LSBFIRST,
Toshihiro Shimizu 890ddd
	TTWAIN_MSBFIRST = TWBO_MSBFIRST
Toshihiro Shimizu 890ddd
} TTWAIN_BITORDER;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TWAINAVAILABLE {
Toshihiro Shimizu 890ddd
	AVAIABLE_DONTKNOW = -1,
Toshihiro Shimizu 890ddd
	AVAIABLE_YES,
Toshihiro Shimizu 890ddd
	AVAIABLE_NO
Toshihiro Shimizu 890ddd
} TWAINAVAILABLE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TTWAIN_TRANSFER_MECH {
Toshihiro Shimizu 890ddd
	TTWAIN_TRANSFERMODE_NATIVE = TWSX_NATIVE,
Toshihiro Shimizu 890ddd
	TTWAIN_TRANSFERMODE_MEMORY = TWSX_MEMORY,
Toshihiro Shimizu 890ddd
	TTWAIN_TRANSFERMODE_FILE = TWSX_FILE
Toshihiro Shimizu 890ddd
} TTWAIN_TRANSFER_MECH;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TTWAIN_USAGE_MODE {
Toshihiro Shimizu 890ddd
	TTWAIN_MODE_LEASHED,
Toshihiro Shimizu 890ddd
	TTWAIN_MODE_UNLEASHED
Toshihiro Shimizu 890ddd
} TTWAIN_USAGE_MODE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/* application should return 0 to stop the scanning process, any other value elsewhere */
Toshihiro Shimizu 890ddd
typedef int TTWAIN_ONDONE_CB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType,
Toshihiro Shimizu 890ddd
							 int lx, int ly, int wrap,
Toshihiro Shimizu 890ddd
							 float xdpi, float ydpi,
Toshihiro Shimizu 890ddd
							 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);
Toshihiro Shimizu 890ddd
void TWAIN_RegisterApp(int majorNum, int minorNum, /* app. revision*/
Toshihiro Shimizu 890ddd
					   int nLanguage,			   /* (human) language (use TWLG_xxx from TWAIN.H) */
Toshihiro Shimizu 890ddd
					   int nCountry,			   /* country (use TWCY_xxx from TWAIN.H)	     */
Toshihiro Shimizu 890ddd
					   char *version,			   /* version info string                          */
Toshihiro Shimizu 890ddd
					   char *manufacter,		   /* name of manufacter			     */
Toshihiro Shimizu 890ddd
					   char *family,			   /* product family				     */
Toshihiro Shimizu 890ddd
					   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 :)
Toshihiro Shimizu 890ddd
nb. AcquireNative returns: 
Toshihiro Shimizu 890ddd
			  under Windows an HBITMAP
Toshihiro Shimizu 890ddd
			  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