コード例 #1
0
ファイル: ScreenUnion.java プロジェクト: eric011/Sikuli12.11
 @Override
 public Rectangle getBounds() {
   if (_bounds == null) {
     _bounds = new Rectangle();
     for (int i = 0; i < Screen.getNumberScreens(); i++) {
       _bounds = _bounds.union(Screen.getBounds(i));
     }
   }
   return _bounds;
 }
コード例 #2
0
ファイル: ScreenUnion.java プロジェクト: eric011/Sikuli12.11
  @Override
  public ScreenImage capture(Rectangle rect) {
    Debug.log(5, "capture: " + rect);

    BufferedImage ret = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = ret.createGraphics();
    for (int i = 0; i < Screen.getNumberScreens(); i++) {
      Rectangle scrBound = Screen.getBounds(i);
      if (scrBound.intersects(rect)) {
        Rectangle inter = scrBound.intersection(rect);
        Debug.log(5, "scrBound: " + scrBound + ", inter: " + inter);
        int ix = inter.x, iy = inter.y;
        inter.x -= scrBound.x;
        inter.y -= scrBound.y;
        ScreenImage img = robots[i].captureScreen(inter);
        g2d.drawImage(img.getImage(), ix - rect.x, iy - rect.y, null);
      }
    }
    g2d.dispose();
    return new ScreenImage(rect, ret);
  }