private Location checkAndSetRemote(Location loc) { if (!isOtherScreen()) { return loc; } return loc.setOtherScreen(scr); }
public boolean isNotLocal(Object owner) { if (owner instanceof Region) { if (((Region) owner).isOtherScreen()) { return true; } } else if (owner instanceof Location) { if (((Location) owner).isOtherScreen()) { return true; } } return false; }
private boolean isAndroid() { if (isOtherScreen()) { IScreen scr = getScreen(); if (scr instanceof ADBScreen) { adbScreen = (ADBScreen) scr; adbDevice = adbScreen.getDevice(); return true; } } return false; }
private void init(Region r) { if (!r.isValid()) { return; } x = r.x; y = r.y; w = r.w; h = r.h; scr = r.getScreen(); otherScreen = r.isOtherScreen(); rows = 0; autoWaitTimeout = r.autoWaitTimeout; findFailedResponse = r.findFailedResponse; throwException = r.throwException; waitScanRate = r.waitScanRate; observeScanRate = r.observeScanRate; repeatWaitTime = r.repeatWaitTime; }
/** * @return a compact description */ public String toStringShort() { if (isOtherScreen()) { return String.format("%s, %dx%d", getScreen().getIDString(), w, h); } else { String scrText = getScreen() == null ? "?" : "" + (-1 == getScreen().getID() ? "Union" : getScreen().getID()); return String.format("R[%d,%d %dx%d]@S(%s)", x, y, w, h, scrText); } } //</editor-fold>
/** * Show highlight in selected color * * @param secs time in seconds * @param color Color of frame (see method highlight(color)) * @return this region */ public Region highlight(int secs, String color) { if (getScreen() == null || isOtherScreen() || isScreenUnion) { Debug.error("highlight: not possible for %s", getScreen()); return this; } if (secs > 0) { return highlight((float) secs, color); } if (lastMatch != null) { if (secs < 0) { return lastMatch.highlight((float) -secs, color); } return lastMatch.highlight(Settings.DefaultHighlightTime, color); } return this; } //</editor-fold>
private Region doHighlight(boolean toEnable, String color, boolean silent) { if (isOtherScreen()) { return this; } if (!silent) { Debug.action("toggle highlight " + toString() + ": " + toEnable + (color != null ? " color: " + color : "")); } if (toEnable) { overlay = new ScreenHighlighter(getScreen(), color); overlay.setWaitAfter(silent); overlay.highlight(this); } else { if (overlay != null) { overlay.close(); overlay = null; } } return this; }
protected <PSIMRL> Location getLocationFromTarget(PSIMRL target) throws FindFailed { if (target instanceof Pattern || target instanceof String || target instanceof Image) { Match m = find(target); if (m != null) { if (isOtherScreen()) { return m.getTarget().setOtherScreen(scr); } else { return m.getTarget(); } } return null; } if (target instanceof Match) { return ((Match) target).getTarget(); } if (target instanceof Region) { return ((Region) target).getCenter(); } if (target instanceof Location) { return new Location((Location) target); } return null; } //</editor-fold>
/** * show the regions Highlight for the given time in seconds (frame of specified color) if 0 - use the global * Settings.SlowMotionDelay * * @param secs time in seconds * @param color Color of frame (see method highlight(color)) * @return the region itself */ public Region highlight(float secs, String color) { if (getScreen() == null || isOtherScreen() || isScreenUnion) { Debug.error("highlight: not possible for %s", getScreen()); return this; } if (secs < 0.1) { return highlight((int) secs, color); } Debug.action("highlight " + toStringShort() + " for " + secs + " secs" + (color != null ? " color: " + color : "")); ScreenHighlighter _overlay = new ScreenHighlighter(getScreen(), color); _overlay.highlight(this, secs); return this; }
lastMatch = rf.getMatch(); lastMatch.setImage(img); if (isOtherScreen()) { lastMatch.setOtherScreen(); } else if (img != null) {
if (lastMatch != null) { lastMatch.setImage(img); if (isOtherScreen()) { lastMatch.setOtherScreen(); } else if (img != null) {
lastMatch = rf.getMatch(); lastMatch.setImage(img); if (isOtherScreen()) { lastMatch.setOtherScreen(); } else if (img != null) {