svg_definitions

Crates.iosvg_definitions
lib.rssvg_definitions
version0.3.2
sourcesrc
created_at2020-02-24 14:35:04.633246
updated_at2022-12-03 15:11:06.472806
descriptionA Rust library with definitions for SVG elements
homepagehttps://github.com/coastalwhite/svg_definitions.git
repositoryhttps://github.com/coastalwhite/svg_definitions.git
max_upload_size
id212033
size96,909
Gijs Burghoorn (coastalwhite)

documentation

README

Hello fellow Rustacians! Here is a crate with SVG Definitions. This was mostly created to serve as a backend crate for wasm_svg_graphics, but feel free to use it!

I am open to pull requests so please contribute!

Example

Creating a group with a triangle

use svg_definitions::prelude::*;

let triangle = SVGElem::new(Tag::Path)
    .set(Attr::StrokeWidth, 1)
    .set(Attr::Stroke, "#000")
    .set(Attr::Fill, "transparent")
    .set(Attr::D, PathData::new()
        .move_to((0.0, 0.0))
        .line_to((10.0, 0.0))
        .line_to((0.0, 10.0))
        .line_to((0.0, 0.0))
        .close_path()
    );

let group = SVGElem::new(Tag::G)
    .append(triangle);
Commit count: 35

cargo fmt