add: images.load(), landscape param of requestScreenCapture()
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
if(!requestScreenCapture()){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
exit();
|
||||
}
|
||||
var img = captureScreen();
|
||||
toastLog("开始找色");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if(!requestScreenCapture()){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
exit();
|
||||
}
|
||||
var img = captureScreen();
|
||||
//0xffffff为白色
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
//减少截图分辨率以提高速度
|
||||
if(!requestScreenCapture(640, 960)){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
}
|
||||
var img = captureScreen();
|
||||
toastLog("开始找色");
|
||||
//0x02b902为输入法绿色字体的颜色
|
||||
var point = findColor(img, 0x02b902, {
|
||||
//指定用8个线程找色
|
||||
threads: 8
|
||||
});
|
||||
if(point){
|
||||
toastLog("x = " + point.x + ", y = " + point.y);
|
||||
}else{
|
||||
toastLog("没有找到");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@ console.show();
|
||||
events.observeTouch();
|
||||
events.setTouchEventTimeout(30);
|
||||
events.on("touch", function(point){
|
||||
var img = captureScreen();
|
||||
if(img == null){
|
||||
var c = null;
|
||||
}else{
|
||||
var c = colors.toString(images.pixel(captureScreen(), point.x, point.y);
|
||||
}
|
||||
var c = colors.toString(images.pixel(captureScreen(), point.x, point.y);
|
||||
log("(" + point.x + ", " + point.y + "): " + c);
|
||||
log("");
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
if(!requestScreenCapture()){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
exit();
|
||||
}
|
||||
var img = captureScreen();
|
||||
images.saveImage(img, "/sdcard/1.png");
|
||||
@@ -1,6 +0,0 @@
|
||||
//指定截图分辨率为 640×960
|
||||
if(!requestScreenCapture(640, 960)){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
}
|
||||
captureScreen("/sdcard/1.png");
|
||||
@@ -1,6 +1,6 @@
|
||||
if(!requestScreenCapture()){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
exit();
|
||||
}
|
||||
launchApp("QQ");
|
||||
sleep(2000);
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
if(!requestScreenCapture()){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
}
|
||||
var img = captureScreen();
|
||||
//0xffffff为白色
|
||||
toastLog("开始找色");
|
||||
var point = findColor(img, 0xffffff, {
|
||||
//指定算法为rgb+,比默认算法rgb更准确,但时间更久
|
||||
algorithm: "rgb+",
|
||||
//指定颜色临界值为16
|
||||
threshold: 16,
|
||||
//指定用8个线程找色
|
||||
threads: 8
|
||||
});
|
||||
if(point){
|
||||
toastLog("x = " + point.x + ", y = " + point.y);
|
||||
}else{
|
||||
toastLog("没有找到");
|
||||
}
|
||||
|
||||
point = findColor(img, 0xffffff, {
|
||||
//指定算法为颜色差值,比默认算法rgb更快
|
||||
algorithm: "diff",
|
||||
//指定r, b, b分别都在范围ff±20内
|
||||
threshold: 0x202020,
|
||||
});
|
||||
if(point){
|
||||
toastLog("x = " + point.x + ", y = " + point.y);
|
||||
}else{
|
||||
toastLog("没有找到");
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
if(!requestScreenCapture()){
|
||||
toast("请求截图失败");
|
||||
stop();
|
||||
exit();
|
||||
}
|
||||
var img = captureScreen();
|
||||
//0x9966ff为编辑器紫色字体的颜色
|
||||
|
||||
5
app/src/main/assets/sample/图片与图色处理/获取网络图片并保存.js
Normal file
5
app/src/main/assets/sample/图片与图色处理/获取网络图片并保存.js
Normal file
@@ -0,0 +1,5 @@
|
||||
//这个是Auto.js图标的地址
|
||||
var url = "http://www.autojs.org/assets/uploads/profile/3-profileavatar.png";
|
||||
var logo = images.load(url);
|
||||
//保存到路径/sdcard/auto.js.png
|
||||
images.save(logo, "/sdcard/auto.js.png");
|
||||
@@ -1,5 +1,6 @@
|
||||
if(!requestScreenCapture()){
|
||||
toast("请求截图失败");
|
||||
toast("请求截图失败");
|
||||
exit
|
||||
}
|
||||
sleep(2000);
|
||||
var x = 760;
|
||||
@@ -10,7 +11,7 @@ var c = images.pixel(captureScreen(), x, y);
|
||||
var msg = "";
|
||||
msg += "在位置(" + x + ", " + y + ")处的颜色为" + colors.toString(c);
|
||||
msg += "\nR = " + colors.red(c) + ", G = " + colors.green(c) + ", B = " + colors.blue(c);
|
||||
//检测在点(x, y)处是否有颜色0x73bdb6 (模糊比较)
|
||||
//检测在点(x, y)处是否有颜色#73bdb6 (模糊比较)
|
||||
var isDetected = images.detectsColor(captureScreen(), "#73bdb6", x, y);
|
||||
msg += "\n该位置是否匹配到颜色#73bdb6: " + isDetected;
|
||||
alert(msg);
|
||||
Reference in New Issue
Block a user