Gets the current or default JPEG compression settings for the session.
#include "ltwrappr.h"
L_INT LTwain::GetJPEGCompression (pTwJpegComp, uFlag);
Pointer to a TW_JPEGCOMPRESSION structure to be updated with the JPEG compression settings.
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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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 specification.
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;
}