Sets the image unit value used to transfer images from the current TWAIN source.
#include "ltwrappr.h"
L_INT LTwain::SetImageUnit (nUnit)
Specifies the unit value to set. For more information on possible values, refer to the TWAIN specification.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function internally sets the image unit capability ICAP_UNITS. For more information on this capability, refer to the TWAIN specification.
To obtain the current image unit value, call the LTwain::GetImageUnit function.
L_INT LTwain__SetImageUnitExample(LTwain * plTwain)
{
L_INT nRet = SUCCESS;
L_INT nUnit;
nRet = plTwain->GetImageUnit (&nUnit);
if (nRet == SUCCESS)
{
if (nUnit == TWUN_INCHES)
{
nRet = plTwain->SetImageUnit(TWUN_INCHES);
if(nRet != SUCCESS)
return nRet;
}
}
else
return nRet;
L_INT nBPP;
nRet = plTwain->GetImageBitsPerPixel (&nBPP);
if (nRet == SUCCESS)
{
if (nBPP == 24)
plTwain->SetImageBitsPerPixel (24);
}
else
return nRet;
return SUCCESS;
}