L_TwainSetRGBResponse

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetRGBResponse(hSession, pRgbResponse, nBitsPerPixel, uFlag)

Sets the RGB elements used when transferring data from the current TWAIN source.

Parameters

HTWAINSESSION hSession

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

pTW_RGBRESPONSE pRgbResponse

Pointer to a TW_RGBRESPONSE structure that references the RGB elements to be set for the TWAIN source. For more information about TW_RGBRESPONSE, refer to the TWAIN specification.

L_INT nBitsPerPixel

Bits per pixel to be set. This is used to determine the number of RGB elements in the TW_RGBRESPONSE structure.

L_UINT uFlag

Flags that indicate whether to set or reset the RGB elements for the TWAIN source. Possible values are:

Value Meaning
TWAIN_RGB_RESPONSE_SET [0x0001] Set the RGB elements for the current TWAIN source using the information provided.
TWAIN_RGB_RESPONSE_RESET [0x0002] Reset the RGB elements for the current TWAIN source to the default values. Please note that defaults vary from TWAIN source to TWAIN source.

Returns

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

Comments

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 TwainSetRGBResponseExample(HTWAINSESSION hSession) 
{ 
   L_INT nRet; 
 
   nRet = L_TwainStartCapsNeg (hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   pTW_RGBRESPONSE pRgbResponse = NULL; 
   pRgbResponse = (pTW_RGBRESPONSE)GlobalAllocPtr(GHND, sizeof(TW_RGBRESPONSE) + sizeof(TW_ELEMENT8) * 2); 
   if (pRgbResponse) 
   { 
      pRgbResponse->Response[0].Index = 0; 
      pRgbResponse->Response[0].Channel1 = 0; 
      pRgbResponse->Response[0].Channel2 = 0; 
      pRgbResponse->Response[0].Channel3 = 0; 
 
      pRgbResponse->Response[1].Index = 1; 
      pRgbResponse->Response[1].Channel1 = 255; 
      pRgbResponse->Response[1].Channel2 = 255; 
      pRgbResponse->Response[1].Channel3 = 255; 
 
      nRet = L_TwainSetRGBResponse(hSession, pRgbResponse, 1, TWAIN_RGB_RESPONSE_SET); 
      if(nRet != SUCCESS) 
         return nRet; 
   } 
 
   nRet = L_TwainEndCapsNeg (hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help