DTwainRange::Expand

Top  Previous  Next

Syntax

long Expand( DTwainLongArray& Array ) const;

long Expand( DTwainDoubleArray& Array ) const;

 

Parameters

Array

Array to copy the expanded range to.

 

Return Value

If successful, the number of elements in the expanded range.  If not successul, -1 is returned.

 

Comments

DTwainRange:::Expand generates all of the values defined by the DTwainRange and copies the values to the DTwainLongArray or DTwainDoubleArray Array.  The only possible array types allowed are DTwainLongArray and DTwainDoubleArray, denoting a DTwainLongRange and DTwainDoubleRange objects respectively.

 

Range expansion is the act of taking a range and generating all of the numbers that the range defines.  The minimum, maximum, and step sizes determine the expanded numbers. For example if the DTWAIN_RANGE has the following characteristics:

 

Minimum Value = -10

Maximum Value = 10

Step size = 2

 

The expanded range will consist of the following values

 

-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10

 

Note:

Care must be taken in that the DTwainRange may expand to many values.  For example, a range defined as -1000.0 min, 1000.0 max, with a step size of 0.1, will generate over 20,000 values  The DTwainRange::GetCount can be used to get the a count of the total number of expanded values before attempting to call DTwainRange::Expand.  If only a few values are required from an expanded range, use the DTwainRange::GetExpandedValue or DTwainRange::operator[ ] function instead