新增 特性continuation

This commit is contained in:
hyb1996
2018-12-09 14:19:33 +08:00
parent 941cdccf31
commit 8b907d31c8
18 changed files with 349 additions and 151 deletions

View File

@@ -1,9 +1,10 @@
module.exports = function (runtime, scope) {
const ResultAdapter = require("result_adapter");
function images(){
}
if(android.os.Build.VERSION.SDK_INT >= 21){
util.__assignFunctions__(runtime.images, images, ['requestScreenCapture', 'captureScreen', 'read', 'copy', 'load', 'clip', 'pixel'])
util.__assignFunctions__(runtime.images, images, ['captureScreen', 'read', 'copy', 'load', 'clip', 'pixel'])
}
images.opencvImporter = JavaImporter(
org.opencv.core.Point,
@@ -55,6 +56,18 @@ module.exports = function (runtime, scope) {
var colorFinder = javaImages.colorFinder;
images.requestScreenCapture = function(landscape) {
let ScreenCapturer = com.stardust.autojs.core.image.capture.ScreenCapturer;
var orientation = ScreenCapturer.ORIENTATION_AUTO;
if(landscape === true){
orientation = ScreenCapturer.ORIENTATION_LANDSCAPE;
}
if(landscape === false){
orientation = ScreenCapturer.ORIENTATION_PORTRAIT;
}
return ResultAdapter.promise(javaImages.requestScreenCapture(orientation)).await();
}
images.save = function (img, path, format, quality) {
format = format || "png";
quality = quality == undefined ? 100 : quality;