feat(v0.2): shturman-splash — Stage-0 splash (software-render → PNG)
P6.2: статичный брендовый splash-кадр (wordmark «Штурман» на тёмном), render_splash через shturman-render; bin с --screenshot. Без чтения шины (стартует до Power/Settings → «мгновенно»). Визуальные токены — каркас (язык v0.5). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Alexander <akotenev2003@gmail.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
//! `shturman-splash` (lib) — Stage-0 splash-кадр (A05). Статичный брендовый кадр (без шины → «мгновенно»).
|
||||
//! Визуальные токены — каркас (язык design-system — гейт v0.5). Спека v0.2 §6.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
slint::slint! {
|
||||
export component SplashWindow inherits Window {
|
||||
in property <string> brand: "Штурман";
|
||||
width: 1024px;
|
||||
height: 600px;
|
||||
background: #0e1014;
|
||||
Text {
|
||||
text: root.brand;
|
||||
font-size: 64px;
|
||||
color: #e8eaed;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const W: u32 = 1024;
|
||||
const H: u32 = 600;
|
||||
|
||||
/// Headless software-render splash-кадра в PNG (без дисплея/композитора).
|
||||
pub fn render_splash(path: &Path) -> anyhow::Result<()> {
|
||||
shturman_render::render_to_png(|| Ok(SplashWindow::new()?), W, H, path)?;
|
||||
tracing::info!(path = %path.display(), "splash записан (software-render)");
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//! `shturman-splash` (bin) — Stage-0 splash. `--screenshot <path>` → headless PNG (VM/E2E);
|
||||
//! без аргументов — интерактив (dev/HW; в v0 VM используется только screenshot-режим).
|
||||
|
||||
use shturman_splash::render_splash;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
shturman_common::init_tracing("shturman-splash");
|
||||
match parse_screenshot_arg() {
|
||||
Some(path) => {
|
||||
render_splash(&path)?;
|
||||
println!("{}", path.display());
|
||||
}
|
||||
None => {
|
||||
// интерактив придёт с живым дисплеем (v0.5); в v0 VM splash — только screenshot.
|
||||
anyhow::bail!("ожидался --screenshot <path> (интерактивный splash — v0.5)");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Разобрать `--screenshot <path>` / `--screenshot=<path>` (без внешних зависимостей).
|
||||
fn parse_screenshot_arg() -> Option<PathBuf> {
|
||||
let mut args = std::env::args().skip(1);
|
||||
while let Some(a) = args.next() {
|
||||
if a == "--screenshot" {
|
||||
return args.next().map(PathBuf::from);
|
||||
}
|
||||
if let Some(p) = a.strip_prefix("--screenshot=") {
|
||||
return Some(PathBuf::from(p));
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
Reference in New Issue
Block a user