svg_path/svg

Small helpers for rendering paths as complete SVG documents.

Types

pub type ThingToDraw {
  StyledPath(svg_path.Path, String)
  Text(String, String, vec2.Vec2(Float), Int)
}

Constructors

pub type ThingsToDraw =
  List(ThingToDraw)

Values

pub fn document(
  things things: List(ThingToDraw),
  view_box view_box: svg_path.BoundingBox,
) -> String

Render styled paths and text labels as a complete SVG document.

The supplied bounding box is used directly as the document viewBox. StyledPath contains a path and a raw CSS declaration string for its style attribute. Text contains text, a raw CSS declaration string for its style attribute, a position, and a font size.

pub fn labeled_point(
  label: String,
  color: String,
  point: vec2.Vec2(Float),
  font_size: Int,
) -> List(ThingToDraw)
pub fn paths(
  things things: List(ThingToDraw),
  view_box view_box: svg_path.BoundingBox,
) -> String

Render styled paths and text labels as a complete SVG document.

This is an older name for document.

Search Document