Re: calculation of bytes to read, bytes per line etc

abel deuring (a.deuring@satzbau-gmbh.de)
Mon, 28 Jun 1999 18:42:05 +0200

Hi Meino !

> Unfortunatly, there most be some round errors or
> something like that, cause Xscanimage gets (or means)
> a greater amount of bytes to read, than my scanner is
> willing to send.

If it is possible for the Avision scanner, an easy and reliable solution
would be to ask the scanner how many bytes it will return for a scan:
The frontends call sane_get_parameters after a scan is started in order
to get the real scan size.

Several backends have the function sane_get_parameters implemented like
this:

SANE_Status sane_get_parameters(SANE_Handle handle, SANE_Parameters
*params)
{
Scanner *s = handle;

if (!s->scanning) {
/* estimate the number of pixel per line and the number of
scan lines based on the selected resolution, scan window
size etc., and set *params accordingly
*/
...
}
else {
/* the scanner has received a "set window" and a "start scan"
command; now ask the scanner how many pixels per line
and how many lines it will send. Set *params accordingly
*/
...
}
}

Abel

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com