L_TwainGetJPEGCompression

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainGetJPEGCompression(hSession, pTwJpegComp, uFlag)

Gets the current or default JPEG compression settings for the session.

Parameters

HTWAINSESSION hSession

Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.

pTW_JPEGCOMPRESSION pTwJpegComp

Pointer to a TW_JPEGCOMPRESSION structure that contains the JPEG compression settings.

L_UINT uFlag

Flag that indicates which type of JPEG compression values to get. Possible values are:

Value Meaning
LTWAIN_GET_JPEG_COMPRESSION [0x0001] Get the current JPEG compression settings
LTWAIN_GET_DEFAULT_JPEG_COMPRESSION [0x0002] Get the default JPEG compression settings

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function will get the current or default TWAIN JPEG compression settings, depending on which flag gets passed to the uFlag parameter.

For more information about TW_JPEGCOMPRESSION, refer to the TWAIN specification.

This function must be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT TwainGetJPEGCompressionExample(HTWAINSESSION hSession) 
{ 
   L_INT nRet; 
 
   nRet = L_TwainStartCapsNeg (hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   TW_JPEGCOMPRESSION myJPEG; 
   memset(&myJPEG, 0, sizeof(TW_JPEGCOMPRESSION)); 
   nRet = L_TwainGetJPEGCompression(hSession, &myJPEG, LTWAIN_GET_JPEG_COMPRESSION); 
   if (nRet == SUCCESS) 
   { 
      myJPEG.ColorSpace = TWPT_GRAY; 
      myJPEG.SubSampling = 0x10001000; 
      myJPEG.NumComponents = 1; 
      myJPEG.RestartFrequency = 0; 
      myJPEG.QuantMap[0] = 0; 
      memset(&myJPEG.QuantTable[0], 0, sizeof(TW_MEMORY)); 
      myJPEG.HuffmanMap[0] = 0; 
      memset(&myJPEG.HuffmanDC[0], 0, sizeof(TW_MEMORY)); 
      memset(&myJPEG.HuffmanAC[0], 0, sizeof(TW_MEMORY)); 
 
      nRet = L_TwainSetJPEGCompression (hSession, &myJPEG, LTWAIN_SET_JPEG_COMPRESSION); 
      if (nRet == SUCCESS) 
      { 
         MessageBox(NULL, TEXT("Setting JPEG compression options was successful"), TEXT("Notice!"), MB_OK); 
         return nRet; 
      } 
   } 
 
   nRet = L_TwainEndCapsNeg(hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help