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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! `draw` is a simple 2D vector drawing library.
//!
//! - `Canvas` is a container that defines the size and top-level components of your drawing.
//! - `Drawing` defines the position, style, and sub-components of a drawing.
//! - `Shape` defines the geometry of an individual shape such as a `Circle` or `Line`.
//! - `Style` defines the fill and stroke of a drawing.
//!
//! The general flow for creating a piece of art is:
//!
//! 1. Create a `Canvas`
//! 2. Create `Drawing` objects and add them to the Canvas `display_list`.
//! 3. Position and style the drawings
//! 4. Render and save the `Canvas` to whatever output format you want. (SVG, PNG, etc...)
//!
//! ## Basic Example
//!
//! ```rust
//! use draw::*;
//!
//! // create a canvas to draw on
//! let mut canvas = Canvas::new(100, 100);
//!
//! // create a new drawing
//! let mut rect = Drawing::new()
//! // give it a shape
//! .with_shape(Shape::Rectangle {
//! width: 50,
//! height: 50,
//! })
//! // move it around
//! .with_xy(25.0, 25.0)
//! // give it a cool style
//! .with_style(Style::stroked(5, Color::black()));
//!
//! // add it to the canvas
//! canvas.display_list.add(rect);
//!
//! // save the canvas as an svg
//! render::save(
//! &canvas,
//! "tests/svg/basic_end_to_end.svg",
//! SvgRenderer::new(),
//! )
//! .expect("Failed to save");
//! ```
//!
use EuclideanSpace;
use Point2;
use rgb;
pub use crateCanvas;
pub use crate;
pub use crateSvgRenderer;
pub use crate;
pub use crateColor;
pub use crate;
/// Drawings are stored in a vector; this `usize` is a handle to access the child
pub type DrawingId = usize;
pub type Point = ;
/// An alias for RGB<u8>
pub type RGB = RGB;