DTWAIN_EnumCompressionTypes

Top  Previous  Next

The DTWAIN_EnumCompressionTypes function gets all of the possible compression methods that are available when a buffered image transfer is done.

 

DTWAIN_BOOL DTWAIN_EnumCompressionTypes (

DTWAIN_SOURCE

Source,

LPDTWAIN_ARRAY

lpCompressionTypes );

 

Parameters

Source

An open TWAIN Source.

 

lpCompressionTypes

Address of a DTWAIN_ARRAY that will store the data types

 

Return Values

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

 

Comments

The DTWAIN_EnumCompressionTypes function gets all of the compression types supported by the Source Source. The compression type is used when a buffered image transfer is executed.  A buffered image transfer is done when the DTWAIN_AcquireBuffered is called.  The address lpCompressionTypes is the address of the DTWAIN_ARRAY that will store the compression types.  The data type of the returned DTWAIN_ARRAY is ARRAYLONG.

 

The following compression values are found in the DTWAIN Compression Constants table.  To set the current compression type, DTWAIN_SetCompressionType is used.  To get the compression type, DTWAIN_GetCompressionType is used.

 

Example

#include <dtwain.h>

 

void foo( )

{

   DTWAIN_ARRAY CompType;

   DTWAIN_SOURCE Source;

   LONG Count, NumTypes, CurType;

 

  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_EnumCompressionTypes( Source, &CompType );

 

   /* Get number of bit depths */

   NumTypes = DTWAIN_ArrayGetCount( CompType );

   printf("The number of compression types is %d\n", NumTypes );

 

   /* Print all the compression type values */

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

   {

        DTWAIN_ArrayGetAt( CompType, Count, &CurType )

        printf("Compression type %d is %d\n", Count + 1, CurType );

   }

 

  DTWAIN_ArrayDestroy( CompType );

  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 Buffered Transfer Mode Parameters