1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# Generates PNG icons from an inline SVG without external dependencies.
# Uses Google's svg2png-free approach: renders via WPF/WinForms is complex,
# so this script draws a simple vector-style icon with System.Drawing.
# No Node.js, no npm, no third-party libraries.
Add-Type -AssemblyName System.Drawing
$size48 = 48
$size96 = 96
function New-Icon([int]$size, [string]$path) {
$bmp = New-Object System.Drawing.Bitmap($size, $size)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
# Background: rounded rect (drawn as filled ellipse-ish square)
$bgBrush = New-Object System.Drawing.SolidBrush ([System.Drawing.Color]::FromArgb(255, 26, 115, 232))
$g.FillEllipse($bgBrush, 1, 1, $size - 2, $size - 2)
# Translate glyph: "文A" style - draw a stylized "A" and lines
$white = [System.Drawing.Brushes]::White
$font = New-Object System.Drawing.Font ('Segoe UI', [float]($size * 0.42), [System.Drawing.FontStyle]::Bold)
$sf = New-Object System.Drawing.StringFormat
$sf.Alignment = [System.Drawing.StringAlignment]::Center
$sf.LineAlignment = [System.Drawing.StringAlignment]::Center
$rect = New-Object System.Drawing.RectangleF (0, ($size * 0.08), $size, ($size * 0.8))
$g.DrawString('A', $font, [System.Drawing.Brushes]::White, $rect, $sf)
# Small underline bar
$pen = New-Object System.Drawing.Pen ([System.Drawing.Color]::White)
$pen.Width = [float]($size * 0.07)
$g.DrawLine($pen, [float]($size * 0.25), [float]($size * 0.78), [float]($size * 0.75), [float]($size * 0.8))
$pen.Dispose()
$g.Dispose()
$bmp.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
$g.Dispose()
$bmp.Dispose()
Write-Host "Created $path"
}
New-Icon $size48 "icons\icon-48.png"
New-Icon ($size48 * 2) "icons\icon-96.png"
|