|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sikuli.api.AbstractScreenRegion
org.sikuli.api.DefaultScreenRegion
public class DefaultScreenRegion
This class provides manipulation methods that can be used by the default screen region.
| Constructor Summary | |
|---|---|
DefaultScreenRegion(Screen screen)
Constructs a new DefaultScreenRegion on the specified Screen object whose upper-left corner is at (0, 0) in the coordinate space. |
|
DefaultScreenRegion(Screen screen,
int x,
int y,
int width,
int height)
Constructs a new DefaultScreenRegion object on the specified Screen and region values. |
|
DefaultScreenRegion(ScreenRegion parent,
int x,
int y,
int width,
int height)
Constructs a new DefaultScreenRegion object whose Screen is the same as the parent ScreenRegion with the specified region values. |
|
| Method Summary | |
|---|---|
void |
addROI(int x,
int y,
int width,
int height)
Add a rectangular region of interest into this ScreenRegion. |
void |
addState(Target target,
Object state)
Defines a new state of this screen region as represented by the presence of the given target. |
void |
addStateChangeEventListener(StateChangeListener listener)
Adds a listener to handle the state changes within this screen region. |
void |
addTargetEventListener(Target target,
TargetEventListener listener)
Adds a listener for a given target. |
BufferedImage |
capture()
Captures and returns a screenshot of this screen region. |
ScreenRegion |
find(Target target)
Finds a target on the screen immediately. |
List<ScreenRegion> |
findAll(Target target)
Finds all the instances of the target on the screen immediately. |
ScreenLocation |
getCenter()
Returns the center of this screen region. |
BufferedImage |
getLastCapturedImage()
Returns the last captured screenshot in this screen region. |
ScreenLocation |
getLowerLeftCorner()
Returns the lower-left corner of this screen region. |
ScreenLocation |
getLowerRightCorner()
Returns the lower-right corner of this screen region. |
List<Rectangle> |
getROIs()
Returns a list of Rectangle that represent the rectangular regions of interest for this ScreenRegion. |
Object |
getState()
Returns the state of this ScreenRegion. |
Map<Target,Object> |
getStates()
Returns a map of Target objects and states, which can be any object,
of this DefaultScreenRegion. |
ScreenLocation |
getUpperLeftCorner()
Returns the upper-left corner of this screen region. |
ScreenLocation |
getUpperRightCorner()
Returns the upper-right corner of this screen region. |
void |
removeState(Target target)
Removes a particular state represented by the given target from this screen region. |
void |
removeTargetEventListener(Target target,
TargetEventListener listener)
Removes a particular listener for a particular target. |
ScreenRegion |
snapshot()
Returns a ScreenRegion object that corresponds to the screen and region of this ScreenRegion. |
ScreenRegion |
wait(Target target,
int mills)
Blocks and waits until a target is found in this screen region within a given time period. |
| Methods inherited from class org.sikuli.api.AbstractScreenRegion |
|---|
getBounds, getHeight, getRelativeScreenLocation, getRelativeScreenRegion, getScore, getScreen, getWidth, getX, getY, setBounds, setHeight, setScore, setScreen, setWidth, setX, setY, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.sikuli.api.ScreenRegion |
|---|
getRelativeScreenLocation, getRelativeScreenRegion, getScore, getScreen, setScore, setScreen |
| Methods inherited from interface org.sikuli.api.Region |
|---|
getBounds, getHeight, getWidth, getX, getY, setBounds |
| Constructor Detail |
|---|
public DefaultScreenRegion(Screen screen)
screen - The Screen to create a region from.
public DefaultScreenRegion(ScreenRegion parent,
int x,
int y,
int width,
int height)
parent - the parent of this ScreenRegionx - 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.
public DefaultScreenRegion(Screen screen,
int x,
int y,
int width,
int height)
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 |
|---|
public List<ScreenRegion> findAll(Target target)
ScreenRegion
findAll in interface ScreenRegiontarget - the target to find.
public ScreenRegion find(Target target)
ScreenRegion
find in interface ScreenRegiontarget - the target to find on the current screen.
null if the
can not be found now.
public ScreenRegion wait(Target target,
int mills)
ScreenRegion
wait in interface ScreenRegiontarget - the target to wait.mills - the maximum time to wait in milliseconds.
ScreenRegion object representing the region occupied by the found target,
or null if the specified target can not be found within the given time.public BufferedImage capture()
ScreenRegion
capture in interface ScreenRegionpublic BufferedImage getLastCapturedImage()
getLastCapturedImage in interface ScreenRegionpublic ScreenLocation getUpperLeftCorner()
ScreenRegion
getUpperLeftCorner in interface ScreenRegionpublic ScreenLocation getLowerLeftCorner()
ScreenRegion
getLowerLeftCorner in interface ScreenRegionpublic ScreenLocation getUpperRightCorner()
ScreenRegion
getUpperRightCorner in interface ScreenRegionpublic ScreenLocation getLowerRightCorner()
ScreenRegion
getLowerRightCorner in interface ScreenRegionpublic ScreenLocation getCenter()
ScreenRegion
getCenter in interface ScreenRegiongetCenter in class AbstractScreenRegion
public void addTargetEventListener(Target target,
TargetEventListener listener)
ScreenRegion
addTargetEventListener in interface ScreenRegiontarget - the target to listener its events for.listener - the listener to handle the events associated with the target.
public void removeTargetEventListener(Target target,
TargetEventListener listener)
ScreenRegion
removeTargetEventListener in interface ScreenRegiontarget - the target from which the given listener should be removed.listener - the listener to remove from the given target.public ScreenRegion snapshot()
ScreenRegionScreenRegion object that corresponds to the screen and region of this ScreenRegion.
snapshot in interface ScreenRegionpublic void addStateChangeEventListener(StateChangeListener listener)
ScreenRegion
addStateChangeEventListener in interface ScreenRegionlistener - the listener to handle state changes in this screen region.
public void addROI(int x,
int y,
int width,
int height)
ScreenRegion
addROI in interface ScreenRegionx - The X coordinate of the upper-left corner of the rectangle to be added.y - The Y coordinate of the upper-left corner of the rectangle to be added.width - The width of the rectangle.height - width The width of the rectangle.public List<Rectangle> getROIs()
ScreenRegion
getROIs in interface ScreenRegionpublic Map<Target,Object> getStates()
Target objects and states, which can be any object,
of this DefaultScreenRegion.
getStates in interface ScreenRegion
public void addState(Target target,
Object state)
ScreenRegion
addState in interface ScreenRegiontarget - the target whose presence indicates this state.state - the state, which can be any object.public void removeState(Target target)
ScreenRegion
removeState in interface ScreenRegiontarget - the representative target of the state to remove.public Object getState()
ScreenRegion
getState in interface ScreenRegion
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||