org.sikuli.api
Class AbstractScreenRegion

java.lang.Object
  extended by org.sikuli.api.AbstractScreenRegion
All Implemented Interfaces:
Region, ScreenRegion
Direct Known Subclasses:
DefaultScreenRegion

public abstract class AbstractScreenRegion
extends Object
implements ScreenRegion

AbstractScreenRegion is the abstract base class for all screen region contexts.


Constructor Summary
AbstractScreenRegion(Screen screen)
          Constructs a new AbstractScreenRegion object whose Screen is the specified Screen object, and upper-left corner is at (0, 0) in the coordinate space.
AbstractScreenRegion(Screen screen, int x, int y, int width, int height)
          Constructs a new AbstractScreenRegion object.
 
Method Summary
 Rectangle getBounds()
          Returns the bounding Rectangle of this Region.
 ScreenLocation getCenter()
          Returns the center of this screen region.
 int getHeight()
          Returns the height of the rectangular screen region.
 ScreenLocation getRelativeScreenLocation(int xoffset, int yoffset)
          Returns a ScreenRegion relative to the specified region values.
 ScreenRegion getRelativeScreenRegion(int xoffset, int yoffset, int width, int height)
          Returns a ScreenRegion relative to the specified region values.
 double getScore()
          Returns the minimum matching score of this ScreenRegion, which is set if this screen region was returned as the result of a find command.
 Screen getScreen()
          Returns a Screen object of this ScreenRegion.
 int getWidth()
          Returns the width of the rectangular screen region.
 int getX()
          Returns the X coordinate of the upper-left corner of the rectangular screen region.
 int getY()
          Returns the Y coordinate of the upper-left corner of the rectangular screen region.
 void setBounds(Rectangle newBounds)
          Sets the bounding Rectangle of this Rectangle.
 void setHeight(int height)
          Sets the height of the rectangular screen region.
 void setScore(double score)
          Sets the minimum matching score value for a target to be considered a match.
 void setScreen(Screen screen)
          Sets the Screen of this ScreenRegion to be the specified Screen.
 void setWidth(int width)
          Sets the width of the rectangular screen region.
 void setX(int x)
          Sets the X coordinate of the upper-left corner of the rectangular screen region.
 void setY(int y)
          Sets the Y coordinate of the upper-left corner of the rectangular screen region.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.sikuli.api.ScreenRegion
addROI, addState, addStateChangeEventListener, addTargetEventListener, capture, find, findAll, getLastCapturedImage, getLowerLeftCorner, getLowerRightCorner, getROIs, getState, getStates, getUpperLeftCorner, getUpperRightCorner, removeState, removeTargetEventListener, snapshot, wait
 

Constructor Detail

AbstractScreenRegion

public AbstractScreenRegion(Screen screen)
Constructs a new AbstractScreenRegion object whose Screen is the specified Screen object, and upper-left corner is at (0, 0) in the coordinate space. Since AbstractScreenRegion is an abstract class, applications can't call this constructor directly. Screen regions are obtained from other screen regions contexts.

Parameters:
screen - The Screen to create a region from.

AbstractScreenRegion

public AbstractScreenRegion(Screen screen,
                            int x,
                            int y,
                            int width,
                            int height)
Constructs a new AbstractScreenRegion object. Since AbstractScreenRegion is an abstract class, applications can't call this constructor directly.

Parameters:
screen - The Screen to create a region from.
x - The X coordinate of the upper-left corner of the rectangular screen region.
y - The Y coordinate of the upper-left corner of the rectangular screen region.
width - The width of the rectangular screen region.
height - The height of the rectangular screen region.
Method Detail

getBounds

public Rectangle getBounds()
Description copied from interface: Region
Returns the bounding Rectangle of this Region.

Specified by:
getBounds in interface Region
Returns:
a Rectangle object that represents the bounding of this Region.

setBounds

public void setBounds(Rectangle newBounds)
Description copied from interface: Region
Sets the bounding Rectangle of this Rectangle.

