SCGetScanLine(3) Impressario SCGetScanLine(3)NAME
SCGetScanLine, SCGetFD, SCDataReady - retrieving scan data
SYNOPSIS
#include <stdio.h>
#include <scanner.h>
int SCGetScanLine(SCANNER *s, void *buf, long bytes);
int SCGetFD(SCANNER *s);
int SCDataReady(SCANNER *s);
DESCRIPTIONSCGetScanLine retrieves scan line data. s specifies a connection to a
scanner for which SCScan(3) has been called previously. buf points to
memory into which the data will be stored, and bytes should be set to the
number of bytes in a scan line as determined by SCGetScanSize(3).
For color planar data, SCGetScanLine will need to be called once for each
line in each plane of data. For 100 lines of 24 bit planar RGB data,
SCGetScanLine will be called a total of 300 times, with the first 100
calls retrieving the red plane, the second 100 calls retrieving the green
plane, and the third 100 calls retrieving the blue plane. For other
types of data, SCGetScanLine will need to be called once for each line of
data. The number of lines can be determined by calling SCGetScanSize(3).
SCGetScanLine cannot be called to retrieve scan data if scanning was
initiated by a call to SCScanFD(3).
If scanning was initiated by a call to SCScan(3), SCGetFD returns a file
descriptor from which scan data can be read. This file descriptor can be
used with the select(2) system call to determine when SCGetScanLine(3)
should be called, or the data can be read directly from the file
descriptor as an alternative means of retrieving the scan data.
If scanning was initiated by a call to SCScanFD(3), SCGetFD will return
the file descriptor that was passed to SCScanFD(3).
SCDataReady is used to determine whether the scanner driver has prepared
any data for transfer. It can be used to determine when SCGetScanLine
should be called. It should not be used if scanning was initiated by a
call to SCScanFD(3).
RETURN VALUESCGetScanLine returns 0 if successful, and -1 if an error occurs.
SCGetFD returns a file descriptor from which scan data may be read if
scanning was initiated by a call to SCScan(3). If scanning was initiated
by a call to SCScanFD, SCGetFD returns the file descriptor that was
passed to SCScanFD. If an error occurs, SCGetFD returns -1.
Page 1
SCGetScanLine(3) Impressario SCGetScanLine(3)
SCDataReady returns 1 if data is ready to be retrieved from the scanner.
0 is returned if data is not ready, and -1 is returned if an error
occurs.
If the return value of one of these functions indicates that an error has
occurred, the cause of the error can be determined by inspecting the
value of the global variable SCerrno.
EXECUTION ERROR CODES
SCGetScanLine, SCGetFD, and SCDataReady will fail under the following
circumstances.
SCESCANFD SCGetScanLine called after SCScanFD
SCECOMM Error communicating with scanner driver
SEE ALSOlibscan(3), SCScan(3), SCScanFD(3).
Page 2