Sets the image frame used when transferring images from the current TWAIN source.
#include "ltwrappr.h"
L_INT LTwain::SetImageFrame (pFrame);
Pointer to a variable that contains the image frame value to set.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The image frame specifies the size and location of the image to acquire. To obtain the current image frame value, call the LTwain::GetImageFrame function.
TW_FIX32 FloatToTWFix32 (float Floater)
{
TW_FIX32 Fix32;
TW_INT32 Int32 = (TW_INT32)(Floater * 65536.0 + 0.5);
Fix32.Whole = (TW_INT16) (Int32 >> 16);
Fix32.Frac = (TW_UINT16) (Int32 & 0x0000FFFFL);
return Fix32;
}
L_INT LTwain__SetImageFrameExample(LTwain * plTwain)
{
L_INT nRet = SUCCESS;
TW_FRAME frame;
nRet = plTwain->GetImageFrame (&frame);
if (nRet == SUCCESS)
{
frame.Left = FloatToTWFix32(0);
frame.Top = FloatToTWFix32(0);
frame.Right = FloatToTWFix32(8.5);
frame.Bottom = FloatToTWFix32(11);
nRet = plTwain->SetImageFrame(&frame);
if(nRet != SUCCESS)
return nRet;
}
else
return nRet;
return SUCCESS;
}