PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Document coming from the Twain device
  • Managing the type of image
  • Duplex scanner
  • Operating mode in the 64-bit applications
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Used to:
  • view the document coming from the Twain device in an Image control.
  • view the document coming from the Twain device in the user interface of device. The user will have the ability to perform one of the actions proposed by this interface (for example: save the document, modify the default parameters of the device). The available actions depend on the device used.
    When validating the user interface, the document coming from the Twain device will be displayed in an Image control. The parameters specified in the user interface will be taken into account.
The image will be displayed in the Image control according to the display parameters defined in the description window of the Image control ("Description" from the popup menu).
Caution: This function does not save the document. To save the document found in the Image control, use a drawing function (dSaveImageBMP, dSaveImageGIF, dSaveImageJPEG).
Example
// Displays the image captured by the "web camera" in the "IMG_MyImage" control
// The image will be displayed in black and white
IF TwainToControl(IMG_MyImage, False, TwainBlackWhite) = True THEN
Info("The image is displayed in the image control")
ELSE
Error("The image was not retrieved")
END
Syntax
<Result> = TwainToControl(<Image control> [, <User Interface> [, <Type of Image> [, <Number of Bits per Pixel> [, <Image Resolution> [, <Image Contrast> [, <Image Brightness> [, <Duplex Mode>]]]]]]])
<Result>: Boolean
  • True if the document is viewed (in an Image control or in the user interface),
  • False otherwise. The corresponding error message is returned by ErrorInfo.
<Image control>: Character string (with or without quotes)
Name of Image control where the document will be viewed.
<User Interface>: Optional boolean
  • True (default value) if the user interface of the Twain device must be displayed,
  • False otherwise.
<Type of Image>: Optional Integer constant (or combination of constants)
Type of image used to save the document (classified by order of color management):
Order for managing the colors
0 (Default value)Default image of device.
1TwainPaletteImage whose colors are issued from a palette.
2TwainRGBRGB image.
3TwainGrayScaleImage in grayscale.
4TwainBlackWhiteImage in black and white.
-TwainAnyTypeAny type of image.
If these constants are combined, the best type of image supported by the device will be selected (according to the order of color management). See remarks for more details.
The default type of image will be used:
  • if this parameter is not specified or if it corresponds to 0.
  • if the specified type of image is not supported by the device.
  • if <User Interface> is set to True.
<Number of Bits per Pixel>: Optional integer
Amount of information about the colors (to display or print each pixel in an image). The larger the number of bits per pixel, the sharper the color rendering will be.
The possible values for this parameter depend on the type of image used:
Type of ImagePossible values
Image whose colors are issued from a palette (TwainPalette constant)1, 4 or 8
RGB image (TwainRGB constant)8, 10 or 16
Image in grayscale (TwainGrayScale constant)8 or 16
Image in black and white (TwainBlackWhite constant)1
If this parameter is not specified, the default number of bits per pixel will be used.
<Image Resolution>: Optional real
Number of pixels per inch (the possible values depend on the device used).
The default image resolution will be used:
  • if this parameter is not specified or if it corresponds to 0.
  • if the specified resolution is not supported by the device.
  • if <User Interface> is set to True.
<Image Contrast>: Optional real
Contrast of the image (value included between -1000 and 1000).
The default image contrast will be used:
  • if this parameter is not specified or if it corresponds to 0.
  • if the specified contrast is not supported by the device.
  • if <User Interface> is set to True.
<Image Brightness>: Optional real
Brightness of the image (value included between -1000 and 1000).
The default image brightness will be used:
  • if this parameter is not specified or if it corresponds to 0.
  • if the specified brightness is not supported by the device.
  • if <User Interface> is set to True.
<Duplex Mode>: Optional boolean
  • True to scan a document on both sides,
  • False (by default) to scan the document on a single side.
Remarks

Document coming from the Twain device

The "document coming from the Twain device" corresponds to:
  • the document found in a scanner during the call to TwainToControl. In this case, the parameters specified in TwainScanZone are taken into account.
  • the image broadcasted by a "web camera" during the call to TwainToControl.
  • the first photo saved in a digital camera.
    Note: If the user interface is used, the retrieved document will correspond to the photo selected by the user. If several photos are selected, only the first selected photo will be retrieved.

Managing the type of image

If several constants are combined in <Type of Image>, the best type of image supported by the device will be selected (according to the order of color management).
For example: If this parameter corresponds to TwainBlackWhite + TwainRGB, the type of the image will be:
  • RGB if this type is supported by the device.
  • black and white otherwise.

Duplex scanner

If the scanner supports the duplex mode, you have the ability to perform a double-sided scan. The generated document contains both sides of the scanned document.
Note: Depending on the hardware used, the Twain driver may not be sufficient to support a double-sided scan. You may have to install additional drivers supplied by the manufacturer.

Operating mode in the 64-bit applications

In a 64-bit application, this function will automatically use the 64-bit Twain driver. The TWAIN cannot be used if this driver is not installed.
Components
WINDEVReports and Queries wd230std.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment