@solazah/solazah-runtime 0.2.36 → 0.2.37
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/package.json +1 -1
- package/types/SystemScreen.d.ts +56 -0
package/package.json
CHANGED
package/types/SystemScreen.d.ts
CHANGED
|
@@ -151,6 +151,54 @@ export type BlobSource = string | {
|
|
|
151
151
|
region?: ScreenRect;
|
|
152
152
|
image?: string;
|
|
153
153
|
};
|
|
154
|
+
/** findFlicker 的参数:在哪块截、截多久、多快,以及闪光判据。坐标都是显示器物理像素、相对显示器左上角。 */
|
|
155
|
+
export interface FlickerOptions {
|
|
156
|
+
/** 目标显示器 id;省略取光标所在显示器 */
|
|
157
|
+
displayId?: number;
|
|
158
|
+
/** 只看这一块;省略整屏。聊天框这类会滚字的界面要排除在外 */
|
|
159
|
+
region?: ScreenRect;
|
|
160
|
+
/** 连截多久,缺省 4000 */
|
|
161
|
+
durationMs?: number;
|
|
162
|
+
/** 每秒截几帧,1..30,缺省 4 */
|
|
163
|
+
fps?: number;
|
|
164
|
+
/** 和前后各几帧比,缺省 4 */
|
|
165
|
+
halfWindow?: number;
|
|
166
|
+
/** 亮度要比前后帧的中位数高出多少才算闪,0..255,缺省 45 */
|
|
167
|
+
lift?: number;
|
|
168
|
+
/** 闪光像素的最低亮度(三通道最大值),缺省 140 */
|
|
169
|
+
minValue?: number;
|
|
170
|
+
/** 闪光的色相范围(角度),缺省 45..85,即偏黄绿的星光 */
|
|
171
|
+
hueLow?: number;
|
|
172
|
+
hueHigh?: number;
|
|
173
|
+
/** 闪光的最低饱和度 0..1,缺省 0.25 */
|
|
174
|
+
minSaturation?: number;
|
|
175
|
+
/** 一个光点的像素数范围,缺省 4..40 */
|
|
176
|
+
minSize?: number;
|
|
177
|
+
maxSize?: number;
|
|
178
|
+
/** 同一帧里多近的闪光像素合成一个光点,缺省 6 */
|
|
179
|
+
groupRadius?: number;
|
|
180
|
+
/** 多近的光点算同一处,缺省 50 */
|
|
181
|
+
clusterRadius?: number;
|
|
182
|
+
/** 最多返回几处,缺省 10 */
|
|
183
|
+
maxResults?: number;
|
|
184
|
+
/** 取消记号,同 WaitOptions.token */
|
|
185
|
+
token?: string;
|
|
186
|
+
}
|
|
187
|
+
/** 反复冒光点的一处:中心(屏幕物理像素)、冒过光点的帧数、光点总数。 */
|
|
188
|
+
export interface FlickerCluster {
|
|
189
|
+
x: number;
|
|
190
|
+
y: number;
|
|
191
|
+
frames: number;
|
|
192
|
+
spots: number;
|
|
193
|
+
}
|
|
194
|
+
/** 按冒过光点的帧数降序;unstableFrames 是画面整体在动、被跳过的帧数。 */
|
|
195
|
+
export interface FlickerResult {
|
|
196
|
+
clusters: FlickerCluster[];
|
|
197
|
+
frames: number;
|
|
198
|
+
unstableFrames: number;
|
|
199
|
+
durationMs: number;
|
|
200
|
+
cancelled: boolean;
|
|
201
|
+
}
|
|
154
202
|
export interface RecordStartOptions {
|
|
155
203
|
/** 目标显示器 id;省略取光标所在显示器 */
|
|
156
204
|
displayId?: number;
|
|
@@ -476,6 +524,14 @@ export default class SystemScreen {
|
|
|
476
524
|
* @returns `[{x, y, width, height, area, cx, cy}]`;给图片时坐标相对图片左上角,截屏时是屏幕物理像素坐标。找不到是空数组。
|
|
477
525
|
*/
|
|
478
526
|
findBlobs: (source: BlobSource, options: ColorBlobOptions) => Promise<ColorBlob[]>;
|
|
527
|
+
/**
|
|
528
|
+
* 闪烁光点:在显示器的一块区域上连截一段,找反复冒小光点的地方——游戏里可采集物冒出的星光、界面上闪的提示点。
|
|
529
|
+
* 静止的东西每帧一样亮,只有闪的才比前后帧亮出来;同一处反复冒光点的排在前面。截帧期间视角要保持不动。
|
|
530
|
+
*
|
|
531
|
+
* @param options `{displayId?, region?, durationMs?, fps?, hueLow?, hueHigh?, …, token?}`,见 FlickerOptions。
|
|
532
|
+
* @returns `{clusters: [{x, y, frames, spots}], frames, unstableFrames, durationMs, cancelled}`,坐标是屏幕物理像素;找不到 clusters 为空。
|
|
533
|
+
*/
|
|
534
|
+
findFlicker: (options?: FlickerOptions) => Promise<FlickerResult>;
|
|
479
535
|
/**
|
|
480
536
|
* 屏幕录制:采集与编码全在宿主的原生线程(mac ScreenCaptureKit + VideoToolbox 硬件 H.264,Windows WGC + Media Foundation),
|
|
481
537
|
* mp4 或 gif 直接写到给定路径,页面不经手任何帧。同一时刻只有一个会话;本视图销毁、到了 maxSeconds 都会自动停。
|