Modifier and Type | Class and Description |
---|---|
static class |
ScreenWebcam.ScreenFrameFormat
ScreenFrameFormat |
IWebcam.FrameFormat, IWebcam.IListener
Constructor and Description |
---|
ScreenWebcam(java.lang.String name,
java.awt.GraphicsDevice device)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
VideoFrame |
capture()
Captures single frame.
|
void |
close()
Closes webcam.
|
static java.awt.Rectangle |
createRectangleByFormat(IWebcam.FrameFormat format)
Creates
Rectangle equivalent to the format . |
IWebcam.FrameFormat[] |
getFormats(java.lang.Object... args)
Returns supported formats.
|
java.lang.String |
getId()
Returns device id.
|
java.lang.String |
getName()
Returns device name.
|
boolean |
isOpen()
Checks if webcam is open in the current application.
|
void |
open(IWebcam.FrameFormat format,
IWebcam.IListener listener)
Opens webcam using
format . |
boolean |
setFrameFormat(IWebcam.FrameFormat format)
Sets capture frame format.
|
void |
setFrameRate(float frameRate)
Sets capture frame rate (in frames per second).
|
void |
startCapture()
Starts capture.
|
void |
stopCapture()
Stops capture.
|
java.lang.String |
toString() |
public ScreenWebcam(java.lang.String name, java.awt.GraphicsDevice device) throws java.lang.Exception
name
- device
- java.lang.Exception
public static java.awt.Rectangle createRectangleByFormat(IWebcam.FrameFormat format)
Rectangle
equivalent to the format
.format
- frame formatnull
if format
is nullpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getId()
IWebcam
public java.lang.String getName()
IWebcam
public IWebcam.FrameFormat[] getFormats(java.lang.Object... args)
IWebcam
Note:
- method returns valid formats only after successful IWebcam#open()
invocation
- returned null
means that supported formats enumeration functionality
is not supported
getFormats
in interface IWebcam
public boolean isOpen()
IWebcam
public void open(IWebcam.FrameFormat format, IWebcam.IListener listener) throws java.lang.Exception
IWebcam
format
.
Note:
- The method opens webcam asynchronously.
IWebcam.isOpen()
method returns true
after webcam is opened successfully
public boolean setFrameFormat(IWebcam.FrameFormat format)
IWebcam
Note:
- This method should be called after the webcam is opened.
setFrameFormat
in interface IWebcam
format
- new frame format for webcam capturetrue
if format was set successfully;
false
if failed to set formatpublic void setFrameRate(float frameRate)
IWebcam
setFrameRate
in interface IWebcam
frameRate
- frame rate (in frames per second)public void startCapture()
IWebcam
Note:
- This method should be called after the webcam is opened.
startCapture
in interface IWebcam
public void stopCapture()
IWebcam
stopCapture
in interface IWebcam
public VideoFrame capture()
IWebcam
Note:
- This method should be called after the webcam is opened.