XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
"""Rasterize this project's original geometric icon and default commander portrait."""
from pathlib import Path
from PIL import Image,ImageDraw
root=Path(__file__).resolve().parents[1]/'XFEEDToolBox/Assets'
root.mkdir(exist_ok=True)
svg='''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#0a111b"/><path d="M256 42 432 144v224L256 470 80 368V144Z" fill="#122539" stroke="#ffae48" stroke-width="20"/><path d="m256 112 132 234-132-56-132 56Z" fill="#e8eff8"/><path d="m256 188 37 92-37-16-37 16Z" fill="#0a111b"/><path d="m226 332 30 60 30-60" fill="none" stroke="#54dec8" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/></svg>'''
(root/'icon.svg').write_text(svg,encoding='utf-8')
scale=3
im=Image.new('RGBA',(512*scale,512*scale));d=ImageDraw.Draw(im)
def poly(points,fill):d.polygon([(x*scale,y*scale) for x,y in points],fill=fill)
d.rounded_rectangle((0,0,512*scale-1,512*scale-1),radius=112*scale,fill='#0a111b')
hexagon=[(256,42),(432,144),(432,368),(256,470),(80,368),(80,144)]
poly(hexagon,'#122539');d.line([(x*scale,y*scale) for x,y in hexagon+[hexagon[0]]],fill='#ffae48',width=20*scale,joint='curve')
poly([(256,112),(388,346),(256,290),(124,346)],'#e8eff8');poly([(256,188),(293,280),(256,264),(219,280)],'#0a111b')
d.line([(226*scale,332*scale),(256*scale,392*scale),(286*scale,332*scale)],fill='#54dec8',width=18*scale,joint='curve')
im=im.resize((512,512),Image.Resampling.LANCZOS);im.save(root/'icon.png');im.save(root/'appicon.ico',sizes=[(16,16),(24,24),(32,32),(48,48),(64,64),(128,128),(256,256)])
avatar=Image.new('RGBA',(512,512),'#13283a');d=ImageDraw.Draw(avatar)
d.ellipse((82,320,430,670),fill='#2a6170');d.rounded_rectangle((144,86,368,354),radius=98,fill='#c4d8e5');d.rounded_rectangle((161,161,351,268),radius=41,fill='#0a111b');d.rounded_rectangle((181,181,331,226),radius=19,fill='#54dec8');d.line((209,309,303,309),fill='#ffae48',width=12)
avatar.save(root/'avatar.png')
print('Original SVG, multi-resolution ICO, PNG and default portrait written.')