#include "lttwn.h"
L_LTTWN_API L_INT L_TwainGetJPEGCompression(hSession, pTwJpegComp, uFlag)
HTWAINSESSION hSession; |
handle to an existing TWAIN session |
pTW_JPEGCOMPRESSION pTwJpegComp; |
pointer to a structure |
L_UINT uFlag; |
flags |
Gets the current or default JPEG compression settings for the session.
Parameter | Description | |
hSession | Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function. | |
pTwJpegComp | Pointer to a TW_JPEGCOMPRESSION structure that contains 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 |
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 which flag gets 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/".
This function must be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.
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. |
Functions: |
L_TwainSetJPEGCompression, L_TwainInitSession, L_TwainStartCapsNeg |
Topics: |
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;
}