Specified by:
setBounds in interface Region
Parameters:
newBounds - the specified bounding Rectangle.

getRelativeScreenRegion

public ScreenRegion getRelativeScreenRegion(int xoffset,
                                            int yoffset,
                                            int width,
                                            int height)
Description copied from interface: ScreenRegion
Returns a ScreenRegion relative to the specified region values.

Specified by:
getRelativeScreenRegion in interface ScreenRegion
Parameters:
xoffset - Horizontal offset.
yoffset - Vertical offset.
width - the width of this ScreenRegion.
height - the height of this ScreenRegion.
Returns:
a ScreenRegion relative to the specified region values.

getRelativeScreenLocation

public ScreenLocation getRelativeScreenLocation(int xoffset,
                                                int yoffset)
Description copied from interface: ScreenRegion
Returns a ScreenRegion relative to the specified region values.

Specified by:
getRelativeScreenLocation in interface ScreenRegion
Parameters:
xoffset - Horizontal offset.
yoffset - Vertical offset.
Returns:

getCenter

public ScreenLocation getCenter()
Description copied from interface: ScreenRegion
Returns the center of this screen region.

Specified by:
getCenter in interface ScreenRegion
Returns:
a Location object corresponding to the center of the screen region.

toString

public String toString()
Overrides:
toString in class Object

getScreen

public Screen getScreen()
Description copied from interface: ScreenRegion
Returns a Screen object of this ScreenRegion.

Specified by:
getScreen in interface ScreenRegion
Returns:
a Screen object that represents the Screen of this ScreenRegion.

getScore

public double getScore()
Description copied from interface: ScreenRegion
Returns the minimum matching score of this ScreenRegion, which is set if this screen region was returned as the result of a find command. The score should be between 0 and 1 where 1 is the best.

Specified by:
getScore in interface ScreenRegion
Returns:
the minimum matching score value for a target to be considered a match.

setScore

public void setScore(double score)
Description copied from interface: ScreenRegion
Sets the minimum matching score value for a target to be considered a match. This score indicates how similar the match is to the target specified. It accepts a value between 0 and 1. A high score close to 1 means the match must be very similar to the target specified. A low score means a match only somehow similar is acceptable; image recognition is more fuzzy.

Specified by:
setScore in interface ScreenRegion
Parameters:
score - the minimum matching score value for a target to be considered a match. The value should be between 0 and 1.

setScreen

public void setScreen(Screen screen)
Description copied from interface: ScreenRegion
Sets the Screen of this ScreenRegion to be the specified Screen.

Specified by:
setScreen in interface ScreenRegion
Parameters:
screen - the Screen for this ScreenRegion.

getX

public int getX()
Returns the X coordinate of the upper-left corner of the rectangular screen region.

Specified by:
getX in interface Region
Returns:
the X coordinate of the upper-left corner of the rectangular screen region.

setX

public void setX(int x)
Sets the X coordinate of the upper-left corner of the rectangular screen region.

Parameters:
x - the X coordinate of the upper-left corner of the rectangular screen region.

getY

public int getY()
Returns the Y coordinate of the upper-left corner of the rectangular screen region.

Specified by:
getY in interface Region
Returns:
the Y coordinate of the upper-left corner of the rectangular screen region.

setY

public void setY(int y)
Sets the Y coordinate of the upper-left corner of the rectangular screen region.

Parameters:
y - the Y coordinate of the upper-left corner of the rectangular screen region.

getWidth

public int getWidth()
Returns the width of the rectangular screen region.

Specified by:
getWidth in interface Region
Returns:
the width of the rectangular screen region.

setWidth

public void setWidth(int width)
Sets the width of the rectangular screen region.

Parameters:
width - the width of the rectangular screen region.

getHeight

public int getHeight()
Returns the height of the rectangular screen region.

Specified by:
getHeight in interface Region
Returns:
the height of the rectangular screen region.

setHeight

public void setHeight(int height)
Sets the height of the rectangular screen region.

Parameters:
height - the height of the rectangular screen region.


Copyright © 2014. All rights reserved.