Skip to content

Feature/windows screenshot feature improve#11

Open
Particaly wants to merge 2 commits into
ZToolsCenter:mainfrom
Particaly:feature/windows-screenshot-feature-improve
Open

Feature/windows screenshot feature improve#11
Particaly wants to merge 2 commits into
ZToolsCenter:mainfrom
Particaly:feature/windows-screenshot-feature-improve

Conversation

@Particaly

Copy link
Copy Markdown
Contributor

Windows 平台截图预处理工具栏 — 实现了完整的截图后编辑功能,支持:

  • 绘制工具:矩形、圆形、箭头、画笔、马赛克、文本
  • 辅助功能:翻译(暂未接入)、撤销/重做
  • 操作按钮:保存、取消、确认
  1. 代码架构重构
  • 将截图功能从 binding_windows.cpp 独立到 screenshot_windows.cpp
  • 新增 StartRegionCapture 接口作为区域截图入口
  1. 图标系统
  • 新增 12 个 SVG 图标资源(src/assets/)
  • 实现 gen-icons.js 构建脚本,将 SVG 转换为 C 头文件
  • 支持运行时颜色替换,支持 normal/hover/active 三态
  1. 第三方依赖
  • 引入 nanosvg 库(nanosvg.h + nanosvgrast.h)用于 SVG 图标渲染

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Windows region screenshot feature by moving its implementation out of src/binding_windows.cpp and introducing an automated SVG-to-C header generation script (scripts/gen-icons.js) to compile toolbar icons directly into the binary. It also adds several SVG assets and the nanosvgrast.h third-party library for SVG rasterization. Feedback on the changes points out that the toCLiteral function in scripts/gen-icons.js is defined but never used, suggesting its removal to clean up dead code.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/gen-icons.js
Comment on lines +37 to +46
// C 字符串字面量转义:处理 " \ 和换行
function toCLiteral(str) {
// 把字符串按行拆开,每行用独立字面量拼接,保证可读性且避免超长行
return str
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.split(/\r?\n/)
.map((line) => ` "${line}"`)
.join('\n');
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

scripts/gen-icons.js 中,函数 toCLiteral 被定义了但从未在代码中被调用。为了保持代码的整洁和可维护性,建议将这段未使用的死代码删除。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant