feat: 初始提交——一键运行快捷轮盘工具(WPF + C#)

This commit is contained in:
2026-08-30 15:44:15 +08:00
commit 2081a938bf
63 changed files with 4214 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
# 验证扇形文字走向:水平文字 → 白色水平笔画段占优;旧径向布局 → 对角笔画段占优
# 并校验图标位置:新布局图标在文字上方(旧布局图标朝外侧/下方)
$ErrorActionPreference = 'Stop'
Add-Type -AssemblyName System.Drawing
$bmp = [System.Drawing.Bitmap]::FromFile((Resolve-Path 'artifacts\wheel-light.png'))
# 3 项配置:扇形中点 -30°/90°/210°,中半径 145
$regions = @(
@{ Name = '扇形0(右上, 旧布局=对角60°)'; X = 328; Y = 168; W = 132; H = 57 },
@{ Name = '扇形1(下方, 旧布局=倒置水平)'; X = 204; Y = 385; W = 128; H = 55 },
@{ Name = '扇形2(左侧, 旧布局=对角-60°)'; X = 77; Y = 168; W = 132; H = 57 }
)
function Is-White($px) { return $px.A -gt 200 -and ($px.R + $px.G + $px.B) -gt 700 }
foreach ($r in $regions) {
$x0 = $r.X; $y0 = $r.Y; $w = $r.W; $h = $r.H
$white = New-Object 'bool[,]' ($h + 2), ($w + 2)
$topN = 0; $midN = 0; $botN = 0
for ($y = 0; $y -lt $h; $y++) {
for ($x = 0; $x -lt $w; $x++) {
$isWhite = Is-White ($bmp.GetPixel($x0 + $x, $y0 + $y))
$white[$y, $x] = $isWhite
if ($isWhite) {
if ($y -lt [int]($h / 3)) { $topN++ }
elseif ($y -lt [int](2 * $h / 3)) { $midN++ }
else { $botN++ }
}
}
}
$hRuns = 0; $vRuns = 0; $d1Runs = 0; $d2Runs = 0
for ($y = 0; $y -lt $h; $y++) {
$len = 0
for ($x = 0; $x -le $w; $x++) {
if ($x -lt $w -and $white[$y, $x]) { $len++ }
else { if ($len -ge 4) { $hRuns++ }; $len = 0 }
}
}
for ($x = 0; $x -lt $w; $x++) {
$len = 0
for ($y = 0; $y -le $h; $y++) {
if ($y -lt $h -and $white[$y, $x]) { $len++ }
else { if ($len -ge 4) { $vRuns++ }; $len = 0 }
}
}
for ($s = 0; $s -lt ($w + $h - 1); $s++) {
$len = 0
for ($y = 0; $y -lt $h; $y++) {
$x = $s - $y
if ($x -ge 0 -and $x -lt $w) {
if ($white[$y, $x]) { $len++ } else { if ($len -ge 4) { $d1Runs++ }; $len = 0 }
}
}
if ($len -ge 4) { $d1Runs++ }
}
for ($s = -($h - 1); $s -lt $w; $s++) {
$len = 0
for ($x = 0; $x -lt $w; $x++) {
$y = $x - $s
if ($y -ge 0 -and $y -lt $h) {
if ($white[$y, $x]) { $len++ } else { if ($len -ge 4) { $d2Runs++ }; $len = 0 }
}
}
if ($len -ge 4) { $d2Runs++ }
}
Write-Output ("{0}" -f $r.Name)
Write-Output (" 笔画段: 水平={0} 垂直={1} 对角45={2} 对角-45={3} (水平文字期望: 水平占优, 对角极少)" -f $hRuns, $vRuns, $d1Runs, $d2Runs)
Write-Output (" 白色像素分布 上/中/下 = {0}/{1}/{2} (新布局期望: 上段为图标密集, 下段为文字)" -f $topN, $midN, $botN)
}
$bmp.Dispose()