assets: add A01 login design resources
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$backgrounds = @(
|
||||
'static/assets/backgrounds/auth-ancestral-header-v1.png',
|
||||
'static/assets/backgrounds/auth-rice-paper-v1.jpg',
|
||||
'static/assets/backgrounds/auth-ink-scenery-v1.png'
|
||||
)
|
||||
$icons = @(
|
||||
'static/assets/icons/auth/login-outline-v1.png',
|
||||
'static/assets/icons/auth/wechat-licensed-v1.png'
|
||||
)
|
||||
|
||||
foreach ($asset in $backgrounds + $icons) {
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $root $asset))) {
|
||||
throw "Missing A01 asset: $asset"
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($asset in $icons) {
|
||||
$bitmap = [System.Drawing.Bitmap]::FromFile((Join-Path $root $asset))
|
||||
$width = [int]$bitmap.Width
|
||||
$height = [int]$bitmap.Height
|
||||
$corners = @(
|
||||
$bitmap.GetPixel(0, 0).A,
|
||||
$bitmap.GetPixel(($width - 1), 0).A,
|
||||
$bitmap.GetPixel(0, ($height - 1)).A,
|
||||
$bitmap.GetPixel(($width - 1), ($height - 1)).A
|
||||
)
|
||||
$visiblePixels = 0
|
||||
for ($y = 0; $y -lt $height; $y++) {
|
||||
for ($x = 0; $x -lt $width; $x++) {
|
||||
if ($bitmap.GetPixel($x, $y).A -gt 24) { $visiblePixels++ }
|
||||
}
|
||||
}
|
||||
$bitmap.Dispose()
|
||||
|
||||
if ($width -ne 96 -or $height -ne 96) { throw "$asset must be 96 x 96px." }
|
||||
if (($corners | Where-Object { $_ -ne 0 }).Count -ne 0) { throw "$asset has opaque outer corners." }
|
||||
if ($visiblePixels -lt 80) { throw "$asset has no usable visible artwork." }
|
||||
Write-Output "PASS $asset transparent corners and visible artwork"
|
||||
}
|
||||
|
||||
Write-Output 'A01-ASSET-ALPHA-AUDIT PASS'
|
||||
Reference in New Issue
Block a user