///| The native build draws with the software renderer (`@renderer.render_scene`); there is no host /// to send a scene to. ///| pub fn submit(_scene : @scene.SceneGraph) -> Unit { abort("the host rasteriser is only available to the wasm compositor") } ///| pub fn read_frame(_width : Int, _height : Int) -> @renderer.Pixmap { abort("the host rasteriser is only available to the wasm compositor") } ///| Images already loaded, by path (0: it failed, don't try again). let loaded_images : Map[String, UInt] = {} ///| Load the image file at `path` for `Image` draw ops: a handle, or 0 when it can't be decoded. /// The software renderer only reads PNG (an SVG icon gets 0, and the caller's fallback). pub fn load_image(path : String) -> UInt { match loaded_images.get(path) { Some(h) => h None => { let h = if path.has_suffix(".png") { match @renderer.decode_png(@sys.read_file_bytes(path)) { Some(p) => @renderer.add_image(p) None => 0U } } else { 0U } loaded_images.set(path, h) h } } }