Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

yxdunc/svg_composer

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVG Composer

Latest version

A strongly typed SVG composing library written in Rust. This library allows you to ensure the soundness of your generated SVGs at the compile time of your project.

This project was made originaly for the generative art project : https://stegano.graphics

Rendering example of stegano.graphics using this library: rendering example image

Disclaimer

This library is still in early development and some API changes are to be expected, mainly to further enforce typing.

Example

let svg_document = Document::new(
    vec![Box::new(
        Path::new()
            .set_stroke(Paint::from_color(Color::from_name(ColorName::Fuchsia)))
            .set_stroke_width(Size::from_length(10.0))
            .add_commands(vec![
                Box::new(MoveTo {
                    point: (11., 1.),
                    coordinate_type: CoordinateType::Absolute,
                }),
                Box::new(LineTo {
                    point: (10.0, 20.0),
                    option: LineToOption::Default,
                    coordinate_type: CoordinateType::Relative,
                }),
                Box::new(LineTo {
                    point: (-20.0, 0.0),
                    option: LineToOption::Default,
                    coordinate_type: CoordinateType::Relative,
                }),
                Box::new(End {}),
            ]),
    )],
    Some([0., 0., 100., 100.]),
);

// This rendering outputs a .svg file which can then be rendered as an image by an svg renderer
println!("{}", svg_document.render());

About

A strongly typed SVG composing library written in Rust. This library allows you to ensure the soundness of your generated SVGs at the compile time of your project.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.