Code Flow
sane_init()
sane_get_devices()
- select the scanner you want to use
/ sane_open();
|
| / - use
| | sane_get_option_descriptor() and
| | sane_control_option()
| \ to set the options you would like.
|
| / sane_start() set up everything for the scan.
| | sane_get_parms() get the parameters. If you don't like them,
| | you can go to sane_stop() ...
| | - if params is not NULL use
| | sane-read()
| | to get the image, until it returns EOF or
| | a user pressed the cancel-button.
| \ go back to sane_start,in case there are more channels or images.
| sane_cancel()
|
\ sane_close()
sane_exit()
sane_init and sane_exit are intended to set up the whole library. This is
especially needed for the wrapper library that will detect all available
sources here.
sane_get_devices will return all found devices.
When you have chosen the device to use, you
- open the scanner via sane_open
- use sane_get_option_desc to find out all about the controls
that the device offers
- You use sane_control_options to read out/set the options. This can be
done repeatedly and the information gathered here should probably be
transformed into a dialog.
- Start the scanning process via sane_start. The driver will now calculate
the parameters for the scan. It is up to the driver to start the scanning
process here or at some later stage up to sane_read.
- Get the parameters needed to interpret the data that will come from
sane_read. If it returns NULL, no more images are present.
- Read the data using sane_read. SANE_READ returns EOF when the channel
is through.
- You should now check for more images/channels to follow.
Call sane_start and sane_get_param again.
This is used to put together multi-channel data which comes e.g. from
3-pass scanners and for implementing muti-window-scans to save
calibration-times.
- Use sane_cancel to quit acquiring the image. This should be called, when
no more data is available or the user indicated, that (s)he wants to
cancel the operation.
- Use sane_close if you want to quit working with a particular scanner.
- Use sane_exit to quit using SANE.