Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emilyselwood/esvg
Document object model based SVG library written in rust.
https://github.com/emilyselwood/esvg
Last synced: about 1 month ago
JSON representation
Document object model based SVG library written in rust.
- Host: GitHub
- URL: https://github.com/emilyselwood/esvg
- Owner: emilyselwood
- License: mit
- Created: 2023-02-04T22:18:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-04T14:21:48.000Z (5 months ago)
- Last Synced: 2024-10-31T11:40:20.104Z (2 months ago)
- Language: Rust
- Size: 40 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esvg
A document object model based SVG library for construction of vector graphics.
Access is available to the attributes and tags allowing you to construct any SVG you need.
Uses [Polygonical](https://docs.rs/polygonical/) for its shape representation
## Examples
Construct a document and draw a circle
```rust,editableuse esvg::page::Page;
use esvg::{create_document, Element};
use polygonical::point::Point;let page = Page::A4(96); // 96 dpi
let mut doc = create_document(&page);let mut group = Element::new("g");
group.set("class", "foo");let mut circle = esvg::shapes::circle(page.center(), 50);
circle.add_style("stroke", "red");group.add(&circle);
doc.add(&group);let expected = "\n
\t
\t\t
\t";
assert_eq!(doc.to_pretty_string(), expected);
```
## Features
* Constructing SVGs in memory
* Reading SVGs (Including comments and text nodes)
* Writing SVGs (Including comments and text nodes)
* Path objects
* Text objects
* Circles
* Common page sizes built in## Wanted features
* Path data to polygons
## Things we explicitly won't support
* Converting SVGs to other formats.