Skip to main content

Crate spritore

Crate spritore 

Source
Expand description

Generate MapLibre-compatible sprite assets from Rust.

render_icon returns RGBA pixels for one SVG, while build_sprite_sheet produces a PNG sprite sheet and index. The default cli feature also builds the spritore command-line interface; disable default features when only the library API is needed. The command accepts a directory of SVG files and writes the PNG and JSON files used by a MapLibre style.

Structs§

BuildOptions
Options controlling sprite sheet construction.
RenderedIcon
A rasterized icon with straight-alpha RGBA pixels.
SpriteIndexEntry
A MapLibre sprite index entry.
SpriteSheet
A PNG sprite sheet and its MapLibre index.

Enums§

Error
An error produced while rendering an icon or building a sprite sheet.

Functions§

build_sprite_sheet
Builds a MapLibre PNG sprite sheet from rasterized icons.
index_to_json
Serializes a MapLibre sprite index as pretty JSON.
render_icon
Rasterizes one SVG icon at the requested pixel ratio.