de.softpro.signware.SPScanner Class Reference
Inheritance diagram for de.softpro.signware.SPScanner:
List of all members.
Detailed Description
Representation of a Signware scanner object.
The scanner object allows accessing a scanner device
Please read Scanner overview in ScannerOverview.
- Note:
- Restriction in the java implementation
the class SPScanner is not serializable
Please always dispose the SPScanner object before exiting the application.
- Operating Systems:
- Windows (Win32)
|
Public Member Functions |
void | capture (boolean bWithGui, java.awt.Component component) throws SPSignwareException |
| Capture one or more images from the selected device.
|
void | captureInteractive (java.awt.Component component) throws SPSignwareException |
| Capture an image from a camera or a video device.
|
void | captureInteractiveDone (int iResult, int iOption) throws SPSignwareException |
| Finalize a capture process that was started with captureInteractive.
|
void | clearImages () throws SPSignwareException |
| Clear all images in this object.
|
SPPropertyMap | getCapabilities () throws SPSignwareException |
| Query the Capabilities of the scanner device.
|
SPImage | getImage (int iIndex) throws SPSignwareException |
| Query an image that was captured in the last capture process.
|
int | getNumberImages () throws SPSignwareException |
| Query the number of images that were captured in the last capture process.
|
SPPropertyMap | getSettings () throws SPSignwareException |
| Query the Settings of the scanner device.
|
void | setListener (SPScannerEventListener aListener) |
| Register a ScannerEventListener.
|
void | setSettings (SPPropertyMap map) throws SPSignwareException |
| Set the Settings of the scanner device.
|
| SPScanner (SPPropertyMap map, java.awt.Component component) throws SPSignwareException |
| Create a new scanner object.
|
Package Functions |
final native int | jniFree () |
Constructor & Destructor Documentation
|
Create a new scanner object.
SPScanner will create the according scanner object if map contains a valid driver class string and a valid device identifyer string.
SPScanner will popup a device selection dialog if map contains a valid driver class string. The dialog will be modal to the passed parent window handle.
SPScanner will throw an exception if an invalid driver class string or an invalid device identifyer string is passed.
See SPScannerEnum for valid driver class names
A scanner object is bound to a hardware resource wich should be free as soon as possible. Call dispose() to free the hardware reference if you no longer need the scanner object.
- Parameters:
-
| map | [i] the property map to select a scanner device. The map must include the driver class name in "DriverClassName" and optionally the device identifyer in "DeviceId", as returned in a SPScannerEnum object |
| component | [i] a heavy weight component which may be used as a parent for an optional modal selection dialog, should be the dialog or frame object of the application. |
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerCreate
|
Member Function Documentation
void de.softpro.signware.SPScanner.capture |
( |
boolean |
bWithGui, |
|
|
java.awt.Component |
component |
|
) |
throws SPSignwareException |
|
|
Capture one or more images from the selected device.
The captured images will be saved in the native pSPSCANNER_T object, call getNumberImages and getImage to retrieve images.
- Note:
- This function is synchronous, however some drivers may process the message queue. The application must assure that it cannot exit while capture is called.
- Parameters:
-
| bWithGui | [i] capture mode
- true: popup the vendor capture GUI and pass the image based on the settings in the dialog
- false: capture an image based on the local settings, see SPScannerSetSettings,
GUI less operation is not supported for Video or Camera devices. The application may determine the device type using Property "DeviceType" in the Capabilities map, see SPScannerGetCapabilities
|
| component | [i] parent window, heavy weight component, Frame or Dialog, dialogs and messages will be modal to the parent window |
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerCapture
- Example:
void scanImage(pSPPpropertyMap pDescriptor, Component parent) throws SPSignwareException
{
SPScanner pScanner = new SPScanner(pDescriptor, parent);
pScanner.capture(true, parent);
int iNumImages = pScanner.getNumberImages();
for(int ik = 0; ik < iNumImages; ik++) {
SPImage pImage = = pScanner.getImage(ik);
showImage(pImage);
}
pScanner.dispose();
}
- Example:
void scanImage(SPPropertyMap pDescriptor, Component parent) throws SPSignwareException
{
int iNumImages = 0;
SPScanner pScanner = new SPScanner(pDescriptor, parent);
SPPropertyMap pSettings = pScanner.getSettings();
if(popupSettingDialog(parent, pSettings) != SP_NOERR) {
pScanner.dispose();
return SP_CANCELERR;
}
pScanner.setSettings(pSettings);
pScanner.capture(false, parent);
int iNumImages = pScanner.getNumberImages();
for(int ik = 0; ik < iNumImages; ik++) {
SPImage pImage = pScanner.getImage(ik);
if(rc == SP_NOERR) showImage(pImage);
}
pScanner.dispose();
}
|
void de.softpro.signware.SPScanner.captureInteractive |
( |
java.awt.Component |
component |
) |
throws SPSignwareException |
|
|
Capture an image from a camera or a video device.
The function returns immediately. You must call captureInteractiveDone to complete the capture process.
This function behaves different depending on the device type:
- Scanner not supported
- Camera all images currently saved in the camera will be enumerated and thumbnails will be created in the images container when the method returns. call getNumberImages and getImage to enumerate the returned thumbnails.
- Video a live video stream will be displayed in the passed window handle.
Some restrictions apply to video live streams in a java environment:
- The video camera drivers may break the jvm message queue processing, the jvm will the be non responding.
The underlaying native code will create a video capture process and display the live video stream in the capture process. The capture process is hooked into the java Component. - The video camera driver driver does not support resizing the live stream, call setResizeable(false) to prevent resizing the live video stream.
- The video capture process does not support windows attributes such as background color.
- Note:
- The twain interface supports cameras and video devices only when using the vendor gui. The Twain implementation of captureInteractive will return SP_UNSUPPORTEDERR.
The WIA2 interface does not support video cameras, the WIA2 implementation of captureInteractive will return SP_UNSUPPORTEDERR if the device is a video camera.
- Parameters:
-
| component | [i] draw window, heavy weight component, the component will be used to render the live video or as a parent to display modal error messages |
- Exceptions:
-
| SPSignwareException | on errors
- SP_PARAMERR parameter error
- SP_UNSUPPORTEDERR the function is not supported
- SP_SESSIONERR wrong state
- SP_BUSYERR the device is busy
|
- Operating Systems:
- Windows (Win32)
- See also:
- captureInteractiveDone, SPScannerCaptureInteractive
- Todo:
- Support video streams
|
void de.softpro.signware.SPScanner.captureInteractiveDone |
( |
int |
iResult, |
|
|
int |
iOption |
|
) |
throws SPSignwareException |
|
|
Finalize a capture process that was started with captureInteractive.
- Parameters:
-
| iResult | [i] pass SP_NOERR to query the image, SP_CANCELERR to abort the capture process without image transfer |
| iOption | [i] optional parameter, depends on the device
- Scanner: iOption ignored, pass 0
- Camera: iOption equals the zero based index of the requested image
- Video camera: iOption is ignored, pass 0
|
- Exceptions:
-
| SPSignwareException | on errors
- SP_PARAMERR parameter error
- SP_UNSUPPORTEDERR the function is not supported
- SP_SESSIONERR wrong state
- SP_BUSYERR the device is busy
|
- Operating Systems:
- Windows (Win32)
- See also:
- captureInteractive, SPScannerCaptureInteractiveDone
|
|
Clear all images in this object.
Clear all images of the last capture process to release resources
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerClearImages
|
|
Query the Capabilities of the scanner device.
- Returns:
- SPPropertyMap the Capabilities container
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerGetCapabilities
|
|
Query an image that was captured in the last capture process.
- Parameters:
-
| iIndex | [i] zero-based index of the image, must be less than the total number of images scanned |
- Returns:
- SPImage the requested image
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerGetImage, getNumberImages
|
|
Query the number of images that were captured in the last capture process.
- Returns:
- int the number of images that were scanned
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerGetNumberImages
|
|
Query the Settings of the scanner device.
- Returns:
- SPPropertyMap the Settings container
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerGetSettings
|
final native int de.softpro.signware.SPScanner.jniFree |
( |
|
) |
[package, virtual] |
|
|
Register a ScannerEventListener.
- Parameters:
-
| aListener | [i] the listener that will be invoked on scanner events while capturing images |
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
|
|
Set the Settings of the scanner device.
- Parameters:
-
- Exceptions:
-
- Operating Systems:
- Windows (Win32), Linux (i386), Linux (x86_64)
- See also:
- SPScannerSetCapabilities
|
The documentation for this class was generated from the following file: