/* Flags used in TW_MEMORY structure. */
#define TWMF_APPOWNS     0x1
#define TWMF_DSMOWNS     0x2
#define TWMF_DSOWNS      0x4
#define TWMF_POINTER     0x8
#define TWMF_HANDLE      0x10

/* Palette types for TW_PALETTE8 */
#define TWPA_RGB         0
#define TWPA_GRAY        1
#define TWPA_CMY         2

/* ICAP_IMAGEFILEFORMAT values (FF_means File Format)   */
#define TWFF_TIFF        0    /* Tagged Image File Format     */
#define TWFF_PICT        1    /* Macintosh PICT               */
#define TWFF_BMP         2    /* Windows Bitmap               */
#define TWFF_XBM         3    /* X-Windows Bitmap             */
#define TWFF_JFIF        4    /* JPEG File Interchange Format */
#define TWFF_FPX         5    /* Flash Pix                    */
#define TWFF_TIFFMULTI   6    /* Multi-page tiff file         */
#define TWFF_PNG         7
#define TWFF_SPIFF       8
#define TWFF_EXIF        9

/****************************************************************************
 * Country Constants                                                        *
 ****************************************************************************/

#define TWCY_AFGHANISTAN   1001
#define TWCY_ALGERIA        213
#define TWCY_AMERICANSAMOA  684
#define TWCY_ANDORRA        033
#define TWCY_ANGOLA        1002
#define TWCY_ANGUILLA      8090
#define TWCY_ANTIGUA       8091
#define TWCY_ARGENTINA       54
#define TWCY_ARUBA          297
#define TWCY_ASCENSIONI     247
#define TWCY_AUSTRALIA       61
#define TWCY_AUSTRIA         43
#define TWCY_BAHAMAS       8092
#define TWCY_BAHRAIN        973
#define TWCY_BANGLADESH     880
#define TWCY_BARBADOS      8093
#define TWCY_BELGIUM         32
#define TWCY_BELIZE         501
#define TWCY_BENIN          229
#define TWCY_BERMUDA       8094
#define TWCY_BHUTAN        1003
#define TWCY_BOLIVIA        591
#define TWCY_BOTSWANA       267
#define TWCY_BRITAIN          6
#define TWCY_BRITVIRGINIS  8095
#define TWCY_BRAZIL          55
#define TWCY_BRUNEI         673
#define TWCY_BULGARIA       359
#define TWCY_BURKINAFASO   1004
#define TWCY_BURMA         1005
#define TWCY_BURUNDI       1006
#define TWCY_CAMAROON       237
#define TWCY_CANADA           2
#define TWCY_CAPEVERDEIS    238
#define TWCY_CAYMANIS      8096
#define TWCY_CENTRALAFREP  1007
#define TWCY_CHAD          1008
#define TWCY_CHILE           56
#define TWCY_CHINA           86
#define TWCY_CHRISTMASIS   1009
#define TWCY_COCOSIS       1009
#define TWCY_COLOMBIA        57
#define TWCY_COMOROS       1010
#define TWCY_CONGO         1011
#define TWCY_COOKIS        1012
#define TWCY_COSTARICA     506
#define TWCY_CUBA           005
#define TWCY_CYPRUS         357
#define TWCY_CZECHOSLOVAKIA  42
#define TWCY_DENMARK         45
#define TWCY_DJIBOUTI      1013
#define TWCY_DOMINICA      8097
#define TWCY_DOMINCANREP   8098
#define TWCY_EASTERIS      1014
#define TWCY_ECUADOR        593
#define TWCY_EGYPT           20
#define TWCY_ELSALVADOR     503
#define TWCY_EQGUINEA      1015
#define TWCY_ETHIOPIA       251
#define TWCY_FALKLANDIS    1016
#define TWCY_FAEROEIS       298
#define TWCY_FIJIISLANDS    679
#define TWCY_FINLAND        358
#define TWCY_FRANCE          33
#define TWCY_FRANTILLES     596
#define TWCY_FRGUIANA       594
#define TWCY_FRPOLYNEISA    689
#define TWCY_FUTANAIS      1043
#define TWCY_GABON          241
#define TWCY_GAMBIA         220
#define TWCY_GERMANY         49
#define TWCY_GHANA          233
#define TWCY_GIBRALTER      350
#define TWCY_GREECE          30
#define TWCY_GREENLAND      299
#define TWCY_GRENADA       8099
#define TWCY_GRENEDINES    8015
#define TWCY_GUADELOUPE     590
#define TWCY_GUAM           671
#define TWCY_GUANTANAMOBAY 5399
#define TWCY_GUATEMALA      502
#define TWCY_GUINEA         224
#define TWCY_GUINEABISSAU  1017
#define TWCY_GUYANA         592
#define TWCY_HAITI          509
#define TWCY_HONDURAS       504
#define TWCY_HONGKONG      852
#define TWCY_HUNGARY         36
#define TWCY_ICELAND        354
#define TWCY_INDIA           91
#define TWCY_INDONESIA       62
#define TWCY_IRAN            98
#define TWCY_IRAQ           964
#define TWCY_IRELAND        353
#define TWCY_ISRAEL         972
#define TWCY_ITALY           39
#define TWCY_IVORYCOAST    225
#define TWCY_JAMAICA       8010
#define TWCY_JAPAN           81
#define TWCY_JORDAN         962
#define TWCY_KENYA          254
#define TWCY_KIRIBATI      1018
#define TWCY_KOREA           82
#define TWCY_KUWAIT         965
#define TWCY_LAOS          1019
#define TWCY_LEBANON       1020
#define TWCY_LIBERIA        231
#define TWCY_LIBYA          218
#define TWCY_LIECHTENSTEIN   41
#define TWCY_LUXENBOURG     352
#define TWCY_MACAO          853
#define TWCY_MADAGASCAR    1021
#define TWCY_MALAWI         265
#define TWCY_MALAYSIA        60
#define TWCY_MALDIVES       960
#define TWCY_MALI          1022
#define TWCY_MALTA          356
#define TWCY_MARSHALLIS     692
#define TWCY_MAURITANIA    1023
#define TWCY_MAURITIUS      230
#define TWCY_MEXICO           3
#define TWCY_MICRONESIA     691
#define TWCY_MIQUELON       508
#define TWCY_MONACO          33
#define TWCY_MONGOLIA      1024
#define TWCY_MONTSERRAT    8011
#define TWCY_MOROCCO        212
#define TWCY_MOZAMBIQUE    1025
#define TWCY_NAMIBIA        264
#define TWCY_NAURU         1026
#define TWCY_NEPAL          977
#define TWCY_NETHERLANDS     31
#define TWCY_NETHANTILLES   599
#define TWCY_NEVIS         8012
#define TWCY_NEWCALEDONIA   687
#define TWCY_NEWZEALAND      64
#define TWCY_NICARAGUA      505
#define TWCY_NIGER          227
#define TWCY_NIGERIA        234
#define TWCY_NIUE          1027
#define TWCY_NORFOLKI      1028
#define TWCY_NORWAY          47
#define TWCY_OMAN           968
#define TWCY_PAKISTAN        92
#define TWCY_PALAU         1029
#define TWCY_PANAMA         507
#define TWCY_PARAGUAY       595
#define TWCY_PERU            51
#define TWCY_PHILLIPPINES    63
#define TWCY_PITCAIRNIS    1030
#define TWCY_PNEWGUINEA     675
#define TWCY_POLAND          48
#define TWCY_PORTUGAL       351
#define TWCY_QATAR          974
#define TWCY_REUNIONI      1031
#define TWCY_ROMANIA         40
#define TWCY_RWANDA         250
#define TWCY_SAIPAN         670
#define TWCY_SANMARINO       39
#define TWCY_SAOTOME       1033
#define TWCY_SAUDIARABIA    966
#define TWCY_SENEGAL        221
#define TWCY_SEYCHELLESIS  1034
#define TWCY_SIERRALEONE   1035
#define TWCY_SINGAPORE       65
#define TWCY_SOLOMONIS     1036
#define TWCY_SOMALI        1037
#define TWCY_SOUTHAFRICA    27
#define TWCY_SPAIN           34
#define TWCY_SRILANKA        94
#define TWCY_STHELENA      1032
#define TWCY_STKITTS       8013
#define TWCY_STLUCIA       8014
#define TWCY_STPIERRE       508
#define TWCY_STVINCENT     8015
#define TWCY_SUDAN         1038
#define TWCY_SURINAME       597
#define TWCY_SWAZILAND      268
#define TWCY_SWEDEN          46
#define TWCY_SWITZERLAND     41
#define TWCY_SYRIA         1039
#define TWCY_TAIWAN         886
#define TWCY_TANZANIA       255
#define TWCY_THAILAND        66
#define TWCY_TOBAGO        8016
#define TWCY_TOGO           228
#define TWCY_TONGAIS        676
#define TWCY_TRINIDAD      8016
#define TWCY_TUNISIA        216
#define TWCY_TURKEY          90
#define TWCY_TURKSCAICOS   8017
#define TWCY_TUVALU        1040
#define TWCY_UGANDA         256
#define TWCY_USSR             7
#define TWCY_UAEMIRATES     971
#define TWCY_UNITEDKINGDOM   44
#define TWCY_USA              1
#define TWCY_URUGUAY        598
#define TWCY_VANUATU       1041
#define TWCY_VATICANCITY     39
#define TWCY_VENEZUELA       58
#define TWCY_WAKE          1042
#define TWCY_WALLISIS      1043
#define TWCY_WESTERNSAHARA 1044
#define TWCY_WESTERNSAMOA  1045
#define TWCY_YEMEN         1046
#define TWCY_YUGOSLAVIA      38
#define TWCY_ZAIRE          243
#define TWCY_ZAMBIA         260
#define TWCY_ZIMBABWE       263
/* Added for 1.8 */
#define TWCY_ALBANIA        355
#define TWCY_ARMENIA        374
#define TWCY_AZERBAIJAN     994
#define TWCY_BELARUS        375
#define TWCY_BOSNIAHERZGO   387
#define TWCY_CAMBODIA       855
#define TWCY_CROATIA        385
#define TWCY_CZECHREPUBLIC  420
#define TWCY_DIEGOGARCIA    246
#define TWCY_ERITREA        291
#define TWCY_ESTONIA        372
#define TWCY_GEORGIA        995
#define TWCY_LATVIA         371
#define TWCY_LESOTHO        266
#define TWCY_LITHUANIA      370
#define TWCY_MACEDONIA      389
#define TWCY_MAYOTTEIS      269
#define TWCY_MOLDOVA        373
#define TWCY_MYANMAR        95
#define TWCY_NORTHKOREA     850
#define TWCY_PUERTORICO     787
#define TWCY_RUSSIA         7
#define TWCY_SERBIA         381
#define TWCY_SLOVAKIA       421
#define TWCY_SLOVENIA       386
#define TWCY_SOUTHKOREA     82
#define TWCY_UKRAINE        380
#define TWCY_USVIRGINIS     340
#define TWCY_VIETNAM        84

