DTWAIN_EnumBitDepths

Top  Previous  Next

The DTWAIN_EnumBitDepths function gets all of the possible bit depths (bits per pixel) that are available for the current Source's pixel type

 

DTWAIN_BOOL DTWAIN_EnumBitDepths (

DTWAIN_SOURCE

Source,

LPDTWAIN_ARRAY

lpBitDepth );

 

Parameters

Source

An open TWAIN Source.

 

lpBitDepth

Address of a DTWAIN_ARRAY that will store the bit depths

 

Return Values

The return value is TRUE if successful.  Otherwise FALSE is returned.

 

Comments

The DTWAIN_EnumBitDepths function gets all of the bit depths or bits per pixel, supported by the current pixel setting for the Source. On return, lpBitDepth will be filled with all of the available bit depths. The data type of the returned DTWAIN_ARRAY is ARRAYLONG.

 

Note that DTWAIN_EnumBitDepths returns the bit depths for the current pixel type.  To set the current pixel type, use DTWAIN_SetPixelType.

 

Example

#include <dtwain.h>

 

void foo( )

{

   DTWAIN_ARRAY BitDepths;

   DTWAIN_SOURCE Source;

   LONG Count, NumDepths, CurDepth;

 

  DTWAIN_SysInitialize( );

   Source = DTWAIN_SelectSource( );

 

   /* Check if Source has been selected.  If not return */

   if ( Source == 0 )

   {

      DTWAIN_SysDestroy( );

       return;

   }

 

   /* Get all the bit depths */

   DTWAIN_EnumBitDepths( Source, &BitDepths );

 

   /* Get number of bit depths */

   NumDepths = DTWAIN_ArrayGetCount( BitDepths );

   printf("The number of bit depths is %d\n", NumDepths );

 

   /* Print all the bit depth values */

   for ( Count = 0; Count < NumDepths; ++Count )

   {

        DTWAIN_ArrayGetAt( BitDepths, Count, &CurDepth )

        printf("Bit depth %d is %d\n", Count + 1, CurDepth );

   }

 

  DTWAIN_ArrayDestroy( BitDepths );

  DTWAIN_SysDestroy( );

}

 

TWAIN State Transitions

The Source must be in State 4 or higher

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

 

DTWAIN Source Selection Function

 

 

See Also

Setting Pixel and Bit Depth