Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
LYS86 committed Oct 7, 2022
1 parent 7c981d6 commit ac2df32
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions documentation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 关于本文档
# 关于本文档 <!-- {docsify-ignore-all} -->

<!-- type=misc -->

Expand Down Expand Up @@ -39,15 +39,17 @@
* `i` {number} 表示要输入的为第i + 1个输入框
* `text` {string} 要输入的文本

`input`表示函数名,`([i, ]text)`表示要传入两个参数:`i`, `text``[i, ]`表示`i`是可选参数,即`i`可有可无.

input表示函数名,括号内的`[i, ]text`为函数的参数。下面是参数列表,"number"表示参数i的类型为数值,"string"表示参数text的类型为字符串。

例如input(1, "啦啦啦"),执行这个语句会在屏幕上的第2个输入框处输入"啦啦啦"。

方括号[ ]表示参数为可选参数。也就是说,可以省略i直接调用input。例如input("嘿嘿嘿"),按照文档,这个语句会在屏幕上所有输入框输入"嘿嘿嘿"。

调用有可选参数的函数时请不要写上方括号。

下方是函数说明,`i`表示参数名称,`{number}`表示参数`i`的类型为数值,`表示要输入...`是对参数`i`的详细说明
```js
//执行这个语句会在屏幕上的第2个输入框处输入"啦啦啦"。
input(1, "啦啦啦")
```
```js
//这个语句会在屏幕上所有输入框输入"嘿嘿嘿"。
input("嘿嘿嘿");
```
我们再看第二个例子。图片和图色处理中detectsColor函数的部分说明。

## images.detectsColor(image, color, x, y[, threshold = 16, algorithm = "diff"])
Expand All @@ -57,16 +59,22 @@ input表示函数名,括号内的`[i, ]text`为函数的参数。下面是参
* `y` {number} 要检测的位置纵坐标
* `threshold` {number} 颜色相似度临界值,默认为16。取值范围为0~255。
* `algorithm` {string} 颜色匹配算法,包括:
* "equal": 相等匹配,只有与给定颜色color完全相等时才匹配。
* "diff": 差值匹配。与给定颜色的R、G、B差的绝对值之和小于threshold时匹配。
* "rgb": rgb欧拉距离相似度。与给定颜色color的rgb欧拉距离小于等于threshold时匹配。

* "rgb+": 加权rgb欧拉距离匹配([LAB Delta E](https://en.wikipedia.org/wiki/Color_difference))。
* "hs": hs欧拉距离匹配。hs为HSV空间的色调值。

同样地,`[, threshold = 16, algorithm = "rgb"]`为可选参数,并且,等于号=后面的值为参数的默认值。也就是如果不指定该参数,则该参数将会为这个值。

例如 `images.detectsColor(captureScreen(), "#112233", 100, 200)` 相当于 `images.detectsColor(captureScreen(), "#112233", 100, 200, 16, "rgb")`
`images.detectsColor(captureScreen(), "#112233", 100, 200, 64)` 相当于`images.detectsColor(captureScreen(), "#112233", 100, 200, 64, "rgb")`

调用有可选参数及默认值的函数时请不要写上方括号和等于号。
* `equal`: 相等匹配,只有与给定颜色color完全相等时才匹配。
* `diff`: 差值匹配。与给定颜色的R、G、B差的绝对值之和小于threshold时匹配。
* `rgb`: rgb欧拉距离相似度。与给定颜色color的rgb欧拉距离小于等于threshold时匹配。
* `rgb`: 加权rgb欧拉距离匹配([LAB Delta E](https://en.wikipedia.org/wiki/Color_difference))。
* `hs`: hs欧拉距离匹配。hs为HSV空间的色调值。

`threshold = 16`表示如果不指定该参数,则 `threshold` 的值为`16`

```js
images.detectsColor(captureScreen(), "#112233", 100, 200)
//相当于
images.detectsColor(captureScreen(), "#112233", 100, 200, 16, "rgb")
```
```js
images.detectsColor(captureScreen(), "#112233", 100, 200, 64)
//相当于
images.detectsColor(captureScreen(), "#112233", 100, 200, 64, "rgb")
```
调用有可选参数及默认值的函数时请不要写上方括号和等于号。

0 comments on commit ac2df32

Please sign in to comment.