Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
Fast TWAIN (Scan Configurations)
The performance of a TWAIN scanner can vary based on its scan configuration. The TWAIN driver of your TWAIN scanner comes with one or more "default" scan configurations. In addition, the user may create one or more user-defined scan configurations. LEAD provides several functions to determine the best and fastest scan configuration available, thereby letting you use the best and fastest scan configuration for scanning images.
To determine the best and fastest scan configuration for your TWAIN scanner, call LTwain::FindFastConfig. This function will test either an array of user-defined scan configurations, or all the default scan configurations present for the TWAIN driver of the current TWAIN scanner, based on the values of the pInFastConfigs and the nInFastConfigsCount parameters. For each scan configuration that is tested, the LTwain::FindFastConfig function calls the LTwain::FindFastConfigCallBack function. This callback function receives the information for the scan configuration being tested. This lets you interact with the scan configuration information as needed.
Since the list of default scan configurations present for a specific TWAIN driver can be rather numerous, you can narrow the list you wish to test using the LTwain::GetScanConfigs function. This function gets default scan configurations based on the transfer mode, bits per pixel and number of buffers. Therefore, you can get a list of scan configurations for a specific transfer mode, pass this list of scan configurations to the LTwain::FindFastConfig function, and decrease the number of default scan configurations that must be tested.
Both the LTwain::FindFastConfig function and the LTwain::GetScanConfigs function allocate storage for an array of FASTCONFIG structures that contains scan configurations. This storage must be freed by calling LTwain::FreeScanConfig, when the array is no longer needed.
Once the best scan configuration has been determined, the scan configuration information can be passed to the LTwain::AcquireMulti function or LTwain::FastAcquire function so the images will be acquired as fast as possible.