v0.25.2
Experimental web-canvas backend — feature = "web-canvas" runs mirui in wasm32-unknown-unknown against an HTML <canvas> 2D context. App::tick is driven from requestAnimationFrame, DOM pointer / wheel / touch / keyboard events are bridged into the input queue, and texture uploads are cached per-canvas through OffscreenCanvas.
Added
feature = "web-canvas"— opt-in browser backend onweb-sys0.3.99,js-sys0.3.99,wasm-bindgen0.2.122,wasm-bindgen-futures0.4.72, andweb-time1.mirui::surface::web_canvas::WebCanvasSurfacewraps a DOM<canvas>, sizes the backing store tological × devicePixelRatio(fractional DPR preserved), captures the pointer onpointerdownso drags survive crossing the canvas edge, and unregisters every DOM listener throughDrop.mirui::draw::web_canvas::WebCanvasRendererFactorypaints fills / strokes / blits / text via Canvas 2D. Quad blit subdivides the source rect into an 8 × 8 affine triangle mesh — Canvas 2D has no homography, so subdivision approximates the projective warp.Runner::start_animation_frame()(undercfg(target_arch = "wasm32", feature = "web-canvas")) drives the run-loop fromrequestAnimationFrameand returns to the wasm-bindgen entry so the browser keeps owning frames.
gallery-webcrate —?demo=<name>query parameter selects whichgallery::demos::*::buildruns (dslis the default).gallery::demos::*— demo bodies hoisted out ofexamples/so the samebuild(setup)feeds both the native cargo examples and the wasm crate.xtask wasm-check—cargo check --target wasm32-unknown-unknown --no-default-features --features web-canvas --lib. Skips silently when the rustup target is missing.xtask wasm-build— release build ofgallery-webplus awasm-bindgen --target webpost-process intogallery/web/pkg/.
Changed
web_time::Instantreplacesstd::time::InstantinStdInstantClockPluginand the perf path. Native re-exportsstd::time; wasm32 readsperformance.now().
Limitations
- Effect widgets that read or modify the framebuffer —
BackgroundBlur,MirrorOf,TemporalMix— are unimplemented on Canvas 2D.gallery-webdoes not route theeffectdemo. RGB565/RGB565Swappedtextures fall through to a no-op blit.- A non-trivial 2D
WidgetTransformoutside a quad path is multiplied asdpr × widget_tfonce per command. Quad branches paint under a DPR-only matrix because the four points already encode every parent transform.