Acquires an image from a SANE device.
#include "ltsane.h"
L_LTSANE_API L_INT L_SaneAcquire(hSane, bitmap, structSize)
SANE handle
The acquired bitmapHandle
Size, in bytes, of the structure pointed to by bitmap
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Initiate the SANE handle (hSane) before acquiring images.
Linux
This example shows how to acquire a colored image.
L_INT AcquireImage(L_SaneHandle hSane, pBITMAPHANDLE bitmap)
{
// Get the scanning mode value
L_TCHAR* value = NULL;
L_INT ret = L_SaneGetOptionValue(hSane, SANE_NAME_SCAN_MODE, &value);
if(ret != SUCCESS)
return ret;
if(strcmp(value, SANE_VALUE_SCAN_MODE_COLOR) != 0)
{
// Set the scanning mode to "Color"
ret = L_SaneSetOptionValue(hSane, SANE_NAME_SCAN_MODE, SANE_VALUE_SCAN_MODE_COLOR);
}
// Free the value buffer
L_SaneFreeMemory(value);
// Scan an image
return L_SaneAcquire(hSane, bitmap, sizeof(BITMAPHANDLE));
}