rust-rpa 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -216,7 +216,7 @@ const windows = Window.all();
|
|
|
216
216
|
- `getBounds(): WindowBounds` - 获取窗口边界(位置和大小)
|
|
217
217
|
- `setBounds(bounds): Promise<void>` - 设置窗口边界(位置和大小)
|
|
218
218
|
- `toJSON(): WindowToJson` - 转为 JSON 可序列化对象
|
|
219
|
-
- `captureImage(options?: CaptureImageOptions): Promise<ImageData>` - 截取窗口图像;可选 `options.size` 指定目标宽高并自动缩放;`options.from` 为 `'screen'` 时截取窗口所在显示器整屏;`options.region` 指定仅截取逻辑像素区域;`options.
|
|
219
|
+
- `captureImage(options?: CaptureImageOptions): Promise<ImageData>` - 截取窗口图像;可选 `options.size` 指定目标宽高并自动缩放;`options.from` 为 `'screen'` 时截取窗口所在显示器整屏;`options.region` 指定仅截取逻辑像素区域;`options.autoSize` 为 true 时在 Windows 高 DPI 下自动缩放到逻辑像素尺寸
|
|
220
220
|
|
|
221
221
|
### Monitor 类
|
|
222
222
|
|
|
@@ -344,7 +344,7 @@ interface CaptureImageOptions {
|
|
|
344
344
|
// 以下仅对 Window.captureImage 有效:
|
|
345
345
|
from?: 'window' | 'screen'; // 默认 'window' 截窗口;'screen' 截窗口所在显示器整屏(可配合 getBounds 与 image.crop 裁剪出窗口)
|
|
346
346
|
region?: CaptureRegion | null; // 仅截取该逻辑像素区域,不填则截全图
|
|
347
|
-
|
|
347
|
+
autoSize?: boolean | null; // 为 true 时在 Windows 存在 DPI 缩放时自动将图像缩放到逻辑像素宽高(与 getSize/getBounds 一致)
|
|
348
348
|
}
|
|
349
349
|
```
|
|
350
350
|
|
|
@@ -543,7 +543,7 @@ if (windows.length > 0) {
|
|
|
543
543
|
|
|
544
544
|
**截图选项**:`captureImage(options?)` 接受可选对象 `CaptureImageOptions`:
|
|
545
545
|
- `size?: { width, height }`:截取后缩放到指定宽高,不传则返回原始尺寸。
|
|
546
|
-
- **Window 专用**:`from?: 'window' | 'screen'` 默认截窗口,设为 `'screen'` 可截窗口所在显示器整屏再配合 `getBounds()` 与 `image.crop()` 裁剪;`region?: { x, y, width, height }` 仅截取该逻辑像素区域;`
|
|
546
|
+
- **Window 专用**:`from?: 'window' | 'screen'` 默认截窗口,设为 `'screen'` 可截窗口所在显示器整屏再配合 `getBounds()` 与 `image.crop()` 裁剪;`region?: { x, y, width, height }` 仅截取该逻辑像素区域;`autoSize?: true` 在 Windows 高 DPI 下自动将图像缩放到逻辑像素宽高(与 `getSize`/`getBounds` 一致)。
|
|
547
547
|
|
|
548
548
|
### 输入自动化
|
|
549
549
|
|
|
@@ -748,6 +748,16 @@ npm test
|
|
|
748
748
|
|
|
749
749
|
## 更新日志
|
|
750
750
|
|
|
751
|
+
### 0.1.6
|
|
752
|
+
|
|
753
|
+
#### BREAKCHANGE
|
|
754
|
+
|
|
755
|
+
- **Windows 平台鼠标坐标统一为逻辑像素**: `Mouse.moveTo()` 和 `Mouse.position()` 现在统一使用逻辑像素坐标,与 `Window.getBounds()` 等 API 保持一致
|
|
756
|
+
- 此前 Windows 平台上鼠标操作使用物理像素,在高 DPI 缩放环境下与窗口坐标不一致
|
|
757
|
+
- 现在 Windows 平台会自动处理 DPI 缩放,传入和返回的坐标均为逻辑像素
|
|
758
|
+
- macOS 平台不受影响(原本就使用逻辑像素)
|
|
759
|
+
|
|
760
|
+
|
|
751
761
|
### 0.1.5
|
|
752
762
|
|
|
753
763
|
#### 功能
|
|
@@ -760,8 +770,8 @@ npm test
|
|
|
760
770
|
- `regions` 中的区域可超出图片边界,会自动裁剪为与图片的交集范围进行查找
|
|
761
771
|
- **Window.captureImage 选项 `from`**:新增 `'window'`(默认)与 `'screen'`。设为 `'screen'` 时先截取窗口所在显示器整屏,再自动裁剪为当前窗口与显示器的交集区域(超出显示器的部分忽略)。
|
|
762
772
|
- **Window.captureImage 选项 `region`**:新增可选参数,仅截取指定逻辑像素区域 `{ x, y, width, height }`,不填则截取全图。
|
|
763
|
-
- **Window.captureImage 选项 `
|
|
764
|
-
- **CaptureImageOptions 处理顺序**:内部先执行 `
|
|
773
|
+
- **Window.captureImage 选项 `auto`**:新增可选参数。为 `true` 时,在 Windows 存在 DPI 缩放的情况下自动将图像缩放到逻辑像素宽高(与 `getSize`/`getBounds` 一致)。
|
|
774
|
+
- **CaptureImageOptions 处理顺序**:内部先执行 `autoSize`(缩放到逻辑像素),再执行 `region`(按逻辑像素裁剪),最后应用 `size`(若有)。启用 `autoSize` 后,`region` 与逻辑像素坐标一一对应。
|
|
765
775
|
|
|
766
776
|
### 0.1.4
|
|
767
777
|
|