create-notification-icon.ps1 1.3 KB

1234567891011121314151617181920212223242526272829
  1. # Source for the white outline bell PNG. Kept as PNG for native WeChat Image support.
  2. Add-Type -AssemblyName System.Drawing
  3. $assetPath = Join-Path $PSScriptRoot '../src/assets/notification.png'
  4. $bitmap = New-Object System.Drawing.Bitmap 96, 96
  5. $canvas = [System.Drawing.Graphics]::FromImage($bitmap)
  6. $canvas.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
  7. $canvas.Clear([System.Drawing.Color]::Transparent)
  8. $canvas.ScaleTransform(4, 4)
  9. $stroke = New-Object System.Drawing.Pen ([System.Drawing.Color]::White), 2
  10. $stroke.StartCap = [System.Drawing.Drawing2D.LineCap]::Round
  11. $stroke.EndCap = [System.Drawing.Drawing2D.LineCap]::Round
  12. $stroke.LineJoin = [System.Drawing.Drawing2D.LineJoin]::Round
  13. $outline = New-Object System.Drawing.Drawing2D.GraphicsPath
  14. try {
  15. $outline.AddBezier(18, 8, 18, 4.7, 15.3, 2, 12, 2)
  16. $outline.AddBezier(12, 2, 8.7, 2, 6, 4.7, 6, 8)
  17. $outline.AddBezier(6, 8, 6, 15, 3, 16, 3, 18)
  18. $outline.AddLine(3, 18, 21, 18)
  19. $outline.AddBezier(21, 18, 21, 16, 18, 15, 18, 8)
  20. $outline.CloseFigure()
  21. $canvas.DrawPath($stroke, $outline)
  22. $canvas.DrawArc($stroke, 10, 18, 4, 4, 30, 120)
  23. $bitmap.Save($assetPath, [System.Drawing.Imaging.ImageFormat]::Png)
  24. } finally {
  25. $outline.Dispose()
  26. $stroke.Dispose()
  27. $canvas.Dispose()
  28. $bitmap.Dispose()
  29. }