关闭全屏绘图
ScreenDraw.close(): integer
关闭透明绘图层并释放全部图形;再次绘制时会自动创建新绘图层。
参数无参数
返回值返回值可以不接收
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
脚本函数
ScreenDraw.close(): integer
关闭透明绘图层并释放全部图形;再次绘制时会自动创建新绘图层。
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.clear(): integer
清除全部图形,绘图层保持开启。
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.setVisible(visible: integer): integer
显示或隐藏整个绘图层;隐藏时仍保留图形数据。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | visible | 整 | 绘图层显示状态:1 显示,0 隐藏。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.remove(drawId: integer): integer
移除指定ID图形。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | drawId | 整 | 要移除的图形 ID,范围 0~4095。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.line(drawId: integer, x1: integer, y1: integer, x2: integer, y2: integer, color: string, lineWidth: integer): integer
按屏幕像素坐标绘制线条;首次绘制自动开启,相同 drawId 会替换原图形。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | drawId | 整 | 图形 ID,范围 0~4095;相同 ID 会替换原图形。 |
| 2 | x1 | 整 | 线条起点 X 坐标,单位屏幕像素。 |
| 3 | y1 | 整 | 线条起点 Y 坐标,单位屏幕像素。 |
| 4 | x2 | 整 | 线条终点 X 坐标,单位屏幕像素。 |
| 5 | y2 | 整 | 线条终点 Y 坐标,单位屏幕像素。 |
| 6 | color | 字 | 线条颜色,格式 #RRGGBB 或 #AARRGGBB。示例:#FFFF0000 |
| 7 | lineWidth | 整 | 线条宽度,单位像素,必须大于 0。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.rect(drawId: integer, x: integer, y: integer, width: integer, height: integer, color: string, lineWidth: integer, fill: integer): integer
按屏幕像素坐标绘制矩形;首次绘制自动开启,相同 drawId 会替换原图形。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | drawId | 整 | 图形 ID,范围 0~4095;相同 ID 会替换原图形。 |
| 2 | x | 整 | 矩形左上角 X 坐标,单位屏幕像素。 |
| 3 | y | 整 | 矩形左上角 Y 坐标,单位屏幕像素。 |
| 4 | width | 整 | 矩形宽度,单位像素,必须大于 0。 |
| 5 | height | 整 | 矩形高度,单位像素,必须大于 0。 |
| 6 | color | 字 | 矩形颜色,格式 #RRGGBB 或 #AARRGGBB。示例:#80FF0000 |
| 7 | lineWidth | 整 | 边框宽度,单位像素,必须大于 0。 |
| 8 | fill | 整 | 绘制方式:1 填充,0 只画边框。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.circle(drawId: integer, x: integer, y: integer, radius: integer, color: string, lineWidth: integer, fill: integer): integer
按屏幕像素坐标绘制圆形;首次绘制自动开启,相同 drawId 会替换原图形。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | drawId | 整 | 图形 ID,范围 0~4095;相同 ID 会替换原图形。 |
| 2 | x | 整 | 圆心 X 坐标,单位屏幕像素。 |
| 3 | y | 整 | 圆心 Y 坐标,单位屏幕像素。 |
| 4 | radius | 整 | 圆的半径,单位像素,必须大于 0。 |
| 5 | color | 字 | 圆形颜色,格式 #RRGGBB 或 #AARRGGBB。示例:#8000FF00 |
| 6 | lineWidth | 整 | 边框宽度,单位像素,必须大于 0。 |
| 7 | fill | 整 | 绘制方式:1 填充,0 只画边框。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.path(drawId: integer, points: string, color: string, lineWidth: integer, closed: integer, fill: integer): integer
按屏幕像素坐标绘制折线或闭合图形;首次绘制自动开启,相同 drawId 会替换原图形。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | drawId | 整 | 图形 ID,范围 0~4095;相同 ID 会替换原图形。 |
| 2 | points | 字 | 坐标点 JSON 数组,每项为 [X,Y]。示例:[[0,0],[100,100]] |
| 3 | color | 字 | 路径颜色,格式 #RRGGBB 或 #AARRGGBB。示例:#FFFFFFFF |
| 4 | lineWidth | 整 | 路径线宽,单位像素,必须大于 0。 |
| 5 | closed | 整 | 路径状态:1 闭合首尾,0 保持折线。 |
| 6 | fill | 整 | 闭合路径的绘制方式:1 填充,0 只画边框。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.text(drawId: integer, x: integer, y: integer, text: string, color: string, size: integer): integer
以 X、Y 为左上角绘制文字,支持换行;首次绘制自动开启,相同 drawId 会替换原图形。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | drawId | 整 | 图形 ID,范围 0~4095;相同 ID 会替换原图形。 |
| 2 | x | 整 | 文字区域左上角 X 坐标,单位屏幕像素。 |
| 3 | y | 整 | 文字区域左上角 Y 坐标,单位屏幕像素。 |
| 4 | text | 字 | 要绘制的文字或字符变量。示例:"运行中"。 |
| 5 | color | 字 | 文字颜色,格式 #RRGGBB 或 #AARRGGBB。示例:#FFFFFFFF |
| 6 | size | 整 | 文字大小,单位像素;可使用快捷选择或手动填写。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.batch(operations: string): integer
一次新增、更新或删除多个图形;整批操作只发送一次并在全部成功后刷新一次,数组中任一项无效时画面保持不变。 示例:ScreenDraw.batch("[{\"type\":\"circle\",\"drawId\":1000,\"x\":300,\"y\":400,\"radius\":20,\"color\":\"#FFFFFFFF\",\"lineWidth\":3,\"fill\":true}]")
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | operations | 字 | 操作 JSON 数组字符串,可直接填写字符变量。每项必须包含 type 和 drawId;type 支持 line、rect、circle、path、text、remove。绘图项的其他字段与对应单图形函数相同;path 的 points 使用 [[x,y],[x,y]]。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|
ScreenDraw.setAllStyle(color: string, lineWidth: integer, fill: integer): integer
统一修改当前全部图形:颜色用于全部图形,线宽用于线条、矩形、圆形和路径,填充用于矩形、圆形和路径;文字只修改颜色。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | color | 字 | 全部图形使用的颜色,格式 #RRGGBB 或 #AARRGGBB。示例:#FFFFFFFF |
| 2 | lineWidth | 整 | 线条和边框的统一宽度,单位像素,必须大于 0。 |
| 3 | fill | 整 | 矩形、圆形和闭合路径的绘制方式:1 填充,0 只画边框。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | 执行状态 | 整 | 操作结果
|