summaryrefslogtreecommitdiffstats
path: root/graphics/src/geometry.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-03-09 19:05:38 +0100
committerLibravatar GitHub <noreply@github.com>2023-03-09 19:05:38 +0100
commitcaf2836b1b15bff6e8a2ea72441d67f297eb8707 (patch)
tree0ffa0d1d604780999892b88de85ee93e3ed7d539 /graphics/src/geometry.rs
parent11b2c3bbe31a43e73a61b9bd9f022233f302ae27 (diff)
parent424ac8177309440bbd8efe0dd9f7622cb10807ce (diff)
downloadiced-caf2836b1b15bff6e8a2ea72441d67f297eb8707.tar.gz
iced-caf2836b1b15bff6e8a2ea72441d67f297eb8707.tar.bz2
iced-caf2836b1b15bff6e8a2ea72441d67f297eb8707.zip
Merge pull request #1748 from iced-rs/feature/software-renderer
Software renderer, runtime renderer fallback, and core consolidation
Diffstat (limited to '')
-rw-r--r--graphics/src/geometry.rs36
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..8db1594a
--- /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_core::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_core::Renderer {
+ type Geometry;
+
+ fn draw(&mut self, geometry: Vec<Self::Geometry>);
+}