Sets the brightness, highlight, and contrast values to be used when transferring images from the current TWAIN source.
#include "lttwn.h"
L_LTTWN_API L_INT L_TwainSetImageEffects(hSession, ulFlags, pBrightness, pContrast, pHighlight)
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.
Flags that indicate which value(s) to set. You can combine values when appropriate by using a bitwise OR ( | ). Possible values are:
| Value | Meaning |
|---|---|
| TWAIN_NEGOTIATE_BRIGHTNESS | [0x0010] Set the brightness of the image. |
| TWAIN_NEGOTIATE_CONTRAST | [0x0020] Set the contrast of the image. |
| TWAIN_NEGOTIATE_HIGHLIGHT | [0x0040] Set the highlight of the image. |
Pointer to a variable that contains the brightness value to set. Possible values range from -1000 to 1000.
Pointer to a variable that contains the contrast value to set. Possible values range from -1000 to 1000.
Pointer to a variable that contains the highlight value to set. Possible values range from 0 to 255.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
This function internally sets the brightness capability ICAP_BRIGHTNESS, the highlight capability ICAP_HIGHLIGHT, and the contrast capability ICAP_CONTRAST. For more information on these capabilities, refer to the TWAIN specification.
To get the current brightness, highlight, and contrast capability values, call the L_TwainGetImageEffects function.
This function should be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.
L_INT TwainSetImageEffectsExample(HTWAINSESSION hSession){L_INT nRet = SUCCESS;nRet = L_TwainStartCapsNeg(hSession);if(nRet != SUCCESS)return nRet;TW_FIX32 Brightness;nRet = L_TwainGetImageEffects (hSession, TWAIN_NEGOTIATE_BRIGHTNESS, &Brightness, NULL, NULL);if (nRet == SUCCESS){if (L_TwainFix32ToFloat(&Brightness) != 100.0f){Brightness = L_TwainFloatToFix32(100.0f);nRet = L_TwainSetImageEffects(hSession, TWAIN_NEGOTIATE_BRIGHTNESS, &Brightness, NULL, NULL);if(nRet != SUCCESS)return nRet;}}elsereturn nRet;L_INT nPaperSize, nPaperDirection;nRet = L_TwainGetAcquirePageOptions (hSession, &nPaperSize, &nPaperDirection);if (nRet == SUCCESS){if (nPaperDirection != TWOR_LANDSCAPE){nRet = L_TwainSetAcquirePageOptions (hSession, TWSS_A4, TWOR_LANDSCAPE);if(nRet != SUCCESS)return nRet;}}elsereturn nRet;nRet = L_TwainEndCapsNeg (hSession);if(nRet != SUCCESS)return nRet;return SUCCESS;}