/****************************************************************************
 * Language Constants                                                       *
 ****************************************************************************/

#define TWLG_DAN              0 /* Danish                 */
#define TWLG_DUT              1 /* Dutch                  */
#define TWLG_ENG              2 /* International English  */
#define TWLG_FCF              3 /* French Canadian        */
#define TWLG_FIN              4 /* Finnish                */
#define TWLG_FRN              5 /* French                 */
#define TWLG_GER              6 /* German                 */
#define TWLG_ICE              7 /* Icelandic              */
#define TWLG_ITN              8 /* Italian                */
#define TWLG_NOR              9 /* Norwegian              */
#define TWLG_POR             10 /* Portuguese             */
#define TWLG_SPA             11 /* Spanish                */
#define TWLG_SWE             12 /* Swedish                */
#define TWLG_USA             13 /* U.S. English           */
/* Added for 1.8 */
#define TWLG_USERLOCALE           -1
#define TWLG_AFRIKAANS            14  
#define TWLG_ALBANIA              15
#define TWLG_ARABIC               16
#define TWLG_ARABIC_ALGERIA       17
#define TWLG_ARABIC_BAHRAIN       18
#define TWLG_ARABIC_EGYPT         19
#define TWLG_ARABIC_IRAQ          20
#define TWLG_ARABIC_JORDAN        21
#define TWLG_ARABIC_KUWAIT        22
#define TWLG_ARABIC_LEBANON       23
#define TWLG_ARABIC_LIBYA         24
#define TWLG_ARABIC_MOROCCO       25
#define TWLG_ARABIC_OMAN          26
#define TWLG_ARABIC_QATAR         27
#define TWLG_ARABIC_SAUDIARABIA   28
#define TWLG_ARABIC_SYRIA         29
#define TWLG_ARABIC_TUNISIA       30
#define TWLG_ARABIC_UAE           31 /* United Arabic Emirates */
#define TWLG_ARABIC_YEMEN         32
#define TWLG_BASQUE               33
#define TWLG_BYELORUSSIAN         34
#define TWLG_BULGARIAN            35
#define TWLG_CATALAN              36
#define TWLG_CHINESE              37
#define TWLG_CHINESE_HONGKONG     38
#define TWLG_CHINESE_PRC          39 /* People's Republic of China */
#define TWLG_CHINESE_SINGAPORE    40
#define TWLG_CHINESE_SIMPLIFIED   41
#define TWLG_CHINESE_TAIWAN       42
#define TWLG_CHINESE_TRADITIONAL  43
#define TWLG_CROATIA              44
#define TWLG_CZECH                45
#define TWLG_DANISH               TWLG_DAN
#define TWLG_DUTCH                TWLG_DUT
#define TWLG_DUTCH_BELGIAN        46
#define TWLG_ENGLISH              TWLG_ENG
#define TWLG_ENGLISH_AUSTRALIAN   47
#define TWLG_ENGLISH_CANADIAN     48
#define TWLG_ENGLISH_IRELAND      49
#define TWLG_ENGLISH_NEWZEALAND   50
#define TWLG_ENGLISH_SOUTHAFRICA  51
#define TWLG_ENGLISH_UK           52
#define TWLG_ENGLISH_USA          TWLG_USA
#define TWLG_ESTONIAN             53
#define TWLG_FAEROESE             54
#define TWLG_FARSI                55
#define TWLG_FINNISH              TWLG_FIN
#define TWLG_FRENCH               TWLG_FRN
#define TWLG_FRENCH_BELGIAN       56
#define TWLG_FRENCH_CANADIAN      TWLG_FCF
#define TWLG_FRENCH_LUXEMBOURG    57
#define TWLG_FRENCH_SWISS         58
#define TWLG_GERMAN               TWLG_GER
#define TWLG_GERMAN_AUSTRIAN      59
#define TWLG_GERMAN_LUXEMBOURG    60
#define TWLG_GERMAN_LIECHTENSTEIN 61
#define TWLG_GERMAN_SWISS         62
#define TWLG_GREEK                63
#define TWLG_HEBREW               64
#define TWLG_HUNGARIAN            65
#define TWLG_ICELANDIC            TWLG_ICE
#define TWLG_INDONESIAN           66
#define TWLG_ITALIAN              TWLG_ITN
#define TWLG_ITALIAN_SWISS        67
#define TWLG_JAPANESE             68
#define TWLG_KOREAN               69
#define TWLG_KOREAN_JOHAB         70
#define TWLG_LATVIAN              71
#define TWLG_LITHUANIAN           72
#define TWLG_NORWEGIAN            TWLG_NOR
#define TWLG_NORWEGIAN_BOKMAL     73
#define TWLG_NORWEGIAN_NYNORSK    74
#define TWLG_POLISH               75
#define TWLG_PORTUGUESE           TWLG_POR
#define TWLG_PORTUGUESE_BRAZIL    76
#define TWLG_ROMANIAN             77
#define TWLG_RUSSIAN              78
#define TWLG_SERBIAN_LATIN        79
#define TWLG_SLOVAK               80
#define TWLG_SLOVENIAN            81
#define TWLG_SPANISH              TWLG_SPA
#define TWLG_SPANISH_MEXICAN      82
#define TWLG_SPANISH_MODERN       83
#define TWLG_SWEDISH              TWLG_SWE
#define TWLG_THAI                 84
#define TWLG_TURKISH              85
#define TWLG_UKRANIAN             86
/* More stuff added for 1.8 */
#define TWLG_ASSAMESE             87
#define TWLG_BENGALI              88
#define TWLG_BIHARI               89
#define TWLG_BODO                 90
#define TWLG_DOGRI                91
#define TWLG_GUJARATI             92
#define TWLG_HARYANVI             93
#define TWLG_HINDI                94
#define TWLG_KANNADA              95
#define TWLG_KASHMIRI             96
#define TWLG_MALAYALAM            97
#define TWLG_MARATHI              98
#define TWLG_MARWARI              99
#define TWLG_MEGHALAYAN          100
#define TWLG_MIZO                101
#define TWLG_NAGA                102
#define TWLG_ORISSI              103
#define TWLG_PUNJABI             104
#define TWLG_PUSHTU              105
#define TWLG_SERBIAN_CYRILLIC    106
#define TWLG_SIKKIMI             107
#define TWLG_SWEDISH_FINLAND     108
#define TWLG_TAMIL               109
#define TWLG_TELUGU              110
#define TWLG_TRIPURI             111
#define TWLG_URDU                112
#define TWLG_VIETNAMESE          113


