6 stable releases

1.2.1 Oct 6, 2024
1.1.2 Oct 7, 2023
1.1.1 Sep 30, 2023
1.1.0 Sep 25, 2023
1.0.0 Sep 23, 2023

#451 in Images

Download history 2/week @ 2024-08-02 3/week @ 2024-08-23 7/week @ 2024-08-30 5/week @ 2024-09-06 5/week @ 2024-09-13 19/week @ 2024-09-20 80/week @ 2024-09-27 559/week @ 2024-10-04 420/week @ 2024-10-11 406/week @ 2024-10-18 74/week @ 2024-10-25 21/week @ 2024-11-01 15/week @ 2024-11-08 5/week @ 2024-11-15

135 downloads per month

MIT/Apache

12KB
195 lines

unsvg

unsvg is a Rust crate that provides a very simple SVG (Scalable Vector Graphics) rendering library. It is built upon the solid foundation of the resvg crate and offers developers an easy to use system for generating simple images.

Unsvg was developed for COMP6991: Solving Modern Programming Problems with Rust, a course at the University of New South Wales.

Usage

To use unsvg in your Rust project, simply add it as a dependency in your Cargo.toml:

[dependencies]
unsvg = "0.1"

Then, import it into your code:

use unsvg::{Image, COLORS};

fn main() -> Result<(), String> {
    let mut img: Image = Image::new(200, 200);
    let second_point = img.draw_simple_line(10.0, 10.0, 120, 100.0, COLORS[1])?;
    let third_point = img.draw_simple_line(second_point.0, second_point.1, 240, 100.0, COLORS[2])?;
    let _ = img.draw_simple_line(third_point.0, third_point.1, 0, 100.0, COLORS[3])?;

    img.save_svg("path_to.svg")?;

    Ok(())
}

For detailed usage instructions and examples, please refer to the documentation.

Documentation

Explore the full capabilities of unsvg by visiting our documentation. You'll find comprehensive guides, API references, and example code to help you get started quickly.

Contributions

We welcome contributions from the open-source community. If you find issues, have feature requests, or want to contribute code, please visit our GitHub repository here and get involved.

License

unsvg is Copyright © University of New South Wales, licensed under MIT or Apache 2.0 at your option.

Dependencies

~4.5MB
~90K SLoC