Setting Area of Image To Acquire and Paper Size |
Top Previous Next |
DTWAIN allows you to set an area of the image to retrieve. Instead of acquiring a whole page, the application can define which parts of the image will be actually acquired. The image dimensions are specified in terms of the source unit. The unit can be inches, pixels, centimeters, twips, picas, or points.
Units of Measure and Image Dimensions
To set or get the area of acquisition, DTWAIN supports two modes. The first relies on the Source's internal TWAIN management to set or get the area of acquisition correctly. The functions to do this are as follows:
The other mode that DTWAIN supports is allowing DTWAIN to return the scanned image, given the area of acquisition. With this mode, the only responsibility the TWAIN Source has is to provide the image dimensions and the unit of measure. Setting and getting the area is the responsibility of DTWAIN, not the Source. The functions to do this are as follows:
The advantage of using DTWAIN_GetAcquireArea2 and DTWAIN_SetAcquireArea2 is that you can set any size for the acquisition area within the page, while DTWAIN_GetAcquireArea and DTWAIN_SetAcquireArea may not work when given a certain area.
The disadvantage of using DTWAIN_GetAcquireArea2 and DTWAIN_SetAcquireArea2 is that for devices such as scanners, the scanner will read the entire page. On the other hand, the DTWAIN_GetAcquireArea and DTWAIN_SetAcquireArea will usually allow the scanner to read only that defined area, speeding up the scanning process.
Setting the size of the "paper"
For some applications, it may be necessary to set the paper size before acquiring an image. The paper size is technically called the Frame. To query and set the paper size before acquiring the image, the following API functions are used:
When setting the paper size, your application uses one of the DTWAIN paper size constants that define a particular size of paper. Note that not all paper sizes are supported by a particular Twain Source, so it is advised to call DTWAIN_EnumPaperSizes or DTWAIN_IsPaperSizeSupported before attempting to call DTWAIN_SetPaperSize.
|