FindFastConfig method (Twain Control)

C++ Builder example

Delphi 4.0 example

 

Builder Syntax

int FindFastConfig(AnsiString strWorkingFolder, unsigned uFlags, int nBitsPerPixel, int nBufferIteration, pFASTCONFIG pInFastConfigs, int nInFastConfigsCount, ppFASTCONFIG ppTestConfigs, L_PINT pnTestConfigsCount, pFASTCONFIG pOutBestConfig);

Delphi Syntax

Function FindFastConfig (strWorkingFolder: String; uFlags: L_UINT; nBitsPerPixel: L_INT; nBufferIteration: L_INT; pInFastConfigs: pFASTCONFIG; nInFastConfigsCount: L_INT; ppTestConfigs: ppFASTCONFIG; pnTestConfigsCount: L_PINT; pOutBestConfig: pFASTCONFIG ): L_INT;

Overview

Refer to Fast TWAIN (Scan Configurations).

Remarks

(Document/Medical only) Determines the best scanner configuration.

This method will test scan configurations for the scanner selected by calling SelectSource. It will update the pOutBestConfig parameter with the best scan configuration tested. Once the best scan configuration has been determined, the scan configuration's values for the transfer mode, bits per pixel, format and buffer size can be passed to AcquireMulti method so the images can be scanned as fast as possible.

To test user-defined/custom configurations, pass these configurations in pInFastConfigs and the number of configurations in nInFastConfigsCount.

To test the default configurations available for the Twain driver, pass Nil for pInFastConfigs and 0 for nInFastConfigsCount. In this case, the method will test scan configurations based the values passed in the nBitsPerPixel and nBufferIteration parameters.

The list of default scan configurations to test can be shortened by using the GetScanConfigs method to get a list of default scan configurations based on transfer mode, bits per pixel and number of buffers. This list can then be passed to FindFastConfig method to determine the best and fastest scan configuration.

If LTWAIN_CHECK_ALL_DEFAULT_BPP is set in uFlags then the method will test all supported bits per pixel for the selected scanner. If this flag is not set in uFlags, then the method will use the iBitsPerPixel parameter value.

If LTWAIN_USE_THREAD_MODE is set in uFlags, then the image acquisition process will run in thread mode. In some scanners, acquiring images in thread will improve the speed at which the image(s) is(are) acquired. In other scanners, high-speed scanners, for example, acquiring the image(s) in thread mode will provide little to no improvement in the speed at which the image(s) is(are) acquired.

The nBitsPerPixel parameter and LTWAIN_CHECK_ALL_DEFAULT_BPP flag will be used only if the transfer mode for the scan configuration being tested is LTWAIN_BUFFER_MODE or LTWAIN_NATIVE_MODE.

The nBufferIteration parameter will be used only if the transfer mode for the scan configuration being tested is LTWAIN_BUFFER_MODE.

If a valid callback method is passed for pfnCallBack, the scan configuration testing process can be stopped by returning any value other than SUCCESS for the callback method. The testing process is continued by returning SUCCESS for the callback method.

This method allocates storage for the array of scan configurations in ppTestConfigs. When this storage is no longer needed, you must free the storage by calling FreeScanConfig.

See Also

Elements:

Acquire method, InitSession method, EndSession method, OpenTemplateFile method, CloseTemplateFile method, ShowTemplateDlg method, AddCapabilityToFile method, GetNumOfCapsInFile method, GetCapabilityFromFile method, AcquireMulti method, GetScanConfigs method, FreeScanConfig method.

Topics:

TWAIN Functionality: Fast TWAIN (Scan Configuration).