feat: V1.0.0 发布(呆头鹅)
- 默认浅色白底主题;字体整数化 + Microsoft YaHei UI 提升清晰度 - 相位分区:圆周/条形显示、沿弧排列、拖拽边界(虚线参考+弱吸附)、增删改(对话框/右键/双击) - 动作:Ctrl 多选批量对齐;上下拖拽自由换行;左右端拖拽改起止(虚线+弱吸附+左右箭头光标) - 动作编辑支持角度与时间双向换算 - 圆周顺时针箭头移至刻度环外;条形左侧标题列收窄 - 侧栏可隐藏/钉住;适应视图按内容自适应;节拍统计改为按钮弹窗 - AI 生成时序图(DeepSeek,Flash/Pro,推理强度),基于 dart:io 无插件 - 窗口标题显示文件名/未命名文件;关于信息(设计人/版本/版权) - 全量中文注释、docs/ARCHITECTURE.md、docs/HELP.md(按任务组织) - 构建脚本输出到 dist/,并附带 dist 生成物
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate the Sequence Diagram Studio application icon.
|
||||
|
||||
A clock / cycle dial that reflects the product spirit: one turn = one cycle,
|
||||
12 o'clock origin, clockwise phase progression.
|
||||
|
||||
Outputs:
|
||||
windows/runner/resources/app_icon.ico (multi-size, for the Windows build)
|
||||
demo/app-icon.png (1024px preview)
|
||||
"""
|
||||
import math
|
||||
import os
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
OUT_ICO = os.path.join(ROOT, "windows", "runner", "resources", "app_icon.ico")
|
||||
OUT_PNG = os.path.join(ROOT, "demo", "app-icon.png")
|
||||
|
||||
S = 1024
|
||||
BG_TOP = (14, 21, 32, 255)
|
||||
BG_BOT = (11, 16, 24, 255)
|
||||
LINE = (31, 44, 64, 255)
|
||||
ACCENT = (76, 201, 240, 255)
|
||||
ACCENT2 = (124, 92, 255, 255)
|
||||
OK = (52, 211, 153, 255)
|
||||
DIAL = (12, 19, 32, 255)
|
||||
TICK = (42, 58, 82, 255)
|
||||
TEXT = (232, 238, 252, 255)
|
||||
|
||||
|
||||
def lerp(a, b, t):
|
||||
return tuple(round(a[i] + (b[i] - a[i]) * t) for i in range(4))
|
||||
|
||||
|
||||
def rounded_mask(size, radius, inset=0):
|
||||
m = Image.new("L", (size, size), 0)
|
||||
d = ImageDraw.Draw(m)
|
||||
d.rounded_rectangle(
|
||||
[inset, inset, size - 1 - inset, size - 1 - inset],
|
||||
radius=radius,
|
||||
fill=255,
|
||||
)
|
||||
return m
|
||||
|
||||
|
||||
def polar(cx, cy, r, deg):
|
||||
t = math.radians(deg - 90)
|
||||
return (cx + r * math.cos(t), cy + r * math.sin(t))
|
||||
|
||||
|
||||
def arc(draw, cx, cy, r, a0, a1, color, width):
|
||||
draw.arc(
|
||||
[cx - r, cy - r, cx + r, cy + r],
|
||||
start=a0 - 90,
|
||||
end=a1 - 90,
|
||||
fill=color,
|
||||
width=width,
|
||||
)
|
||||
|
||||
|
||||
def build_master():
|
||||
img = Image.new("RGBA", (S, S), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Rounded-square body with a vertical gradient.
|
||||
body = Image.new("RGBA", (S, S), (0, 0, 0, 0))
|
||||
bd = ImageDraw.Draw(body)
|
||||
for y in range(S):
|
||||
bd.line([(0, y), (S, y)], fill=lerp(BG_TOP, BG_BOT, y / (S - 1)))
|
||||
mask = rounded_mask(S, 210, inset=48)
|
||||
img.paste(body, (0, 0), mask)
|
||||
|
||||
# Inner border ring.
|
||||
draw.rounded_rectangle(
|
||||
[48, 48, S - 1 - 48, S - 1 - 48],
|
||||
radius=210,
|
||||
outline=LINE,
|
||||
width=6,
|
||||
)
|
||||
|
||||
cx = cy = S // 2
|
||||
r_ring = 320
|
||||
ring_w = 46
|
||||
|
||||
# Dial disc.
|
||||
draw.ellipse(
|
||||
[cx - r_ring - ring_w // 2, cy - r_ring - ring_w // 2,
|
||||
cx + r_ring + ring_w // 2, cy + r_ring + ring_w // 2],
|
||||
fill=DIAL,
|
||||
outline=LINE,
|
||||
width=4,
|
||||
)
|
||||
|
||||
# 12 / 3 / 6 / 9 major ticks.
|
||||
for d in range(0, 360, 30):
|
||||
major = d % 90 == 0
|
||||
r1 = r_ring - 96
|
||||
r2 = r_ring - (52 if major else 74)
|
||||
col = ACCENT if major else TICK
|
||||
w = 14 if major else 9
|
||||
draw.line([polar(cx, cy, r1, d), polar(cx, cy, r2, d)], fill=col, width=w)
|
||||
|
||||
# Phase arcs on the outer ring: two "actions" of the cycle.
|
||||
arc(draw, cx, cy, r_ring, 0, 70, ACCENT, ring_w)
|
||||
arc(draw, cx, cy, r_ring, 105, 190, ACCENT2, ring_w)
|
||||
arc(draw, cx, cy, r_ring, 300, 360, OK, ring_w)
|
||||
|
||||
# Clock hands: classic 10:10 pose.
|
||||
for r, deg, col, w in ((168, 305, TEXT, 34), (238, 55, ACCENT, 26)):
|
||||
hx, hy = polar(cx, cy, r, deg)
|
||||
draw.line([(cx, cy), (hx, hy)], fill=col, width=w)
|
||||
draw.ellipse([hx - w / 2, hy - w / 2, hx + w / 2, hy + w / 2], fill=col)
|
||||
|
||||
# Hub.
|
||||
draw.ellipse([cx - 30, cy - 30, cx + 30, cy + 30], fill=TEXT)
|
||||
draw.ellipse([cx - 13, cy - 13, cx + 13, cy + 13], fill=DIAL)
|
||||
|
||||
return img
|
||||
|
||||
|
||||
def main():
|
||||
master = build_master()
|
||||
os.makedirs(os.path.dirname(OUT_ICO), exist_ok=True)
|
||||
os.makedirs(os.path.dirname(OUT_PNG), exist_ok=True)
|
||||
|
||||
master.save(OUT_PNG)
|
||||
|
||||
sizes = [256, 128, 64, 48, 32, 24, 16]
|
||||
frames = [master.resize((s, s), Image.LANCZOS) for s in sizes]
|
||||
frames[0].save(
|
||||
OUT_ICO,
|
||||
format="ICO",
|
||||
sizes=[(s, s) for s in sizes],
|
||||
append_images=frames[1:],
|
||||
)
|
||||
print("wrote", OUT_ICO)
|
||||
print("wrote", OUT_PNG)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user