org.sikuli.api.visual
Class Canvas

java.lang.Object
  extended by org.sikuli.api.visual.Canvas
Direct Known Subclasses:
ImageCanvas, ScreenRegionCanvas

public abstract class Canvas
extends Object

Canvas class is the abstract base class for all canvas context.


Constructor Summary
Canvas()
           
 
Method Summary
 CanvasBuilder.ElementAdder add()
           
 void add(Element element)
           
 StyleBuilder addBox(Region screenRegion)
          Deprecated. 
 StyleBuilder addCircle(Location screenLocation, int radius)
          Deprecated. 
 StyleBuilder addDot(Location screenLocation)
          Deprecated. 
 StyleBuilder addImage(Location screenLocation, BufferedImage image)
          Deprecated. 
 StyleBuilder addLabel(Location location, String labelText)
          Deprecated. 
 StyleBuilder addLabel(Region region, String labelText)
          Deprecated. 
 Canvas clear()
          Removes all canvas elements.
abstract  BufferedImage createImage()
           
abstract  void display(double seconds)
          Displays a canvas for the specified duration.
 void display(int seconds)
          Displays a canvas for the specified duration.
abstract  void displayWhile(Runnable runnable)
          Displays the canvas and blocks the calling thread, while running the passed runnable on a background thread.
abstract  void hide()
          Clears the shown canvas.
abstract  void show()
          Shows a canvas.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Canvas

public Canvas()
Method Detail

add

public void add(Element element)

addCircle

@Deprecated
public StyleBuilder addCircle(Location screenLocation,
                                         int radius)
Deprecated. 

Adds a circle at the specified location with the specified radius.

Parameters:
screenLocation - the specified screen location.
radius - the specified radius of the circle.
Returns:

addDot

@Deprecated
public StyleBuilder addDot(Location screenLocation)
Deprecated. 

Adds a dot at the specified location.

Parameters:
screenLocation - the specified screen location.
Returns:

addImage

@Deprecated
public StyleBuilder addImage(Location screenLocation,
                                        BufferedImage image)
Deprecated. 

Adds an image at the specified location.

Parameters:
screenLocation - the specified screen location.
image - the specified image.
Returns:

add

public CanvasBuilder.ElementAdder add()

addBox

@Deprecated
public StyleBuilder addBox(Region screenRegion)
Deprecated. 

Adds a box at the specified screen region.

Parameters:
screenRegion - the specified screen region.
Returns:

addLabel

@Deprecated
public StyleBuilder addLabel(Region region,
                                        String labelText)
Deprecated. 

Adds a label at the specified screen region with the specified text.

Parameters:
region - the specified screen region.
labelText - the specified text.
Returns:

addLabel

@Deprecated
public StyleBuilder addLabel(Location location,
                                        String labelText)
Deprecated. 

Adds a label at the specified screen location with the specified text.

Parameters:
location - the specified screen location.
labelText - the specified text.
Returns:

clear

public Canvas clear()
Removes all canvas elements.

Returns:
this Canvas object.

display

public void display(int seconds)
Displays a canvas for the specified duration. This method blocks the calling thread for the specified duration.

Parameters:
seconds - the specified duration in seconds.

display

public abstract void display(double seconds)
Displays a canvas for the specified duration. This method blocks the calling thread for the specified duration.

Parameters:
seconds - the specified duration in seconds.

displayWhile

public abstract void displayWhile(Runnable runnable)
Displays the canvas and blocks the calling thread, while running the passed runnable on a background thread. When the passed Runnable completes, this method returns immediately and hides the canvas.

Parameters:
runnable - A runnable to run in the background.

show

public abstract void show()
Shows a canvas. This is a non-blocking method. The canvas should be hidden using the hide() method.


hide

public abstract void hide()
Clears the shown canvas.


createImage

public abstract BufferedImage createImage()


Copyright © 2014. All rights reserved.