Expand description
Ezu Style Spec — declarative style specification for painterly map rendering.
Parsing this crate produces a Document — a pure data structure,
not an evaluator. To execute it, feed the document to
ezu-graph::build_graph with a NodeRegistry.
let json = std::fs::read_to_string("watercolor.json").unwrap();
let doc = ezu_style::Document::from_json(&json).unwrap();
println!("{} ({} nodes)", doc.name, doc.nodes.len());Structs§
- Comment
Error - A block comment that never closed. Reported on its own rather than left to the JSON parser, which would blame whatever the runaway comment swallowed.
- DemSource
- Raster-DEM source. Tiles encode elevation in the RGB channels using
either the Mapzen / Terrarium scheme
(
h = (R*256 + G + B/256) - 32768) or the Mapbox / MapLibre Terrain-RGB scheme (h = -10000 + (R*65536 + G*256 + B) * 0.1). - Document
- A parsed style document. Order of
nodesis preserved (for deterministic error messages) but does not imply evaluation order — that is derived by topological sort of the DAG. - Expanded
- Result of expanding a document’s functions.
- File
Source - A document-scoped, file-based source.
srcis a path the host resolves (relative to--assets-dir) or anhttp(s)://URL. - Font
Source - A document-scoped font face (TTF / OTF / TTC bytes) consumed by the
textnode’sfontfallback stack. Theurldoubles as the font’s asset key, like a sprite source’simage. - Func
Decl - A user-defined function: a reusable node subgraph with declared
input ports and output kind. Shaped like a mini-document —
inputsplay the role ofparams,nodesis the body,outputnames the body node whose value the call produces. - Func
Input - One declared function input.
- GeoJson
Source - Inline (or URL) GeoJSON in WGS84 lon/lat. The host projects it into each
tile’s local coordinate frame and binds it under
<source>.<source>. - Glyphs
Source - A MapLibre-compatible glyph endpoint: pre-rendered SDF glyphs served
in 256-codepoint ranges from a URL template. The
textnode’sfontstack may name aglyphssource wherever it may name afontsource — lower fidelity (fixed 24 px SDF bitmaps) but zero font files, matching what MapLibre GL itself renders from. - Icon
Rect - One entry of a sprite index — a sub-rectangle of the atlas. Mirrors the
MapLibre sprite-JSON entry shape (extra keys like
sdfare ignored) so a fetched index deserializes into the same type. - Kind
Check - A declared-kind check the host should verify once the graph is built and port kinds are resolved. Produced per call site so kind errors can name the call instead of an expanded internal port.
- Legend
Decl - A declared legend: what the map’s symbols mean, in the order they should be read.
- Legend
Entry - One row of a legend: a label, and the symbol it explains identified by where that symbol comes from.
- MvtSource
- Templated XYZ MVT tile source.
- NodeRef
- A reference to a node id, optionally prefixed with
@. The prefix is stripped on parse. - Node
Spec - One node entry.
opselects the implementation; remaining fields are op-specific and are validated by theNodeFactoryregistered forop. - Param
Decl - Declaration of a document-level parameter (overridable at render time).
- Pmtiles
Source - PMTiles archive source — local path or
http(s)://URL. - Raster
Source - RGBA raster tile pyramid (satellite imagery, pre-rendered
basemaps, …) consumed by the
rasternode as a canvas-sizedRaster. The host fetches the 3×3 neighbourhood per render and stitches it onto the padded canvas, so downstream filters see seamless pixels across tile borders. - Sprite
Source - A sprite sheet: one atlas image plus a name → sub-rect index, so
iconnodes can crop named icons out of it (icons,fill-pattern). The runtime shape is [ezu_graph::SpriteSheet]; the host builds it.
Enums§
- DemEncoding
- Expand
Error - Field
Ref - Classify a string field on a node: a node reference, a param reference, or a literal string. The classification is by prefix:
- Func
Kind - Port-kind vocabulary for function signatures. Mirrors the graph’s
PortKindnames. - Legend
Geometry - The geometry a legend swatch’s stand-in feature is given.
- OnMissing
- What a tile-pyramid source does when a tile request 404s within
the source’s zoom range. (Other HTTP failures are always errors;
requests past
max-zoomalways upsample from the ancestor atmax-zoom.) - Param
Kind - Source
Decl - Declaration of one external data source. Mixes document-scoped
resources (
brush,image,sprite,font) — resolved once per style from a file path orhttp(s)://URL — and tile-scoped pyramids (mvt,pmtiles,dem) — fetched per tile via a URL template. - Sprite
Index - A sprite index, inline or by reference.
- Style
Error
Constants§
- MAX_
EXPANDED_ NODES - Hard ceiling on the number of nodes an expanded document may contain. Functions calling functions multiply node counts; this converts a runaway composition into a clear error.
Functions§
- blank_
comments - Blank every comment in
src, leaving all other bytes at their original offsets. Returns the input untouched when it holds no comments. - expand_
functions - Expand every
op: "func"call indocinto inline body copies. ReturnsNonewhen the document declares no functions (no work to do — callers keep using the original document). - parse_
hex_ color - Like
parse_hex_color_u8but with components scaled to[0, 1](still sRGB-encoded, not linearized). - parse_
hex_ color_ u8 - Parse
#rrggbb/#rrggbbaainto straight (non-premultiplied) sRGB components in[0, 255]. ReturnsNoneon malformed input.