Skip to main content

Module images

Module images 

Source
Expand description

Image URL types for web rendering.

Image drawables (cotis_defaults::render_commands::Image) require an associated type that implements URLImage. The renderer uses URLImage::url to set CSS background-image: url("...").

URLImageEnum is the usual choice for ElementConfig image type parameters in WASM apps.

§Path conventions

URLs are passed to the browser as-is. Use paths relative to the page origin (e.g. "assets/logo.png") or absolute URLs. The renderer does not prepend HTMLRenderer::new’s stored origin automatically today.

§API status

The image URL API is incomplete (// TODO Finish this in source). Current behavior delegates to get_path() on PNGImage, JPEGImage, and SVGImage. Blob URLs, data URLs, and async loading are not yet handled.

Enums§

URLImageEnum
Sum type over the standard Cotis image formats for web apps.

Traits§

URLImage
Types that can provide a URL string for CSS background-image.