[sikuli] 361/385: revised the setROI/getROI feature
Gilles Filippini
pini at moszumanska.debian.org
Sun Jun 29 19:26:37 UTC 2014
This is an automated email from the git hooks/post-receive script.
pini pushed a commit to tag upstream/1.1.0_beta1
in repository sikuli.
commit 6f2ec3c55532cc90606d2915fc2ba541c5e3739b
Author: Raimund Hocke <rmhdevelop at me.com>
Date: Tue Apr 22 08:45:27 2014 +0200
revised the setROI/getROI feature
---
API/src/main/java/org/sikuli/script/Match.java | 11 +++--------
API/src/main/java/org/sikuli/script/Region.java | 20 ++++++++++++++++++++
Basics/src/main/resources/Lib/sikuli/Screen.py | 7 ++++---
Basics/src/main/resources/Lib/sikuli/Sikuli.py | 2 +-
4 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/API/src/main/java/org/sikuli/script/Match.java b/API/src/main/java/org/sikuli/script/Match.java
index 92f648d..31b4774 100755
--- a/API/src/main/java/org/sikuli/script/Match.java
+++ b/API/src/main/java/org/sikuli/script/Match.java
@@ -7,7 +7,6 @@
package org.sikuli.script;
import org.sikuli.basics.Settings;
-import java.awt.image.BufferedImage;
import org.sikuli.natives.FindResult;
/**
@@ -174,15 +173,11 @@ public class Match extends Region implements Comparable<Match> {
}
/**
- * get the image used for searching as in-memory image
+ * get the image used for searching
* @return a buffered image or null
*/
- public BufferedImage getImage() {
- if (image == null) {
- return null;
- } else {
- return image.get();
- }
+ public Image getImage() {
+ return image;
}
/**
diff --git a/API/src/main/java/org/sikuli/script/Region.java b/API/src/main/java/org/sikuli/script/Region.java
index d9a1d00..9abaf1a 100644
--- a/API/src/main/java/org/sikuli/script/Region.java
+++ b/API/src/main/java/org/sikuli/script/Region.java
@@ -1010,6 +1010,17 @@ public class Region {
}
// ****************************************************
+
+/**
+ * resets this region (usually a Screen object) to the coordinates of the containing screen
+ *
+ * Because of the wanted side effect for the containing screen, this should only be used with screen objects.
+ * For Region objects use setRect() instead.
+ */
+ public void setROI() {
+ setROI(getScreen().getBounds());
+ }
+
/**
* resets this region to the given location, and size <br> this might move the region even to another screen
*
@@ -1053,6 +1064,15 @@ public class Region {
setROI(reg.getX(), reg.getY(), reg.getW(), reg.getH());
}
+ /**
+ * A function only for backward compatibility - Only makes sense with Screen objects
+ *
+ * @return the Region being the current ROI of the containing Screen
+ */
+ public Region getROI() {
+ return new Region(getScreen().getRect());
+ }
+
// ****************************************************
/**
*
diff --git a/Basics/src/main/resources/Lib/sikuli/Screen.py b/Basics/src/main/resources/Lib/sikuli/Screen.py
index f5db41c..44bc2fe 100755
--- a/Basics/src/main/resources/Lib/sikuli/Screen.py
+++ b/Basics/src/main/resources/Lib/sikuli/Screen.py
@@ -33,9 +33,10 @@ class Screen(Region):
def getNumberScreens(cls):
return JScreen.getNumberScreens()
- def resetROI(self):
- # Debug.log(3, "Screen.py: resetROI: %s", self.getScreen())
- self.setRect(self.getScreen().getBounds())
+#TODO check wether needed (Region.setROI() resets to bounds too)
+# def resetROI(self):
+# # Debug.log(3, "Screen.py: resetROI: %s", self.getScreen())
+# self.setRect(self.getScreen().getBounds())
def getBounds(self):
return self.getScreen().getBounds()
diff --git a/Basics/src/main/resources/Lib/sikuli/Sikuli.py b/Basics/src/main/resources/Lib/sikuli/Sikuli.py
index b81a18c..a772c49 100755
--- a/Basics/src/main/resources/Lib/sikuli/Sikuli.py
+++ b/Basics/src/main/resources/Lib/sikuli/Sikuli.py
@@ -427,5 +427,5 @@ def _exposeAllMethods(anyObject, saved, theGlobals, exclude_list):
return tosave
############### set SCREEN as primary screen at startup ################
-#use(Screen(1))
+use()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git
More information about the pkg-java-commits
mailing list