#define TWAIN_BW		0x0001	// 1-bit per pixel, B&W
#define TWAIN_GRAY		0x0002	// 1,4, or 8-bit grayscale
#define TWAIN_RGB		0x0004	// 24-bit RGB color
#define TWAIN_PALETTE	0x0008	// 1,4, or 8-bit palette

#define TWAIN_ANYTYPE	0x0000	// any of the above (use by itself)

// Returns the TWAIN Protocol State per the spec.
#define TWAIN_PRESESSION		1	// source manager not loaded
#define TWAIN_SM_LOADED			2	// source manager loaded
#define TWAIN_SM_OPEN			3	// source manager open
#define TWAIN_SOURCE_OPEN		4	// source open but not enabled
#define TWAIN_SOURCE_ENABLED	5	// source enabled to acquire
#define TWAIN_TRANSFER_READY	6	// image ready to transfer
#define TWAIN_TRANSFERRING		7	// image in transit

//----- Unit of Measure
// TWAIN unit codes (from twain.h)
#define TWUN_INCHES      0
#define TWUN_CENTIMETERS 1
#define TWUN_PICAS       2
#define TWUN_POINTS      3
#define TWUN_TWIPS       4
#define TWUN_PIXELS      5


//------- TWAIN Pixel Types (from twain.h)
#define TWPT_BW          0 /* Black and White */
#define TWPT_GRAY        1
#define TWPT_RGB         2
#define TWPT_PALETTE     3
// Try to set or get the transfer mode - one of the following:
#define XFERMECH_NATIVE    0
#define XFERMECH_FILE      1
#define XFERMECH_MEMORY    2

