ACT-CV - Machine Vision for Cognitive Modeling
|
wrapper for java.awt.Robot
More...
#include <Robot.h>
Public Member Functions | |
Robot () | |
create a new VM and an instance of java.awt.Robot More... | |
~Robot () | |
destroy the VM More... | |
int | GetScreenWidth () const |
int | GetScreenHeight () const |
void | AttachCurrentThread () |
void | DetachCurrentThread () |
void | SetAutoDelay (int ms) |
set the wait delay after generated events More... | |
void | Delay (int ms) |
wait the given time More... | |
void | MouseMove (int x, int y) |
move the mouse on the screen More... | |
void | MousePress (int buttons) |
press (not click) a mouse button More... | |
void | MouseRelease (int buttons) |
release a mouse button More... | |
void | KeyPress (int keycode) |
press (not click) a key More... | |
void | KeyRelease (int keycode) |
release a key on the keyboard More... | |
int | GetPixelRGB (int x, int y) |
get the color of the screen of the given position More... | |
IplImage * | GetScreenCapture (int left, int top, int right, int bottom) |
create a rectangular screen capture More... | |
Public Member Functions inherited from JVM | |
JVM () | |
create the VM with additional classpath "." More... | |
JVM (const char *cp) | |
create the VM with additional classpath cp More... | |
~JVM () | |
(don't) destroy the vm More... | |
Protected Member Functions | |
jobject | CreateRect (int x, int y, int width, int height) |
create a new instance of java.awt.Rectangle More... | |
jobject | CreateScreenRect () |
create a new instance of java.awt.Rectangle for the whole screen More... | |
Protected Member Functions inherited from JVM | |
JNIEnv * | GetEnv () |
the environment More... | |
void | CreateJVM (const char *classpath) |
create the Java Virtual Machine More... | |
jobject | CreateGlobalRef (jobject obj) |
hinder the VM from garbage collecting obj More... | |
jclass | CreateGlobalRef (jclass obj) |
hinder the VM from garbage collecting obj More... | |
void | AttachCurrentThread () |
threads different from the one within which the VM was created must be attached More... | |
void | DetachCurrentThread () |
any attached thread has to be detached afterwards More... | |
int | GetThreadId () |
system specific code! More... | |
JavaVM * | GetCreatedJavaVM () |
pointer to an already created virtual machine More... | |
Protected Attributes | |
int | screenWidth |
width of the screen at instantiation More... | |
int | screenHeight |
height of the screen at instantiation More... | |
Protected Attributes inherited from JVM | |
JavaVM * | jvm |
pointer to the virtual machine More... | |
Private Attributes | |
jclass | cls |
class java.awt.Robot More... | |
jobject | robot |
an instance of java.awt.Robot More... | |
jclass | colorCls |
class java.awt.Color More... | |
jclass | rectCls |
class java.awt.Rectangle More... | |
jmethodID | initRectMID |
method id of a constructor of java.awt.Rectangle More... | |
jmethodID | setAutoDelayMID |
jmethodID | delayMID |
jmethodID | mouseMoveMID |
jmethodID | mousePressMID |
jmethodID | mouseReleaseMID |
jmethodID | keyPressMID |
jmethodID | keyReleaseMID |
jmethodID | getPixelColorMID |
jmethodID | getRGBMID |
jmethodID | createScreenCaptureMID |
jclass | bufrImgCls |
jmethodID | getRGBArrMID |
wrapper for java.awt.Robot
All method IDs are calculated at startup and cached
Method IDs are independent of the current environment and thread. Therefore there's no problem with caching them.
Robot::Robot | ( | ) |
create a new VM and an instance of java.awt.Robot
Definition at line 33 of file Robot.cpp.
References bufrImgCls, cls, colorCls, JVM::CreateGlobalRef(), createScreenCaptureMID, delayMID, JVM::GetEnv(), getPixelColorMID, getRGBArrMID, getRGBMID, initRectMID, keyPressMID, keyReleaseMID, MHDBGMSG, MHDBGMSG_P, mouseMoveMID, mousePressMID, mouseReleaseMID, rectCls, robot, screenHeight, screenWidth, and setAutoDelayMID.
Robot::~Robot | ( | ) |
destroy the VM
Definition at line 135 of file Robot.cpp.
References JVM::GetEnv(), MHDBGMSG, and robot.
void Robot::AttachCurrentThread | ( | ) |
Definition at line 95 of file Robot.h.
References JVM::AttachCurrentThread().
|
protected |
create a new instance of java.awt.Rectangle
Definition at line 72 of file Robot.h.
References JVM::GetEnv(), initRectMID, and rectCls.
Referenced by CreateScreenRect(), and GetScreenCapture().
|
protected |
create a new instance of java.awt.Rectangle
for the whole screen
Definition at line 141 of file Robot.cpp.
References CreateRect(), JVM::GetEnv(), rectCls, screenHeight, and screenWidth.
void Robot::Delay | ( | int | ms) |
wait the given time
Definition at line 113 of file Robot.h.
References delayMID, JVM::GetEnv(), and robot.
void Robot::DetachCurrentThread | ( | ) |
Definition at line 98 of file Robot.h.
References JVM::DetachCurrentThread().
int Robot::GetPixelRGB | ( | int | x, |
int | y | ||
) |
get the color of the screen of the given position
x | horizontal position in screen coordinates |
y | vertical position in screen coordinates |
The origin of the screen coordinate system is the upper left corner of the screen.
Definition at line 159 of file Robot.cpp.
References JVM::GetEnv(), getPixelColorMID, getRGBMID, and robot.
IplImage * Robot::GetScreenCapture | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
create a rectangular screen capture
left, top, right, bottom are the corners of the rectangle in screen coordinates
The origin of the screen coordinate system is the upper left corner of the screen.
The capture is returned as an IplImage* for the use with OpenCV
Definition at line 168 of file Robot.cpp.
References CreateRect(), createScreenCaptureMID, JVM::GetEnv(), getRGBArrMID, JVM::jint(), MHDBGMSG, MHDBGMSG_P, MULT, Rgb2Scalar(), and robot.
Referenced by RobotFrameSource::GetNextFrame().
int Robot::GetScreenHeight | ( | ) | const |
Definition at line 91 of file Robot.h.
References screenHeight.
Referenced by main(), and SelectSourceInternal().
int Robot::GetScreenWidth | ( | ) | const |
Definition at line 88 of file Robot.h.
References screenWidth.
Referenced by main(), and SelectSourceInternal().
void Robot::KeyPress | ( | int | keycode) |
press (not click) a key
Definition at line 147 of file Robot.h.
References JVM::GetEnv(), keyPressMID, and robot.
void Robot::KeyRelease | ( | int | keycode) |
release a key on the keyboard
Definition at line 155 of file Robot.h.
References JVM::GetEnv(), keyReleaseMID, and robot.
void Robot::MouseMove | ( | int | x, |
int | y | ||
) |
move the mouse on the screen
Definition at line 121 of file Robot.h.
References JVM::GetEnv(), mouseMoveMID, and robot.
void Robot::MousePress | ( | int | buttons) |
press (not click) a mouse button
Definition at line 130 of file Robot.h.
References JVM::GetEnv(), mousePressMID, and robot.
void Robot::MouseRelease | ( | int | buttons) |
release a mouse button
Definition at line 138 of file Robot.h.
References JVM::GetEnv(), mouseReleaseMID, and robot.
void Robot::SetAutoDelay | ( | int | ms) |
set the wait delay after generated events
Definition at line 105 of file Robot.h.
References JVM::GetEnv(), robot, and setAutoDelayMID.
|
private |
|
private |
|
private |
Definition at line 174 of file Robot.h.
Referenced by GetScreenCapture(), and Robot().
|
private |
|
private |
Definition at line 160 of file Robot.h.
Referenced by GetPixelRGB(), and Robot().
|
private |
Definition at line 176 of file Robot.h.
Referenced by GetScreenCapture(), and Robot().
|
private |
Definition at line 161 of file Robot.h.
Referenced by GetPixelRGB(), and Robot().
|
private |
method id of a constructor of java.awt.Rectangle
Definition at line 63 of file Robot.h.
Referenced by CreateRect(), and Robot().
|
private |
Definition at line 144 of file Robot.h.
Referenced by KeyPress(), and Robot().
|
private |
Definition at line 152 of file Robot.h.
Referenced by KeyRelease(), and Robot().
|
private |
Definition at line 118 of file Robot.h.
Referenced by MouseMove(), and Robot().
|
private |
Definition at line 127 of file Robot.h.
Referenced by MousePress(), and Robot().
|
private |
Definition at line 135 of file Robot.h.
Referenced by MouseRelease(), and Robot().
|
private |
class java.awt.Rectangle
Definition at line 61 of file Robot.h.
Referenced by CreateRect(), CreateScreenRect(), and Robot().
|
private |
an instance of java.awt.Robot
Definition at line 55 of file Robot.h.
Referenced by Delay(), GetPixelRGB(), GetScreenCapture(), KeyPress(), KeyRelease(), MouseMove(), MousePress(), MouseRelease(), Robot(), SetAutoDelay(), and ~Robot().
|
protected |
height of the screen at instantiation
Definition at line 69 of file Robot.h.
Referenced by CreateScreenRect(), GetScreenHeight(), and Robot().
|
protected |
width of the screen at instantiation
Definition at line 67 of file Robot.h.
Referenced by CreateScreenRect(), GetScreenWidth(), and Robot().
|
private |
Definition at line 102 of file Robot.h.
Referenced by Robot(), and SetAutoDelay().