There are three acquisition modes in TWAIN:
- Native: ImageGear will load the entire image into memory as one continuous data stream.
- Disk File Transfer: The Data Source will save the acquired image directly to a file. ImageGear gives you control over setting the filename and file format to be used in Setting the Filename and Format Type for Disk File Transfer.
- Buffered Memory Transfer: The data will be loaded into memory (as for Native Transfer) except that it will be buffered and optionally compressed. This allows you to mimimize memory requirements which is especially useful when scanning high-resolution images.
Remember that not all of the TWAIN-supported transfer syntax modes are supported by all Data Sources. If you try to use an acquisition mode that your device does not support, you will receive an error message. |
Tell ImageGear the transfer mode to use with the function IG_TWAIN_cap_set().
- To set the transfer syntax to Disk File Transfer:
Copy Code HTWAINCAP hTWAINCap = (HTWAINCAP)NULL; DWORD dwXferMode = IG_TW_SX_FILE; nErrCount = IG_TWAIN_cap_create(IG_TW_ICAP_XFERMECH, IG_TW_ON_ONEVALUE, AM_TID_META_UINT16, &hTWAINCap); nErrCount = IG_TWAIN_cap_value_set(hTWAINCap, (LPCVOID)dwXferMode, sizeof(dwXferMode)); nErrCount = IG_TWAIN_cap_set(hTWAINCap, IG_TW_MSG_SET); IG_TWAIN_cap_delete(hTWAINCap);
- To set the transfer syntax to Buffered Memory:
Copy Code HTWAINCAP hTWAINCap = (HTWAINCAP)NULL; DWORD dwXferMode = IG_TW_SX_MEMORY; nErrCount = IG_TWAIN_cap_create(IG_TW_ICAP_XFERMECH, IG_TW_ON_ONEVALUE, AM_TID_META_UINT16, &hTWAINCap); nErrCount = IG_TWAIN_cap_value_set(hTWAINCap, (LPCVOID)dwXferMode, sizeof(dwXferMode)); nErrCount = IG_TWAIN_cap_set(hTWAINCap, IG_TW_MSG_SET); IG_TWAIN_cap_delete(hTWAINCap);
- To set the transfer syntax to Native:
Copy Code HTWAINCAP hTWAINCap = (HTWAINCAP)NULL; DWORD dwXferMode = IG_TW_SX_NATIVE; nErrCount = IG_TWAIN_cap_create(IG_TW_ICAP_XFERMECH, IG_TW_ON_ONEVALUE, AM_TID_META_UINT16, &hTWAINCap); nErrCount = IG_TWAIN_cap_value_set(hTWAINCap, (LPCVOID)dwXferMode, sizeof(dwXferMode)); nErrCount = IG_TWAIN_cap_set(hTWAINCap, IG_TW_MSG_SET); IG_TWAIN_cap_delete(hTWAINCap);
By default, if no call is made to set transfer mode, ImageGear will use the mode set in Data Source.