tahoma2d/toonz/sources/common/twain/ttwain.h

117 lines
2.9 KiB
C
Raw Normal View History

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