参数名 | 类型 | 默认值 | 说明 |
---|---|---|---|
confirmPermissionTag | string | 选填,默认值为'立即开始|允许' | confirmPermissionTag为权限对话框中确认打开权限的文字。如果不为空,则会自动点击该控件,自动确认打开权限;若为空则需要自己点击确认按钮。支持"|"分割多个文本,找到一个即可。 |
retryCount | integer | 选填,默认值为5 | 点击confirmTag的重试次数 |
例子: function main() { requestScreenShot(); }
参数名 | 类型 | 默认值 | 说明 |
---|---|---|---|
fileName | string | 必填 | 截图存放的文件名,默认存放的路径在手机扩展存储目录(一般为sdcard,注意不同的手机存储目录可能不同)下的aznfz目录下,支持png和jpg后缀; |
destPath | string | 选填 | 图片存放的目标文件夹,相对手机扩展存储目录。注意不是绝对路径 |
region | json object | 选填 | 仅截图区域内的图片,例子{left:100, top: 100, width: 200, height: 50},注意支持float类型值,小于等于1表示比例,大于1表示像素值,比如width:0.3表示宽为屏幕宽的3/10。 |
quality | integer | 选填 | 图片质量取值范围0-100,默认值100 |
例子: function main() { requestScreenShot(); var ret = screenShot('pic.png'); console.log('ret:' + ret); }
参数名 | 类型 | 默认值 | 说明 |
---|---|---|---|
x | integer | 必填 | x坐标,像素值 |
y | integer | 必填 | y坐标,像素值 |
例子: function main() { requestScreenShot(); var color = getScreenColor(200, 300); console.log('color:' + color); }
参数名 | 类型 | 默认值 | 说明 |
---|---|---|---|
color | integer/string | 必填 | 颜色,支持整型值和字符串,字符串格式为#AARRGGBB或者#RRGGBB |
options | object | {findAll:false, threshold: 0, region:[left, top, right, bottom], neighbor:[[offsetX, offsetY, color], [offsetX, offsetY, color]]} | findAll表示是否查找所有符合条件的点。threshold表示每个rgb分量的阈值,默认为0,表示完全匹配,取值范围[0-255]。region表示搜索区域,默认搜索整个屏幕。neighbor表示对目标点的相邻点的颜色要求,偏移值为相对目标color坐标的偏移,可以为负值。 |
例子: function main() { requestScreenShot(); var arr = findColor('#445533', {threshold: 3, findAll: true, region:[10, 10, 300, 300], neighbor:[[0, 3, '#443322'],[3, 0, '#443322']]}); for(var point of arr) { console.log('find color x:', point.x, ' y:', point.y); } }
参数名 | 类型 | 默认值 | 说明 |
---|---|---|---|
imageFileName | string | 必填 | 带路径的图片文件名。注意:支持assets文件,例:findImage('asset:template.png');(可以在定制App打包时将图片打包到app的assets中)。 |
region | array | 选填 | 识别区域[left, top, width, height],若取值在[0, 1]之间表示比例,例:0.5表示left位于屏幕x轴中点;若取值大于1表示像素值。 |
例子: function main() { requestScreenShot(); var point = findImage('/sdcard/template.jpg'); // var point = findImage('asset:img.png', [10, 10, 300, 100]); if (point) { console.log('find success x:', point.x, ' y:', point.y); } else { console.log('find image failed'); } }
参数名 | 类型 | 默认值 | 说明 |
---|---|---|---|
maxWaitTime | integer | 选填 | 最长等待多长时间设置完成,单位毫秒,默认值1000*40 |
例子: var ret = requestLockScreen(); console.log('ret:' + ret);
参数名 | 类型 | 默认值 | 说明 |
---|
例子: lockScreen();
参数名 | 类型 | 默认值 | 说明 |
---|
例子: wakeup();