/** * create a ScreenImage with given rectangle on this screen. * * @param rect The Rectangle to be captured * @return the image of the region */ @Override public ScreenImage capture(Rectangle rect) { log(lvl + 1, "Screen.capture: (%d,%d) %dx%d", rect.x, rect.y, rect.width, rect.height); ScreenImage simg = robot.captureScreen(rect); lastScreenImage = simg; return simg; }
private void initScreen() { curGD = gdevs[curID]; Rectangle bounds = getBounds(); x = (int) bounds.getX(); y = (int) bounds.getY(); w = (int) bounds.getWidth(); h = (int) bounds.getHeight(); try { robot = new RobotDesktop(this); robot.setAutoDelay(10); } catch (AWTException e) { Debug.error("Can't initialize Java Robot on Screen " + curID + ": " + e.getMessage()); robot = null; } }