|
Available in the LEADTOOLS Imaging toolkit. |
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 the FindFastConfig method. This method 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 UserFastConfigsCount property. For each scan configuration that is tested, the FastConfigEvent event is fired, if the EnableFastConfigEvent property has been set to TRUE. This event receives the information for the scan configuration being tested. This lets you interact with the scan configuration information as needed. When the FastConfigEvent event is fired, you can check the success status of the scan configuration being tested by getting the Success property.
The scan configuration testing process, started by the FindFastConfig method, can be stopped by setting the StopFindFastConfig property to TRUE. To continue the scan configuration process, set the StopFindFastConfig property to FALSE.
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 GetScanConfigs method. This method 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 in the ScanConfig property and get the number of scan configurations in the ScanConfigCount property, assign the value of the ScanConfigCount property to the UserFastConfigsCount property and assign scan configurations in the ScanConfig property to the UserFastConfigs property and then call the FindFastConfig method. This will decrease the number of default scan configurations that must be tested. The scan configurations that are actually tested by the FindFastConfig method are placed in the FastConfigsResult property. The number of scan configurations tested is placed in the FastConfigsResultCount property.
Once the best scan configuration has been determined, the scan configuration information in the BestFastConfig property can be used to set the values for the FastTransferMode property, the FastFormat property, the FastBitsPerPixel property, FastBufferSize property and the FastUsePreferredBufferSize property. Then the AcquireMulti method can be called so the images will be acquired as fast as possible.
Scan configurations are accessed through an ILTFastConfig interface, which contains the following properties: BitsPerPixel property, BufferSize property, FileFormat property, RequiredTime property and the TransferMode property.