LTwain::GetJPEGCompression

#include "ltwrappr.h"

L_INT LTwain::GetJPEGCompression (pTwJpegComp, uFlag);

pTW_JPEGCOMPRESSION pTwJpegComp;

/* pointer to a structure */

L_UINT uFlag;

/* flag */

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

Parameter

Description

pTwJpegComp

Pointer to a TW_JPEGCOMPRESSION structure to be updated with the JPEG compression settings.

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

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 the flag passed to the uFlag parameter.

For more information about TW_JPEGCOMPRESSION, refer to the TWAIN 1.9 specification from the site "http://www.twain.org/".

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LTwain::SetJPEGCompression, LTwain::InitSession

Topics:

Using JPEG Compression for a TWAIN Source

 

TWAIN Functionality: JPEG Compression Functions

Example

L_INT LTwain__GetJPEGCompressionExample(LTwain * plTwain)
{
   L_INT                nRet;
   TW_JPEGCOMPRESSION   myJPEG; 
   memset(&myJPEG, 0, sizeof(TW_JPEGCOMPRESSION)); 
   nRet = plTwain->GetJPEGCompression(&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 = plTwain->SetJPEGCompression (&myJPEG, LTWAIN_SET_JPEG_COMPRESSION); 
      if (nRet == SUCCESS) 
         MessageBox(NULL, TEXT("Set JPEG compression options is success"), TEXT("Notice!"), MB_OK); 
      else
         return nRet;
   }
   else
      return nRet;
   return SUCCESS;
}