DTWAIN_EnumCompressionTypes
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 (
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 Note: It is recommended to use the more comprehensive DTWAIN_EnumCompressionTypesEx2 function to retrieve all the supported compression types for a given file type. 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 or when a file transfer that is supported by the Source is used. A buffered image transfer is done when the DTWAIN_AcquireBuffered is called, and file transfers are done when DTWAIN_AcquireFile or DTWAIN_AcquireFileEx is done with the DTWAIN_USESOURCEMODE flag is set.. 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.
Note: The compression types returned by DTWAIN_EnumCompressionTypes will return the set of compression types for the current state of the TWAIN device. Thus the return value from this call may return different results, depending on when the call is done (for example, when acquiring an image during a DTWAIN notification handler, as opposed to calling DTWAIN_EnumCompressionTypes right after selecting/opening the Source). Thus it is recommended to call DTWAIN_EnumCompressionTypesEx2 to get a more accurate set of compression types for a given Source, since DTWAIN_EnumCompressionTypesEx2 will set the device in the proper state, according to the parameters passed to DTWAIN_EnumCompressionTypesEx2. Example #include <dtwain.h>
void foo( ) { DTWAIN_ARRAY CompType; DTWAIN_SOURCE Source; LONG Count, NumTypes, CurType;
Source = DTWAIN_SelectSource( );
/* Check if Source has been selected. If not return */ if ( Source == 0 ) { 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 ); }
TWAIN State Transitions The Source must be in State 4 or higher
Prerequisite Function Call(s)
DTWAIN Source Selection Function
See Also |