Package org.sikuli.api.visual

Examples of org.sikuli.api.visual.ScreenRegionCanvas


     
      ScreenRegion screenRegion = new DesktopScreenRegion(screenId);
      ScreenRegion innerRegion = Relative.to(screenRegion).shorter(100).narrower(100).getScreenRegion();

      // create a canvas to draw visualization on the screen
      Canvas c = new ScreenRegionCanvas(screenRegion);
      c.addBox(innerRegion);
      c.addLabel(innerRegion.getCenter(), "Screen " + screenId).withFontSize(30);
      c.addImage(Relative.to(innerRegion).center().above(200).getScreenLocation(), ImageIO.read(Images.Dog));
      c.show();
     
      // hover the mouse cursor to each corner of the inner circle
      mouse.hover(Relative.to(innerRegion).topLeft().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).topRight().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).bottomRight().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).bottomLeft().getScreenLocation());
     
      // find the dog and click on it
      ScreenRegion dog = innerRegion.find(new ImageTarget(Images.Dog));
      mouse.click(dog.getCenter());
     
      c.hide();
    }
   
 
  }
View Full Code Here


   
    Target imageTarget = new ImageTarget(Images.ThumbIcon);

    ScreenRegion thumb = s.find(imageTarget);

    ScreenRegionCanvas canvas = new ScreenRegionCanvas(s);
    canvas.addBox(thumb);
    canvas.addLabel(Relative.to(thumb).topLeft().above(20).getScreenLocation(), "ImageTarget:");
    canvas.addImage(Relative.to(thumb).topLeft().above(25).right(85).getScreenLocation(), ImageIO.read(Images.ThumbIcon));
    canvas.display(3);

    Target target = new ImageTarget(Images.UncheckedCheckbox);   
    List<ScreenRegion> checkboxes = s.findAll(target);

    canvas.clear();   
    int no = 1;
    for (ScreenRegion r : checkboxes){     
      String labelText = String.format("(%d):%1.3f", no, r.getScore());
      canvas.addBox(r).withLineColor(Color.green).withLineWidth(1);
      canvas.addLabel(Relative.to(r).topLeft().left(70).getScreenLocation(),labelText).withColor(Color.blue);
      no++;
    }
    canvas.display(3);
   
    simulator.close();
   
  }
View Full Code Here

TOP

Related Classes of org.sikuli.api.visual.ScreenRegionCanvas

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.