Files
ios/tools/generate_icon.ps1
T

26 lines
1.5 KiB
PowerShell

# Original vector artwork, rendered to the opaque 1024px asset required by Xcode.
$ErrorActionPreference = 'Stop'
Add-Type -AssemblyName System.Drawing
$iconFolder = Join-Path $PSScriptRoot '..\MusicBridge\Assets.xcassets\AppIcon.appiconset'
[System.IO.Directory]::CreateDirectory($iconFolder) | Out-Null
$bitmap = [System.Drawing.Bitmap]::new(1024, 1024, [System.Drawing.Imaging.PixelFormat]::Format24bppRgb)
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
$background = [System.Drawing.Drawing2D.LinearGradientBrush]::new(
[System.Drawing.Point]::new(0, 0), [System.Drawing.Point]::new(1024, 1024),
[System.Drawing.Color]::FromArgb(59, 43, 164), [System.Drawing.Color]::FromArgb(23, 145, 158))
$graphics.FillRectangle($background, 0, 0, 1024, 1024)
$ink = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::White)
$heights = @(176, 316, 472, 316, 176)
for ($index = 0; $index -lt 5; $index++) {
$barX = 204 + $index * 132
$barHeight = $heights[$index]
$barY = 512 - $barHeight / 2
$graphics.FillRectangle($ink, $barX, $barY + 42, 88, $barHeight - 84)
$graphics.FillEllipse($ink, $barX, $barY, 88, 88)
$graphics.FillEllipse($ink, $barX, $barY + $barHeight - 88, 88, 88)
}
$bitmap.Save((Join-Path $iconFolder 'AppIcon.png'), [System.Drawing.Imaging.ImageFormat]::Png)
$ink.Dispose(); $background.Dispose(); $graphics.Dispose(); $bitmap.Dispose()
Write-Output 'Generated original MusicBridge icon: 1024x1024 RGB PNG.'