blob: 1f3d2c01d4654017b549f5d763a30f15f5a43959 (
plain) (
blame)
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
|
//! Draw 2D graphics for your users.
//!
//! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a
//! [`Frame`]. It can be used for animation, data visualization, game graphics,
//! and more!
pub mod fill;
pub mod path;
pub mod stroke;
mod style;
mod text;
pub use fill::Fill;
pub use path::Path;
pub use stroke::{LineCap, LineDash, LineJoin, Stroke};
pub use style::Style;
pub use text::Text;
pub use crate::core::gradient::{self, Gradient};
use crate::Primitive;
/// A bunch of shapes that can be drawn.
#[derive(Debug, Clone)]
pub struct Geometry(pub Primitive);
impl From<Geometry> for Primitive {
fn from(geometry: Geometry) -> Self {
geometry.0
}
}
/// A renderer capable of drawing some [`Geometry`].
pub trait Renderer: crate::core::Renderer {
/// Draws the given layers of [`Geometry`].
fn draw(&mut self, layers: Vec<Geometry>);
}
|