public interface ScanListener
SaneDevice.acquireImage(ScanListener)
method.
If you are only interested in a subset of these events, you may want to extend
ScanListenerAdapter instead of implementing this interface.
If you are using ScanListener to update a user interface, the frequency of notifications
(specifically from recordRead(au.com.southsky.jfreesane.SaneDevice, int, int)) may be too frequent. In this case, you can wrap your
listener using one of the methods in RateLimitingScanListeners to obtain a listener that
drops notifications occurring too frequently.
Notifications will tend to occur as follows:
scanningStarted -- once a page scan has commencedframeAcquisitionStarted -- once for each frame. Typically there is only one frame per
page, but in older three-pass color scanners (where one scan pass is made per color), there will
be three frames per pagerecordRead -- once for each record, one or more records make up a framescanningFinished -- once a page has been scannedJFreeSane attempts to report accurate numbers to listeners, but this is not possible in all cases. In general, you should not depend on data obtained from the listener when this could affect program correctness.
| Modifier and Type | Method and Description |
|---|---|
void |
frameAcquisitionStarted(SaneDevice device,
au.com.southsky.jfreesane.SaneParameters parameters,
int currentFrame,
int likelyTotalFrames)
Called once frame acquisition has begun.
|
void |
recordRead(SaneDevice device,
int totalBytesRead,
int imageSizeBytes)
Called once for each record in a frame.
|
void |
scanningFinished(SaneDevice device)
Called once the current page is done.
|
void |
scanningStarted(SaneDevice device)
Called once scanning has begun.
|
void scanningStarted(SaneDevice device)
device - the device that is now acquiring an imagevoid frameAcquisitionStarted(SaneDevice device, au.com.southsky.jfreesane.SaneParameters parameters, int currentFrame, int likelyTotalFrames)
device - the device that is acquiring the frameparameters - the parameters of the acquisitioncurrentFrame - the zero-based index of the frame in the current scan (normally 0, but will
be 0, 1 and 2 in successive calls for three-pass scanners)likelyTotalFrames - the number of frames that are likely to be received in this scan.
JFreeSane cannot know this for sure, so the number should not be relied upon for program
correctnessvoid recordRead(SaneDevice device, int totalBytesRead, int imageSizeBytes)
device - the device that acquired the recordtotalBytesRead - the number of bytes read so far in this frameimageSizeBytes - the total number of bytes in the frame. When this cannot be known in
advance, this will be set to -1 (e.g. the scanner is a hand-held scanner or uses page height
detection)void scanningFinished(SaneDevice device)
device - the device that is now finished acquiring a page