L_TwainSetRGBResponse

#include "lttw2.h"

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

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

pTW_RGBRESPONSE pRgbResponse;

/* pointer to the RGB response */

L_INT nBitsPerPixel;

/* bits per pixel */

L_UINT uFlag;

/* optional flags */

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

Parameter

Description

hSession

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

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

nBitsPerPixel

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

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

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

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_TwainSetImageEffects, L_TwainGetImageEffects, L_TwainSetAcquirePageOptions, L_TwainGetAcquirePageOptions, L_TwainShowProgress, L_TwainEnableDuplex, L_TwainGetDuplexOptions, L_TwainSetMaxXferCount, L_TwainGetMaxXferCount

Topics:

Getting and Setting Capabilities

 

TWAIN Functionality: Capability Functions

Example

void TestRGBResponse(HTWAINSESSION hSession) 
{
   L_TwainStartCapsNeg (hSession); 

   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; 

      L_TwainSetRGBResponse(hSession, pRgbResponse, 1, TWAIN_RGB_RESPONSE_SET); 
   }

   L_TwainEndCapsNeg (hSession); 
}