L_TwainSetImageEffects

#include "lttwn.h"

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

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

L_UINT32 ulFlags;

/* optional flags */

pTW_FIX32 pBrightness;

/* pointer to a variable */

pTW_FIX32 pContrast;

/* pointer to a variable */

pTW_FIX32 pHighlight;

/* pointer to a variable */

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

Parameter

Description

hSession

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

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] Sets the brightness of the image.

 

TWAIN_NEGOTIATE_CONTRAST

[0x0020] Sets the contrast of the image.

 

TWAIN_NEGOTIATE_HIGHLIGHT

[0x0040] Sets the highlight of the image.

pBrightness

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

pContrast

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

pHighlight

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

Returns

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 www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

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

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:

L_TwainSetTransferOptions, L_TwainGetTransferOptions, L_TwainGetSupportedTransferMode, L_TwainSetResolution, L_TwainGetResolution, L_TwainSetImageFrame, L_TwainGetImageFrame, L_TwainSetImageUnit, L_TwainGetImageUnit, L_TwainSetImageBitsPerPixel, L_TwainGetImageBitsPerPixel, L_TwainGetImageEffects, L_TwainSetAcquirePageOptions, L_TwainGetAcquirePageOptions, L_TwainSetRGBResponse, L_TwainShowProgress, L_TwainEnableDuplex, L_TwainGetDuplexOptions, L_TwainSetMaxXferCount, L_TwainGetMaxXferCount, L_TwainFloatToFix32

Topics:

Getting and Setting Capabilities

 

TWAIN Functionality: Capability Functions

Example

 L_INT TwainSetImageEffectsExample(HTWAINSESSION hSession) 
{
   L_INT nRet = SUCCESS;
   L_TwainStartCapsNeg (hSession);
   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;
}