diff options
author | 2023-03-03 04:57:55 +0100 | |
---|---|---|
committer | 2023-03-03 04:57:55 +0100 | |
commit | 6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f (patch) | |
tree | 7a9d57f52e3bee9f4d910c89178dc3e2917957a1 /graphics/src/geometry.rs | |
parent | d13d19ba3569560edd67f20b48f37548d10ceee9 (diff) | |
download | iced-6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f.tar.gz iced-6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f.tar.bz2 iced-6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f.zip |
Move `Canvas` and `QRCode` to `iced` crate
Rename `canvas` modules to `geometry` in graphics subcrates
Diffstat (limited to 'graphics/src/geometry.rs')
-rw-r--r-- | graphics/src/geometry.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/graphics/src/geometry.rs b/graphics/src/geometry.rs new file mode 100644 index 00000000..29ac84d6 --- /dev/null +++ b/graphics/src/geometry.rs @@ -0,0 +1,36 @@ +//! 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 iced_native::gradient::{self, Gradient}; + +use crate::Primitive; + +#[derive(Debug, Clone)] +pub struct Geometry(pub Primitive); + +impl From<Geometry> for Primitive { + fn from(geometry: Geometry) -> Self { + geometry.0 + } +} + +pub trait Renderer: iced_native::Renderer { + type Geometry; + + fn draw(&mut self, geometry: Vec<Self::Geometry>); +} |