Crates.io | mksvg |
lib.rs | mksvg |
version | 0.3.0 |
source | src |
created_at | 2018-06-23 22:29:38.015025 |
updated_at | 2020-05-30 12:36:59.89838 |
description | A Crate for writing svgs and laying out printable cards |
homepage | |
repository | https://github.com/storyfeet/mksvg_rs |
max_upload_size | |
id | 71422 |
size | 41,540 |
An Svg Printer for Rust
Breaking change -- Now uses anyhow and thiserror instead of failure and failure_derive Breaking change -- Now passes through error type which has now been attached to the SvgWrite Trait
Major change, all tags now need to be added using the Tag::tagname feature. This means that SvgWrite is no longer reliant on Generics and can be a Dynamic type.
To wrap a tag use
let mut inner_writer = Tag::g().transform(3,4).wrap(outer_writer);
Tag::rect(5,6,100,100).write(&mut inner_writer);
when inner_writer
is dropped, outer_writer
will be writable again, ensuring the structure of the Svg is correct
The Page drawing library has now also changed to use a Builder Pattern.
eg
let files = page::Pages::build(cards).page_size(400,500).grid_size(4,4).write_pages("base/path_");
Added Two new major types. The Tag, and Text, these can now be build and finished with a write on an SvgWrite eg: Tag::rect(x,y,w,h).fill("red").write<S:SvgWrite>(s:S);
Text also has a special method called bg which adds a a copy of the item behind it, to allow for wide strokes that don't cover the inside.
end
or g_end
as drop will write the close.