|
| 1 | +Add-Type -AssemblyName System.Drawing |
| 2 | + |
| 3 | +$size = 64 |
| 4 | +$bitmap = New-Object System.Drawing.Bitmap $size, $size, ([System.Drawing.Imaging.PixelFormat]::Format32bppArgb) |
| 5 | +$graphics = [System.Drawing.Graphics]::FromImage($bitmap) |
| 6 | +$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias |
| 7 | +$graphics.Clear([System.Drawing.Color]::Transparent) |
| 8 | + |
| 9 | +$background = New-Object System.Drawing.Drawing2D.LinearGradientBrush( |
| 10 | + (New-Object System.Drawing.Rectangle 0, 0, $size, $size), |
| 11 | + [System.Drawing.Color]::FromArgb(255, 16, 91, 122), |
| 12 | + [System.Drawing.Color]::FromArgb(255, 28, 143, 99), |
| 13 | + 35 |
| 14 | +) |
| 15 | +$graphics.FillEllipse($background, 2, 2, $size - 4, $size - 4) |
| 16 | + |
| 17 | +$border = New-Object System.Drawing.Pen ([System.Drawing.Color]::FromArgb(238, 255, 255, 255)), 3 |
| 18 | +$graphics.DrawEllipse($border, 3, 3, $size - 7, $size - 7) |
| 19 | + |
| 20 | +$shield = New-Object System.Drawing.Drawing2D.GraphicsPath |
| 21 | +$shield.AddLine(32, 12, 49, 20) |
| 22 | +$shield.AddLine(49, 20, 45, 40) |
| 23 | +$shield.AddBezier(45, 40, 42, 50, 36, 55, 32, 58) |
| 24 | +$shield.AddBezier(32, 58, 28, 55, 22, 50, 19, 40) |
| 25 | +$shield.AddLine(19, 40, 15, 20) |
| 26 | +$shield.CloseFigure() |
| 27 | + |
| 28 | +$shieldBrush = New-Object System.Drawing.SolidBrush ([System.Drawing.Color]::FromArgb(247, 255, 255, 255)) |
| 29 | +$graphics.FillPath($shieldBrush, $shield) |
| 30 | + |
| 31 | +$check = New-Object System.Drawing.Pen ([System.Drawing.Color]::FromArgb(255, 18, 112, 92)), 5 |
| 32 | +$check.StartCap = [System.Drawing.Drawing2D.LineCap]::Round |
| 33 | +$check.EndCap = [System.Drawing.Drawing2D.LineCap]::Round |
| 34 | +$graphics.DrawLine($check, 24, 35, 30, 42) |
| 35 | +$graphics.DrawLine($check, 30, 42, 43, 27) |
| 36 | + |
| 37 | +$handle = $bitmap.GetHicon() |
| 38 | +$icon = [System.Drawing.Icon]::FromHandle($handle) |
| 39 | +$iconPath = Join-Path $PSScriptRoot 'SecureBootInspector.ico' |
| 40 | +$stream = [System.IO.File]::Create($iconPath) |
| 41 | +try { |
| 42 | + $icon.Save($stream) |
| 43 | +} |
| 44 | +finally { |
| 45 | + $stream.Dispose() |
| 46 | + $icon.Dispose() |
| 47 | + $check.Dispose() |
| 48 | + $shieldBrush.Dispose() |
| 49 | + $shield.Dispose() |
| 50 | + $border.Dispose() |
| 51 | + $background.Dispose() |
| 52 | + $graphics.Dispose() |
| 53 | + $bitmap.Dispose() |
| 54 | +} |
| 55 | + |
| 56 | +Write-Host "Created $iconPath" |
0 commit comments