home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d5 / SGSCAN.ZIP / Readme.txt < prev    next >
Text File  |  1998-07-15  |  5KB  |  75 lines

  1. MultiTWAIN for Delphi
  2.  
  3. July 14, 1998
  4.  
  5. nieves@mail.med.upenn.edu
  6. http://mail.med.upenn.edu/~nieves
  7.  
  8. INTRODUCTION
  9.  
  10. TWAIN is a specification that provides a standard interface for software applications to communicate with hardware devices such as scanners and digital cameras in a device-independent manner.  The TWAIN specification is somewhat complex, but there are a number of libraries available to programmers that simplify the process of developing TWAIN-aware applications.  These libraries are available as freeware, shareware, and as parts of large commercial imaging packages that cost hundreds of dollars.
  11.  
  12. MultiTWAIN is a freeware library of routines that simplify the process of acquiring images from TWAIN-compliant devices.  The thing that makes MultiTWAIN stand out from other packages available is that, to my knowledge, it is the *ONLY* freeware library for Delphi that supports the acquisition of multiple consecutive images from digital cameras and scanners with automatic document feeders.  Previously, Delphi users had to choose between using free software that handles only image at a time versus large, expensive, commercial packages that  include this feature among a host of other routines.
  13.  
  14. MultiTWAIN was not developed from scratch.  It is based entirely on a version of Spike McLarty's excellent freeware library EZTWAIN.  EZTWAIN is a DLL written in C that provides services to simplify the acquisition of individual images from a TWAIN device.  MultiTWAIN represents a version of this code that has been compiled into an OBJ file, then included into a Delphi "unit" file with appropriate headers for the function declarations.  Thus, Delphi applications that use MultiTWAIN do *NOT* require the presence of EZTWAIN.DLL or EZTW32.DLL.  Additionally, the EZTWAIN C code was modified so as to support acquisition of multiple images.
  15.  
  16.  
  17. SYSTEM REQUIREMENTS
  18.  
  19. MultiTWAIN was developed using Delphi 4, but it should compile correctly under Delphi 3 and 2.  The only caveat is that some of the EZTWAIN routines upon which MultiTWAIN relies require parameters in the form of unsigned 32-bit integers.  This data type is currently not supported in Delphi 2 or 3, and therefore the code attempts to substitute a 32-bit signed integer in place of this.  This is only an issue with a few minor functions, but it's something to keep in mind in case problems come up.
  20.  
  21.  
  22. USE
  23.  
  24. Use of MultiTWAIN is *very* easy.  Although a ton of functions are supported, in practice you only need to know about a handful:
  25.  
  26.  * Standard TWAIN access routines:
  27.  
  28.    - TWAIN_SelectSource:  displays a dialog box to allow the user to
  29.                           select a TWAIN device.  Accepts an HWND as
  30.                           an argument, but sending it zero works fine.
  31.  
  32.    - TWAIN_AcquireNative:  returns a handle to a device-independent 
  33.                            bitmap (DIB) for the last image acquired (or 
  34.                            the only image, as the case may be).  Accepts
  35.                            two arguments: an HWND and a pixmask.  Set 
  36.                            both to zero (I've had problems with my
  37.                            camera when I specify the proper HWND).
  38.  
  39.    - TWAIN_FreeNative:  releases the memory owned by a DIB
  40.  
  41.  * Routines to support acquisition of multiple images
  42.  
  43.    - TWAIN_GetNumDibs:  returns the number of images retrieved
  44.  
  45.    - TWAIN_GetDib:  returns a handle for the nth image retrieved
  46.  
  47.    - RegisterDibCallback:  designate an optional user-defined function  
  48.                            to be called for each image transferred.  
  49.                            Note that unfortunately the function 
  50.                            designated as a callback function *CANNOT* be 
  51.                            an object member function.  It MUST be 
  52.                            free-standing.
  53.  
  54.    - UnRegisterDibCallback:  tells the system not to call *any* user-
  55.                              defined callback function
  56.  
  57.  * Delphi support for DIBs
  58.  
  59.    - CopyDIBIntoImage:  accepts a handle to a DIB and a TImage, then
  60.                         renders the DIB into the TImage's canvas
  61.  
  62. A very short demonstration program is included to demonstrate the use of these  functions.  It's really quite easy.
  63.  
  64.  
  65. CHANGES TO ORIGINAL EZTWAIN CODE
  66.  
  67. In order to make EZTWAIN.C compile into an OBJ that would be suitable for inclusion into a Delphi unit, some changes had to be made.  These included removal of references to any functions in the C run-time library.  Specifically, the RTL memset() and memcpy() functions were re-written from scratch to remove reliance on the RTL versions.  Also, one function used wsprintf to generate error messages, but I couldn't get it to compile correctly, so I omitted the reference and made the error messages somewhat generic.
  68.  
  69. Finally, some functions that dealt with floating point numbers were removed and re-implemented in Pascal so as to avoid reliance on C support routines for floating-point numbers.
  70.  
  71.  
  72. FINAL REMARKS
  73.  
  74. Although this software is freeware, I do make one small request: *PLEASE* send me  e-mail to let me know if MultiTWAIN meets a programming need you could not have fulfilled elsewhere (or even if you could).  I hope to hear from as many users as possible.
  75.