summaryrefslogtreecommitdiffstats
path: root/graphics/src/geometry
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/geometry')
-rw-r--r--graphics/src/geometry/fill.rs14
-rw-r--r--graphics/src/geometry/path.rs2
-rw-r--r--graphics/src/geometry/style.rs3
3 files changed, 16 insertions, 3 deletions
diff --git a/graphics/src/geometry/fill.rs b/graphics/src/geometry/fill.rs
index 2e8c1669..b773c99b 100644
--- a/graphics/src/geometry/fill.rs
+++ b/graphics/src/geometry/fill.rs
@@ -1,8 +1,9 @@
//! Fill [crate::widget::canvas::Geometry] with a certain style.
-use iced_core::{Color, Gradient};
-
pub use crate::geometry::Style;
+use crate::core::Color;
+use crate::gradient::{self, Gradient};
+
/// The style used to fill geometry.
#[derive(Debug, Clone)]
pub struct Fill {
@@ -49,6 +50,15 @@ impl From<Gradient> for Fill {
}
}
+impl From<gradient::Linear> for Fill {
+ fn from(gradient: gradient::Linear) -> Self {
+ Fill {
+ style: Style::Gradient(Gradient::Linear(gradient)),
+ ..Default::default()
+ }
+ }
+}
+
/// The fill rule defines how to determine what is inside and what is outside of
/// a shape.
///
diff --git a/graphics/src/geometry/path.rs b/graphics/src/geometry/path.rs
index c3127bdf..3d8fc6fa 100644
--- a/graphics/src/geometry/path.rs
+++ b/graphics/src/geometry/path.rs
@@ -53,11 +53,13 @@ impl Path {
Self::new(|p| p.circle(center, radius))
}
+ /// Returns the internal [`lyon_path::Path`].
#[inline]
pub fn raw(&self) -> &lyon_path::Path {
&self.raw
}
+ /// Returns the current [`Path`] with the given transform applied to it.
#[inline]
pub fn transform(&self, transform: &lyon_path::math::Transform) -> Path {
Path {
diff --git a/graphics/src/geometry/style.rs b/graphics/src/geometry/style.rs
index be9ee376..a0f4b08a 100644
--- a/graphics/src/geometry/style.rs
+++ b/graphics/src/geometry/style.rs
@@ -1,4 +1,5 @@
-use iced_core::{Color, Gradient};
+use crate::core::Color;
+use crate::geometry::Gradient;
/// The coloring style of some drawing.
#[derive(Debug, Clone, PartialEq)]