// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown // SPDX-License-Identifier: GPL-3.0-or-later // Renders each app tab (with the demo song loaded) to PNG on the Mac, in an iPad // portrait and landscape size: `make -C ios screen-snapshots` → build/screens/png/. import AppKit import SwiftUI @main struct ScreenSnapshots { @MainActor static func main() { Snapshot.active = true setenv("SIZZLE_NO_AUDIO", "1", 1) let args = CommandLine.arguments let out = URL(fileURLWithPath: args.count > 1 ? args[1] : "png") try? FileManager.default.createDirectory(at: out, withIntermediateDirectories: true) if args.count > 2, let text = try? String(contentsOfFile: args[2]) { try? SizzleSession.shared.loadProjectText(text) } let sizes: [(String, CGSize)] = [("portrait", CGSize(width: 768, height: 1024)), ("landscape", CGSize(width: 1024, height: 768))] for tab in AppModel.Tab.allCases { for (orientation, size) in sizes { let app = AppModel() app.tab = tab let view = ScreenHarness(app: app).frame(width: size.width, height: size.height) let r = ImageRenderer(content: view) r.scale = 2 guard let img = r.cgImage else { print("FAIL \(tab)"); continue } let name = "\(tab.rawValue)_\(tab)_\(orientation).png" try? NSBitmapImageRep(cgImage: img).representation(using: .png, properties: [:])? .write(to: out.appendingPathComponent(name)) print("wrote \(name)") } } } } /// RootView's layout with a given AppModel (RootView owns its own). private struct ScreenHarness: View { @ObservedObject var app: AppModel var body: some View { RootView(model: app) } }