From f7895ae3e69cefebf111cc64d209f5343905c776 Mon Sep 17 00:00:00 2001 From: beierweiwei <364704059@qq.com> Date: Wed, 11 Nov 2026 10:17:56 +0800 Subject: [PATCH] =?UTF-8?q?Update=20plugin=20=E5=A4=A7=E5=8F=A4=E6=88=AA?= =?UTF-8?q?=E5=9B=BE=20v1.2.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - feat: restore OCR translation support - feat: add translation provider language profiles - feat: improve OCR window layout and editor sizing - feat: improve OCR plugin flows and window handling - fix: repair editor window close flow and add preview collapse - feat: add provider setup guide to settings panel - feat: add first-use setup command and auto-open config panel - fix: improve OCR editor workflows - feat: rename plugin and update logo - chore: prepare plugin for ZTools submission - docs: add plugin submission screenshots - feat: add editor download & zoom/pan, English commands, user README - test: add SettingsStore cross-machine sync coverage - chore: bump plugin version to 1.1.0 and update changelog - chore: publish plugin from source root and ship user README - feat: 重写截图为沉浸式标注器,主题色收敛(v1.2.0) - chore: 移除无引用的旧界面截图,README 改引用当前标注界面 - fix: 截图导出按视口坐标裁剪,修复高分屏选区内容错位 - chore: bump plugin version to 1.2.1 and update changelog - chore: 沉淀 ztools publish 本机网络故障排查与代理注入脚本 - fix: HDR 截图全白时回退系统截图 - chore: 排除插件包内发布辅助文件 - docs: keep official release guide in plugin package - chore: preserve official release guide bytes --- plugins/dagu-ocr/CHANGELOG.md | 6 +++++ plugins/dagu-ocr/plugin.json | 2 +- .../dagu-ocr/src/capture/desktop-capture.js | 26 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/plugins/dagu-ocr/CHANGELOG.md b/plugins/dagu-ocr/CHANGELOG.md index c80042730..a61fb84e2 100644 --- a/plugins/dagu-ocr/CHANGELOG.md +++ b/plugins/dagu-ocr/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.2.2 - 2026-11-11 + +### 修复 + +- 修复 Windows HDR 显示器下桌面捕获帧可能全白的问题:检测到整帧纯白时自动回退 ZTools 系统截图,再进入同一套标注界面,避免把过曝冻帧当成正常画面。 + ## 1.2.1 - 2026-10-30 ### 修复 diff --git a/plugins/dagu-ocr/plugin.json b/plugins/dagu-ocr/plugin.json index 994afda48..623e3b9b9 100644 --- a/plugins/dagu-ocr/plugin.json +++ b/plugins/dagu-ocr/plugin.json @@ -1,7 +1,7 @@ { "name": "dagu-ocr", "title": "大古截图", - "version": "1.2.1", + "version": "1.2.2", "description": "截图、OCR 文字识别与图片翻译,从图片中提取并翻译文字", "author": "beierweiwei", "logo": "icon.png", diff --git a/plugins/dagu-ocr/src/capture/desktop-capture.js b/plugins/dagu-ocr/src/capture/desktop-capture.js index e1acde72b..9b7b335c5 100644 --- a/plugins/dagu-ocr/src/capture/desktop-capture.js +++ b/plugins/dagu-ocr/src/capture/desktop-capture.js @@ -84,6 +84,29 @@ export function pickSourceForDisplay(sources, display) { return list.find((source) => /^screen/i.test(String(source.id || ''))) || list[0]; } +async function isSolidWhiteFrame(dataUrl, win = globalThis.window) { + if (!dataUrl.startsWith('data:image/') || !win?.Image || !win?.document?.createElement) return false; + const image = new win.Image(); + const loaded = new Promise((resolve, reject) => { + image.onload = resolve; + image.onerror = () => reject(new Error('截图帧解码失败')); + }); + image.src = dataUrl; + await loaded; + + const canvas = win.document.createElement('canvas'); + canvas.width = 16; + canvas.height = 16; + const context = canvas.getContext('2d', { willReadFrequently: true }); + if (!context) return false; + context.drawImage(image, 0, 0, canvas.width, canvas.height); + const pixels = context.getImageData(0, 0, canvas.width, canvas.height).data; + for (let index = 0; index < pixels.length; index += 4) { + if (pixels[index] !== 255 || pixels[index + 1] !== 255 || pixels[index + 2] !== 255) return false; + } + return true; +} + // 返回原始分辨率截图(image 像素与显示器物理像素一致)。 export async function captureDisplay(win, display) { const host = hostApi(win); @@ -96,6 +119,9 @@ export async function captureDisplay(win, display) { const thumbnail = source?.thumbnail; const dataUrl = typeof thumbnail?.toDataURL === 'function' ? thumbnail.toDataURL() : ''; if (!dataUrl) throw new Error('未获取到屏幕截图'); + if (await isSolidWhiteFrame(dataUrl, win)) { + throw new Error('HDR 环境截图输出全白,已回退系统截图'); + } const size = typeof thumbnail?.getSize === 'function' ? thumbnail.getSize() : requested; return { dataUrl,