1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! A 2D Shapes pixel rendering library in rust. Supported shapes are:
//! * Line2D
//! * Rectangle2D
//! * Ellipse2D
//! * Polygon2D
//! * Bezier2D [Both quadratic and cubic]
//!
//! # Example
//!
//! ```ignore
//! use ada::{shape, Canvas};
//!
//! const WIDTH: usize = 512;
//! const HEIGHT: usize = 512;
//!
//! pub fn main {
//! // 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
//!
//! // draw circle
//! shape::draw_ellipse2d(350, 200, 100, 100, canvas, &ada::color::BLUE, &mut buffer[..]);
//! }
//! ```
// forbid unsafe code
extern crate test;
pub use Canvas;
pub use Color;
/// A type for result generated by Ada
pub type Result<T> = Result;