DTwainRange

Top  Previous  Next

The DTwainRange class provides a high-level interface to the range type that is used to store TWAIN capability values.  Many capabilities defined by the TWAIN specification saves and retrieves the values using a range type.

 

There are two types of ranges; a DTwainLongRange and DTwainDoubleRange which both are templated versions of DTwainRange:

 

typedef DTWAIN::DTwainRange<long, DTWAIN_ARRAYLONG> DTwainLongRange;

typedef DTWAIN::DTwainRange<double, DTWAIN_ARRAYDOUBLE> DTwainDoubleRange;

 

The DTwainLongRange stores long values, while a DTwainDoubleRange stores doubles.

 

In general, a DTwainRange the following characteristics:

 

       A lower limit
       An upper limit
       A step size
       A power up default value
       A current value

 

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 DTwainRange 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 range type and use it to its advantage is the DTWAIN_CV_ICAPBRIGHTNESS, where values can range between two extremes that may encompass a few hundred values.

 

The DTwainLongRange assumes that the range is defined by integer values, while the DTwainDoubleRange assumes that the range is defined by double values.

 

Your application must use either a DTwainLongRange or DTwainDoubleRange object.  Please see Example 6 for usage of DTwainRange types.