Overview of DTWAIN_RANGE
DTWAIN provides functions that handle the TWAIN defined TW_RANGE 'C' language structure very easily. When setting certain device capabilities, the TWAIN specification may require that a TW_RANGE be used to store or retrieve the capability data. Since The 'C' language TW_RANGE structure is not easily implemented in other languages (the 'C' structure itself is not easily implemented in many languages), DTWAIN insulates the internal TWAIN structures by using the DTWAIN_RANGE to emulate the TW_RANGE structure.
A DTWAIN_RANGE can be used interchangeably with a DTWAIN_ARRAY. Note that a DTWAIN_RANGE is a specialized version of a DTWAIN_ARRAY, but a DTWAIN_ARRAY is not necessarily a DTWAIN_RANGE.
In general, a DTWAIN_RANGE (and a TW_RANGE) has the following characteristics:
The lower and upper limits define the minimum and maximum values that are possible, respectively. The step size describes the interval between successive values. For example, if the lower limit is -10, the upper limit is +10, and the step size is 2, the values that are possible are as follows: -10, -8, -6, -4, -2, 0, +2, +4, +6, +8, +10.
The DTWAIN_RANGE is very useful for defining a uniformly distributed series of numbers. It is much better storage-wise to use just three values (lower/upper limit and step size) than store every single individual value. One device capability that may support the TW_RANGE and use it to its advantage is the DTWAIN_CV_ICAPCONTRAST, where values can range between two extremes that may encompass a few hundred values. DTWAIN_RANGEs can only store the LONG and DTWAIN_FLOAT data types.
DTWAIN has a set of functions that work with the DTWAIN_RANGE type. The DTWAIN_RANGE must be created using the DTWAIN_RangeCreate function, however any DTWAIN_ARRAY function except for the creation functions can be used on a DTWAIN_RANGE. The following topic lists all of the DTWAIN_RANGE functions:
* The Power-up and Current values defined in the DTWAIN_RANGE are used by the Source to communicate what the device capability's power-up and current-value, respectively. These values won't be discussed here, since they have been some disagreement in the TWAIN community as to what these values should represent. |