Ada

Build Status Crates.io docs.rs

A 2D Shapes pixel rendering library in rust. Supported shapes are: * Line2D * Rectangle2D * Ellipse2D * Polygon2D * Bezier2D [Both quadratic and cubic]

No use of unsafe blocks. #![forbid(unsafe_code)] is also declared at crate level.

Usage

Add this to Cargo.toml file: toml [dependencies] ada = "0.0.1"

Example code:

```rust use ada::{shape, Canvas};

const WIDTH: usize = 512; const HEIGHT: usize = 512;

// create a pixel buffer for RGBA values let mut cbuffer: Vec = vec![0; 4 * WIDTH * HEIGHT];

// create canvas let mut canvas = Canvas::new(WIDTH, HEIGHT, &mut cbuffer[..]).unwrap();

// draw line shape::draw_line2d(50, 50, 200, 300, canvas, &ada::color::WHITE);

// draw rectangle shape::drawrect2d(50, 100, 100, 150, canvas, &ada::color::RED); // hollow shape::drawrect2d_filled(50, 100, 90, 120, canvas, &ada::color::GREEN); // filled ```

You can find more examples for all shapes in examples folder. To run an example: shell cargo run --example draw_hollow

Contributing

Please feel free to open any issues or pull requests.

License

This is under Apache 2.0 License.