L_TwainSetImageEffects

Summary

Sets the brightness, highlight, and contrast values to be used when transferring images from the current TWAIN source.

Syntax

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetImageEffects(hSession, ulFlags, pBrightness, pContrast, pHighlight)

Parameters

HTWAINSESSION hSession

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

L_UINT32 ulFlags

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.

pTW_FIX32 pBrightness

Pointer to a variable that contains the brightness value to set. Possible values range from -1000 to 1000.

pTW_FIX32 pContrast

Pointer to a variable that contains the contrast value to set. Possible values range from -1000 to 1000.

pTW_FIX32 pHighlight

Pointer to a variable that contains the highlight value to set. Possible values range from 0 to 255.

Returns

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

Comments

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.

Required DLLs and Libraries

See Also

Functions

Topics

Example

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; 
      } 
   } 
   else 
      return 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; 
      } 
   } 
   else  
      return nRet; 
 
   nRet = L_TwainEndCapsNeg (hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.