summaryrefslogtreecommitdiffstats
path: root/graphics/src/geometry
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-05-19 04:37:58 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-19 04:37:58 +0200
commitcc5d11f1a6fca90ea57e3fb3a69587c65281b6b9 (patch)
tree349d98171b467b7738874a5ef99ce536512c10eb /graphics/src/geometry
parent8e8b1e1eacc4e2c19c9878625f423c8e09e2d3b9 (diff)
parentf7ed645eddd96f7964268367e24abcb5bb78a979 (diff)
downloadiced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.tar.gz
iced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.tar.bz2
iced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.zip
Merge pull request #1846 from bungoboingo/feat/background-gradients
[Feature] Gradients for Backgrounds
Diffstat (limited to '')
-rw-r--r--graphics/src/geometry.rs2
-rw-r--r--graphics/src/geometry/fill.rs14
-rw-r--r--graphics/src/geometry/style.rs3
3 files changed, 15 insertions, 4 deletions
diff --git a/graphics/src/geometry.rs b/graphics/src/geometry.rs
index 88997288..729c3d44 100644
--- a/graphics/src/geometry.rs
+++ b/graphics/src/geometry.rs
@@ -12,7 +12,7 @@ pub use stroke::{LineCap, LineDash, LineJoin, Stroke};
pub use style::Style;
pub use text::Text;
-pub use crate::core::gradient::{self, Gradient};
+pub use crate::gradient::{self, Gradient};
use crate::Primitive;
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/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)]