add Store listing images: 9:16 poster and 300x300 logo
Partner Center's screenshots and logos steps needed sizes the MSIX package doesn't produce, so they are drawn separately with the same mark.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,84 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Draws the Store 9:16 poster (720x1080), matching the mark drawn by
|
||||
Packaging\New-Assets.ps1 (a dark plate with a white "Aя").
|
||||
|
||||
.DESCRIPTION
|
||||
One-off script, not part of the packaging pipeline: this poster is a Store
|
||||
listing image, uploaded by hand in Partner Center rather than shipped
|
||||
inside the MSIX, so it does not belong next to the logos that build feeds
|
||||
into the package.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string] $OutPath = (Join-Path $PSScriptRoot 'Poster720x1080.png')
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$Width = 720
|
||||
$Height = 1080
|
||||
$Background = [System.Drawing.Color]::FromArgb(255, 0x20, 0x20, 0x20)
|
||||
$Foreground = [System.Drawing.Color]::FromArgb(255, 0xFF, 0xFF, 0xFF)
|
||||
$Glyph = 'Aя'
|
||||
|
||||
$bitmap = New-Object System.Drawing.Bitmap($Width, $Height, [System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
|
||||
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
||||
|
||||
try {
|
||||
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
|
||||
$graphics.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::AntiAliasGridFit
|
||||
|
||||
# Full bleed: Partner Center masks/rounds the poster itself, so the plate
|
||||
# here just fills the whole canvas rather than drawing its own corners
|
||||
$graphics.Clear($Background)
|
||||
|
||||
# The glyph is sized off the width, the narrower of the two dimensions,
|
||||
# the same way New-Assets.ps1 sizes it off the shorter side of a square
|
||||
[System.Drawing.StringFormat] $format = [System.Drawing.StringFormat]::GenericTypographic.Clone()
|
||||
|
||||
try {
|
||||
$target = $Width * 0.62
|
||||
$ceiling = $Height * 0.30
|
||||
$fontSize = $Width * 0.9
|
||||
$font = $null
|
||||
$measured = $null
|
||||
|
||||
for ($attempt = 0; $attempt -lt 20; $attempt++) {
|
||||
if ($font) { $font.Dispose() }
|
||||
$font = New-Object System.Drawing.Font('Segoe UI', $fontSize, [System.Drawing.FontStyle]::Bold, [System.Drawing.GraphicsUnit]::Pixel)
|
||||
$measured = $graphics.MeasureString($Glyph, $font, ([System.Drawing.PointF]::new(0, 0)), $format)
|
||||
|
||||
if ($measured.Width -le $target -and $measured.Height -le $ceiling) { break }
|
||||
|
||||
$scale = [Math]::Min($target / $measured.Width, $ceiling / $measured.Height)
|
||||
$fontSize = $fontSize * $scale * 0.98
|
||||
}
|
||||
|
||||
try {
|
||||
$x = [Math]::Round(($Width - $measured.Width) / 2.0)
|
||||
$y = [Math]::Round(($Height - $measured.Height) / 2.0)
|
||||
|
||||
$brush = New-Object System.Drawing.SolidBrush($Foreground)
|
||||
$origin = New-Object System.Drawing.PointF($x, $y)
|
||||
|
||||
try { $graphics.DrawString($Glyph, $font, $brush, $origin, $format) }
|
||||
finally { $brush.Dispose() }
|
||||
}
|
||||
finally {
|
||||
$font.Dispose()
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$format.Dispose()
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$graphics.Dispose()
|
||||
}
|
||||
|
||||
try { $bitmap.Save($OutPath, [System.Drawing.Imaging.ImageFormat]::Png) } finally { $bitmap.Dispose() }
|
||||
Write-Host "Saved $OutPath"
|
||||
Reference in New Issue
Block a user