LTwain::SetRGBResponse

#include "ltwrappr.h"

L_INT LTwain::SetRGBResponse (pRgbResponse, nBitsPerPixel, uFlag)

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

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, http://www.twain.org/ 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.

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:

LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount

Topics:

Getting and Setting Capabilities

 

TWAIN Functionality: Capability Functions

Example

L_INT LTwain__SetRGBResponseExample(LTwain * plTwain) 
{
   L_INT             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 = plTwain->SetRGBResponse(pRgbResponse, 1, TWAIN_RGB_RESPONSE_SET); 
      if(nRet != SUCCESS)
         return nRet;
   }
   return SUCCESS;
}