ada 0.3.0

2D Primitive Shapes Rendering Library
Documentation
  • Coverage
  • 51.22%
    21 out of 41 items documented0 out of 9 items with examples
  • Size
  • Source code size: 69.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.8 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • deep110/ada
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • deep110

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:

[dependencies]
ada = "0.2.0"

Example code:

use ada::{shape, Canvas};

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

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

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

// draw line
shape::draw_line2d(50, 50, 200, 300, canvas, &ada::color::WHITE, &mut buffer[..]);

// draw rectangle
shape::draw_rect2d(50, 100, 100, 150, canvas, &ada::color::RED, &mut buffer[..]); // hollow
shape::draw_rect2d_filled(50, 100, 90, 120, canvas, &ada::color::GREEN, &mut buffer[..]); // filled

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

cargo run --example draw_hollow

Contributing

Please feel free to open any issues or pull requests.

License

This is under Apache 2.0 License.