Files
OrcaSlicer/scripts/msix/generate_assets.ps1
SoftFever 15f330641c Add Microsoft Store MSIX package build (#14142)
* docs: add MSIX Store build design spec

* docs: update MSIX spec (PFN deep link, .drc, Associate tab) and add implementation plan

* ci: add MSIX logo asset generator and generated assets

* ci: fix MSIX asset rendering edge bleed (PixelOffsetMode) and make output order deterministic

* ci: add MSIX AppxManifest template

* ci: add MSIX packaging script

* ci: make build_msix.ps1 stage-only exit dot-source safe

* ci: build MSIX Store package in Windows job

* ci: run MSIX pack after existing Windows uploads and keep it out of release downloads

* feat: add MSIX packaged-context detection helpers

* fix: resolve MSIX package APIs dynamically to keep Win7 loadable

* feat: suppress self-update in MSIX Store build

* feat: suppress runtime file associations in MSIX Store build

* feat: keep version check in MSIX build, point update dialog at the Store

The update check is notification-only (OrcaSlicer never auto-downloads),
so the Store build keeps checking for new versions instead of skipping
the check. What changes when packaged is the new-version dialog: the
Download button is hidden, the info text asks the user to update from
the Microsoft Store, and the hyperlink / wxID_YES action opens the Store
product page instead of the GitHub release page.

* docs: align spec verification plan with Store-redirect updater behavior

* feat: default MSIX identity to the reserved Partner Center values

* feat: render MSIX logos full-bleed from the gradient-circle SVG

* feat: point update dialog Download button at the Store in MSIX builds

* feat: link Associate tab to Windows Default Apps settings in MSIX builds

* docs: align spec with review-driven logo, dialog and Associate-tab changes

* clearn up
2026-06-11 23:56:16 +08:00

57 lines
2.1 KiB
PowerShell

# Generates the MSIX package logo assets from the master vector logo
# (resources\images\OrcaSlicer_gradient_circle.svg). Each PNG is rendered from
# the SVG at its exact target size (true per-size vector rasterization, not
# downscaled from one bitmap), preserving alpha transparency in the corners
# outside the circle (the manifest uses BackgroundColor="transparent").
#
# Run once locally on Windows (re-run only if the logo changes), then commit
# the PNGs in assets/. CI never runs this script.
#
# Prerequisite: Python 3 with the resvg-py package (pip install resvg-py).
# It bundles the resvg SVG renderer, needed because the master SVG uses
# gradients with alpha-fade stops that System.Drawing cannot rasterize.
param(
[string]$Python = 'python'
)
$ErrorActionPreference = 'Stop'
$repoRoot = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
$source = Join-Path $repoRoot 'resources\images\OrcaSlicer_gradient_circle.svg'
$outDir = Join-Path $PSScriptRoot 'assets'
New-Item -ItemType Directory -Force $outDir | Out-Null
$sizes = [ordered]@{
'Square150x150Logo.png' = 150
'Square44x44Logo.png' = 44
'Square44x44Logo.targetsize-44_altform-unplated.png' = 44
'StoreLogo.png' = 50
}
$py = @'
import sys
from pathlib import Path
import resvg_py
svg, out_dir = sys.argv[1], Path(sys.argv[2])
for spec in sys.argv[3:]:
name, px = spec.rsplit('=', 1)
px = int(px)
data = resvg_py.svg_to_bytes(svg_path=svg, width=px, height=px)
(out_dir / name).write_bytes(bytes(data))
print(f'Wrote {name} ({px}x{px})')
'@
$renderScript = Join-Path $env:TEMP 'orca_msix_render.py'
Set-Content -Path $renderScript -Value $py -Encoding utf8
try {
$specs = foreach ($name in $sizes.Keys) { "$name=$($sizes[$name])" }
& $Python $renderScript $source $outDir @specs
if ($LASTEXITCODE -ne 0) {
throw 'resvg render failed. Is resvg-py installed? (pip install resvg-py)'
}
}
finally {
Remove-Item $renderScript -ErrorAction SilentlyContinue
}