WARNING: This crate is in very early stages. Anything could changes anytime. Use at your own risk.
This crate enables you to render simple 2D shapes to a buffer of pixels. After creating a Canvas, you have access to methods to fill in, or draw the outline of shapes.
A ppm module is included that lets you save your buffer as an image (that can be displayed by some major image viewers). The crate also works well together with minifb, thus you can even use it for small games / demos / visualizations.
```rust use std::fs::File; use vason::{ppm::encode_canvas, Canvas, Color};
fn main() { let mut canvas = Canvas::new(256, 256); canvas.clear((180, 255, 100)); canvas.fillrect(80, 40, 128, 192, Color::GREEN); canvas.fillcircle(-40, -40, 128, Color::BLUE); canvas.outline_circle(-40, -40, 178, Color::RED); canvas.line(256, 0, 0, 256, Color::MAGENTA);
let mut f = File::create("test.ppm").expect("could not create file");
encode_canvas(&canvas, &mut f).expect("could not write image to file");
} ```