TWAIN Source

Top  Previous  Next

The Twain Data Source (or simply, Source) is the software that controls each image acquisition device, and is responsible for compliance with the TWAIN specification.   The Source is the software that is included with almost every scanner or digital camera.  The manufacturer of the image acquisition device is usually responsible for writing the Source software, however many third-party software companies and consultants may have written the Source for a particular device.  The Source is always implemented as a DLL, however the file extension is not .DLL, but .DS.  The Source files are usually installed in a subdirectory of the TWAIN installation directory.

 

The Source software usually includes a user interface (UI) that is displayed when TWAIN requests that an image is to be acquired.   The UI is not a requirement for a Source, but most do have one.   Some Source's allow the programmer to disable the default UI, and either show a custom UI or allow the Source to work without showing a UI (see Source User Interface Issues for more information).

 

Once the User interface is enabled, and the user (or possibly the application) selects to start the acquisition process, the Source is responsible for transferring the data from the image device to the application (in our case, the application is DTWAIN).  The transference of image data from the device to the application is done by using a certain image transfer mode. Once the image has been transferred from the device to the application, the resulting image is stored as a Device Independent Bitmap (or DIB for short), or if compression is used, the result is a series of bytes describing an actual image file (TIFF, JPEG. etc).

 

Another aspect of the Source is that it allows the user to set or retrieve the image acquisition device's capabilities.   With each Source, there are various aspects of the image acquisition such as resolution, color / black and white settings, gamma correction, etc.

 

From a DTWAIN application's viewpoint, the most important aspect is the Source.  DTWAIN encapsulates the Source (this entity is called a DTWAIN_SOURCE) so that it is easy to use and control.  With many DTWAIN function, the Source is a requirement.