$draw
- 更新时间:2025-07-25 17:09:18
全屏绘制
getPermit()
获取悬浮窗权限
- 返回 : {boolean} 是否有权限
- 版本 : 1.0.0
$draw.getPermit();
rect(rect)
绘制一个方框
- 参数 : rect {Rect} opencv的Rect对象
- 版本 : 1.0.0
//绘制矩形
$draw.rect(rect);
rect(node)
绘制一个方框
- 参数 : node {AccessibilityNodeInfo} 节点信息
- 版本 : 1.0.0
//绘制矩形
$draw.rect(node);
rect(x, y, w, h)
绘制一个方框
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : w {int} 宽度
- 参数 : h {int} 高度
- 版本 : 1.0.0
//绘制矩形
$draw.rect(200, 200, 200, 100);
rect(x, y, w, h, color)
绘制一个方框
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : w {int} 宽度
- 参数 : h {int} 高度
- 参数 : color {string} 颜色
- 版本 : 1.1.1
//绘制矩形
$draw.rect(200, 200, 200, 100, "#FF0000");
rect(x, y, w, h, ext)
绘制方框
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : w {int} 宽度
- 参数 : h {int} 高度
- 参数 : ext {int} 向四周拓展
- 版本 : 1.0.0
//绘制一个向外拓展50像素的矩阵
$draw.rect(200, 200, 200, 100, 50);
rect(x, y, w, h, ext, color)
绘制方框
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : w {int} 宽度
- 参数 : h {int} 高度
- 参数 : ext {int} 向四周拓展
- 参数 : color {string} 颜色
- 版本 : 1.1.0
//绘制一个向外拓展50像素的矩阵
$draw.rect(200, 200, 200, 100, 50, "#FF0000");
rect(x, y, w, h, ext, color)
绘制方框
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : w {int} 宽度
- 参数 : h {int} 高度
- 参数 : ext {int} 向四周拓展
- 参数 : color {int} 颜色
- 版本 : 1.1.1
//绘制一个向外拓展50像素的矩阵
$draw.rect(200, 200, 200, 100, 50, $color.RED);
rect(result)
绘制yolox结果集合
- 参数 : result {YoloxResult} yolox结果
- 版本 : 1.1.6
$screen.getPermit();
$draw.closeAll();
let result = $yolox.init("yolox/yolox-nano.bin", "yolox/yolox-nano.param", "yolox/label.text", false);
if (result.success) {
alert("初始化成功", "初始化成功");
//先显示
showImg("yolox/t02.png");
sleep(1000);
//检测整个屏幕
let res = $yolox.detect();
alert("检测结果", res);
//直接绘制yolox的结果集合
$draw.rect(res);
} else {
alert("初始化失败", result.des);
}
rect(result)
cross(point)
绘制一个十字准心
- 参数 : point {point} 位置
- 版本 : 1.0.0
//绘制准心
$draw.cross(point);
cross(index)
绘制一个十字准心
- 参数 : index {int[]} 位置
- 版本 : 1.0.0
//绘制准心
$draw.cross([400, 500]);
cross(node)
绘制一个十字准心
- 参数 : node {AccessibilityNodeInfo} 节点信息
- 版本 : 1.0.0
//绘制准心
$draw.cross(node);
cross(node)
绘制一个十字准心
- 参数 : node {Node} 节点信息
- 版本 : 1.0.0
//绘制准心
$draw.cross(node);
cross(x, y)
绘制一个十字准心
- 参数 : x {int} 中心x
- 参数 : y {int} 中心y
- 版本 : 1.0.0
//绘制准心
$draw.cross(400, 500);
cross(x, y, color)
绘制一个十字准心
- 参数 : x {int} 中心x
- 参数 : y {int} 中心y
- 参数 : color {string} 颜色
- 版本 : 1.1.0
//绘制准心
$draw.cross(400, 500, "#FF0000");
cross(x, y, color)
绘制一个十字准心
- 参数 : x {int} 中心x
- 参数 : y {int} 中心y
- 参数 : color {int} 颜色值
- 版本 : 1.1.1
//绘制准心
$draw.cross(400, 500, $color.RED);
dot(index)
绘制一个点
- 参数 : index {int[]} 点
- 版本 : 1.0.0
$draw.dot([400, 500]);
dot(point)
绘制一个点
- 参数 : point {point} 点
- 版本 : 1.0.0
$draw.dot(point);
dot(x, y)
绘制一个点
- 参数 : x {int} 点x
- 参数 : y {int} 点y
- 版本 : 1.0.0
//绘制一个点
$draw.dot(400, 500);
dot(x, y, color)
绘制一个点
- 参数 : x {int} 点x
- 参数 : y {int} 点y
- 参数 : color {string} 颜色
- 版本 : 1.0.0
//绘制一个点
$draw.dot(400, 500);
dot(x, y, color)
绘制一个点
- 参数 : x {int} 点x
- 参数 : y {int} 点y
- 参数 : color {int} 颜色值
- 版本 : 1.1.1
//绘制一个点
$draw.dot(400, 500, $color.RED);
text(text, x, y)
绘制文字
- 参数 : text {String} 文字
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 版本 : 1.0.0
//绘制文字
$draw.text("Hello aigame !", 400, 300);
text(text, x, y, size)
绘制文字
- 参数 : text {String} 文字
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : size {float} 字体大小
- 版本 : 1.0.0
//绘制文字(大小为20像素)
$draw.text("Hello aigame !", 400, 400, 20);
text(text, x, y, size, color)
绘制文字
- 参数 : text {String} 文字
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : size {int} 字体大小
- 参数 : color {string} 颜色
- 版本 : 1.1.1
//绘制文字(大小为20像素)
$draw.text("Hello aigame !", 400, 400, 20, "#FF0000");
text(text, x, y, size, color)
绘制文字
- 参数 : text {String} 文字
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : size {int} 字体大小
- 参数 : color {int} 颜色值
- 版本 : 1.1.1
//绘制文字(大小为20像素)
$draw.text("Hello aigame !", 400, 400, 20, $color.RED);
circle(x, y)
绘制一个圆形 半径默认为50像素
- 参数 : x {int} 圆心x
- 参数 : y {int} 圆心y
- 版本 : 1.1.1
//绘制半径为50像素的圆形
$draw.circle(350, 400);
circle(x, y, r)
绘制一个圆形
- 参数 : x {int} 圆心x
- 参数 : y {int} 圆心y
- 参数 : r {int} 圆形半径
- 版本 : 1.0.0
//绘制半径为100像素的圆形
$draw.circle(350, 400, 100);
circle(x, y, r, ext)
绘制一个圆形
- 参数 : x {int} 圆心x
- 参数 : y {int} 圆心y
- 参数 : r {int} 圆形半径
- 参数 : ext {int} 圆形向四周拓展
- 版本 : 1.0.0
//向外拓展50像素
$draw.circle(350, 400, 100, 50);
circle(x, y, r, ext, color)
绘制一个圆形
- 参数 : x {int} 圆心x
- 参数 : y {int} 圆心y
- 参数 : r {int} 圆形半径
- 参数 : ext {int} 圆形向四周拓展
- 参数 : color {string} 颜色
- 版本 : 1.0.0
//向外拓展50像素
$draw.circle(350, 400, 100, 50, "#FF0000");
circle(x, y, r, ext, color)
绘制一个圆形
- 参数 : x {int} 圆心x
- 参数 : y {int} 圆心y
- 参数 : r {int} 圆形半径
- 参数 : ext {int} 圆形向四周拓展
- 参数 : color {int} 颜色值
- 版本 : 1.1.1
//向外拓展50像素
$draw.circle(350, 400, 100, 50, $color.RED);
img(img, x, y, w, h)
绘制图片
- 参数 : img {Image} 图片对象
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : w {int} 宽度(绘制后的图片宽度)
- 参数 : h {int} 高度(绘制后的图片宽度)
- 版本 : 1.1.0
line(x, y, toX, toY)
绘制一条线
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : toX {int} 目标x
- 参数 : toY {int} 目标y
- 版本 : 1.0.0
//绘制一条线
$draw.line(300, 0, 100, 1000);
line(x, y, toX, toY, color)
绘制一条线
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : toX {int} 目标x
- 参数 : toY {int} 目标y
- 参数 : color {string} 颜色
- 版本 : 1.1.1
//绘制一条线
$draw.line(300, 0, 100, 1000, "#FF0000");
line(x, y, toX, toY, color)
绘制一条线
- 参数 : x {int} 起点x
- 参数 : y {int} 起点y
- 参数 : toX {int} 目标x
- 参数 : toY {int} 目标y
- 参数 : color {int} 颜色值
- 版本 : 1.1.1
//绘制一条线
$draw.line(300, 0, 100, 1000, $color.RED);
path(data)
绘制路径,传入的就是x和y的数组
- 参数 : data {int[][]} 二维数组,第二维数组是坐标
- 版本 : 1.0.0
//国际通用手势
$draw.path([
[100, 800],
[120, 750],
[150, 720],
[180, 750],
[200, 800],
[200, 800],
[220, 700],
[250, 680],
[280, 700],
[300, 800],
[300, 800],
[320, 250],
[350, 200],
[380, 250],
[400, 800],
[400, 800],
[420, 740],
[450, 730],
[480, 740],
[500, 800],
[500, 800],
[520, 770],
[550, 760],
[580, 770],
[600, 800]
]);
path(data, color)
绘制路径,传入的就是x和y的数组
- 参数 : data {int[][]} 二维数组,第二维数组是坐标
- 参数 : color {string} 颜色
- 版本 : 1.1.1
//国际通用手势
$draw.path([
[100, 800],
[120, 750],
[150, 720],
[180, 750],
[200, 800],
[200, 800],
[220, 700],
[250, 680],
[280, 700],
[300, 800],
[300, 800],
[320, 250],
[350, 200],
[380, 250],
[400, 800],
[400, 800],
[420, 740],
[450, 730],
[480, 740],
[500, 800],
[500, 800],
[520, 770],
[550, 760],
[580, 770],
[600, 800]
], "#FF0000");
path(data, color)
绘制路径,传入的就是x和y的数组
- 参数 : data {int[][]} 二维数组,第二维数组是坐标
- 参数 : color {int} 颜色值
- 版本 : 1.1.1
//国际通用手势
$draw.path([
[100, 800],
[120, 750],
[150, 720],
[180, 750],
[200, 800],
[200, 800],
[220, 700],
[250, 680],
[280, 700],
[300, 800],
[300, 800],
[320, 250],
[350, 200],
[380, 250],
[400, 800],
[400, 800],
[420, 740],
[450, 730],
[480, 740],
[500, 800],
[500, 800],
[520, 770],
[550, 760],
[580, 770],
[600, 800]
], $color.RED);
i(text, x, y, size)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.i("信息", 400, 300, 40);
i(text, x, y)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.i("信息", 400, 300);
i(text)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.i("信息");
d(text, x, y, size)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.i("调试", 400, 300, 40);
d(text, x, y)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.d("调试", 400, 300);
d(text)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.d("调试");
w(text, x, y, size)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.w("警告", 400, 300, 40);
w(text, x, y)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.w("警告", 400, 300);
w(text)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.w("警告");
e(text, x, y, size)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.e("错误", 400, 300, 40);
e(text, x, y)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.e("错误", 400, 300);
e(text)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.e("错误");
v(text, x, y, size)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.v("信息", 400, 300, 40);
v(text, x, y)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.v("信息", 400, 300);
v(text)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.v("信息");
log(text, color, x, y, size)
绘制日志文字
- 参数 : text {String} 文字
- 参数 : color {String} 颜色
- 参数 : x {int} 位置x
- 参数 : y {int} 位置y
- 参数 : size {float} 字体大小
- 版本 : 1.0.0
$draw.log("信息", "#57965C", 400, 300, 40);
log(text, color, x, y)
绘制日志文字
- 参数 : text {String} 文字
- 参数 : color {String} 颜色
- 参数 : x {int} 位置x
- 参数 : y {int} 位置y
- 版本 : 1.0.0
$draw.log("信息", "#57965C", 400, 300);
log(text, color)
绘制日志文字
- 参数 : text {String} 文字
- 参数 : color {String} 颜色
- 版本 : 1.0.0
$draw.log("信息", "#57965C");
log(text)
绘制日志文字
- 参数 : text {String} 文字
- 版本 : 1.0.0
$draw.log("信息");
log(text, x, y)
绘制日志文字
- 参数 : text {String} 文字
- 参数 : x {int} 位置x
- 参数 : y {int} 位置y
- 版本 : 1.0.0
$draw.log("信息", 400, 300);
closeAll()
关闭绘制日志的悬浮窗
- 版本 : 1.0.0
//关闭所有绘制图案
$draw.closeAll();
closeAll(delay)
关闭绘制日志的悬浮窗
- 版本 : 1.0.0
$draw.closeAll(1000);
closeLog(delay)
关闭绘制日志的悬浮窗
- 版本 : 1.0.0
$draw.closeLog(1000);
closeLog()
关闭绘制日志的悬浮窗
- 版本 : 1.0.0
$draw.closeLog();