#define CHOCOLATE_PIXELS   0     // zero pixel represents darkest shade
#define VANILLA_PIXELS     1  // zero pixel represents lightest shade

// Container formats, same codes as in TWAIN.H
#define CONTAINER_ARRAY           3
#define CONTAINER_ENUMERATION     4
#define CONTAINER_ONEVALUE        5
#define CONTAINER_RANGE           6

/* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */
#define TWSS_NONE        0
#define TWSS_A4LETTER    1
#define TWSS_B5LETTER    2
#define TWSS_USLETTER    3
#define TWSS_USLEGAL     4
/* Added 1.5 */
#define TWSS_A5          5
#define TWSS_B4          6
#define TWSS_B6          7
//#define TWSS_B          8
/* Added 1.7 */
#define TWSS_USLEDGER    9
#define TWSS_USEXECUTIVE 10
#define TWSS_A3          11
#define TWSS_B3          12
#define TWSS_A6          13
#define TWSS_C4          14
#define TWSS_C5          15
#define TWSS_C6          16
/* Added 1.8 */
#define TWSS_4A0          17
#define TWSS_2A0          18
#define TWSS_A0           19
#define TWSS_A1           20
#define TWSS_A2           21
#define TWSS_A4           TWSS_A4LETTER
#define TWSS_A7           22
#define TWSS_A8           23
#define TWSS_A9           24
#define TWSS_A10          25
#define TWSS_ISOB0        26
#define TWSS_ISOB1        27
#define TWSS_ISOB2        28
#define TWSS_ISOB3        TWSS_B3
#define TWSS_ISOB4        TWSS_B4
#define TWSS_ISOB5        29
#define TWSS_ISOB6        TWSS_B6
#define TWSS_ISOB7        30
#define TWSS_ISOB8        31
#define TWSS_ISOB9        32
#define TWSS_ISOB10       33
#define TWSS_JISB0        34
#define TWSS_JISB1        35
#define TWSS_JISB2        36
#define TWSS_JISB3        37
#define TWSS_JISB4        38
#define TWSS_JISB5        TWSS_B5LETTER
#define TWSS_JISB6        39
#define TWSS_JISB7        40
#define TWSS_JISB8        41
#define TWSS_JISB9        42
#define TWSS_JISB10       43
#define TWSS_C0           44
#define TWSS_C1           45
#define TWSS_C2           46
#define TWSS_C3           47
#define TWSS_C7           48
#define TWSS_C8           49
#define TWSS_C9           50
#define TWSS_C10          51
#define TWSS_USSTATEMENT  52
#define TWSS_BUSINESSCARD 53

/* ICAP_XFERMECH values (SX_ means Setup XFer) */
#define TWSX_NATIVE      0
#define TWSX_FILE        1
#define TWSX_MEMORY      2

#define ENABLE_LOGFILE   1
#define DISABLE_LOGFILE  0

//#define TESTMODE
