ada

Primitive shapes rendering library in rust

Latest version: 0.3.0 registry icon
Maintenance score
0
Safety score
0
Popularity score
70
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.3.0 0 0 0 0 0
0.2.0 0 0 0 0 0
0.1.0 0 0 0 0 0

Stability
Latest release:

0.3.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant



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.3.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.