Hi, On Sun, Feb 23, 2003 at 12:58:56AM +1100, Martijn van Oosterhout wrote: > On Sat, Feb 22, 2003 at 02:06:31PM +0100, Bertrik Sikken wrote: > > There is a document somewhere on www.mostang.com/sane which describes > > the sane api quite well. > > I havn't found this document yet, but I'm making good progress.
It's called the "SANE Standard" or "Programmer's Manual". It can be found on the documentation page: http://www.mostang.com/sane/docs.html Some tips are also in doc/backend-writing.txt. E.g. for writing portable code. > > Some important functions in the sane api are > > * sane_get_parameters, which reports the actual size in pixels and bytes > > if the scan would be done with the currently set scanner settings. > > So you may need to convert from mm to pixels here. > > At what stage is this function called? Because I can get the scanner to give > me the actual values rather than my guesses, but it's not good if it's going > to be called dozens of times before the actual scan starts. sane_get_parameters can be called before and after sane_start. Before sane_start, you can just guess the parameters, after that they must be exact and can't be changed. More details are in the standard. > > * sane_start, which indicates that image capture should be started. > > Here you could probably convert the scan options into values / tables > > that the scanner hardware understands. > > * sane_read, which reads chunks of image data. > > Can I safely assume the caller of sane_read will provide a buffer >10K. > Probably not hey? So I have to buffer possibly down to the subpixel level. No. The buffer can be as low as 1 byte. In backends that need to do image manipulation, usually a buffer of one or multiple scan lines is used. Especially if you need to do line distance correction (CCD scanners), you may need 10 or more lines of each color. Bye, Henning