diff options
author | 2023-05-19 03:32:21 +0200 | |
---|---|---|
committer | 2023-05-19 03:32:21 +0200 | |
commit | 4c1a082f0468a59099bbf8aa8991420a41234948 (patch) | |
tree | 42308071bc180f364c71cdc0bb0011235c01fe14 /graphics/src/geometry | |
parent | 6551a0b2ab6c831dd1d3646ecf55180339275e22 (diff) | |
download | iced-4c1a082f0468a59099bbf8aa8991420a41234948.tar.gz iced-4c1a082f0468a59099bbf8aa8991420a41234948.tar.bz2 iced-4c1a082f0468a59099bbf8aa8991420a41234948.zip |
Remove `Builder` abstractions for gradients
Diffstat (limited to '')
-rw-r--r-- | graphics/src/geometry.rs | 2 | ||||
-rw-r--r-- | graphics/src/geometry/fill.rs | 15 |
2 files changed, 13 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 6aa1f28b..b773c99b 100644 --- a/graphics/src/geometry/fill.rs +++ b/graphics/src/geometry/fill.rs @@ -1,8 +1,8 @@ //! Fill [crate::widget::canvas::Geometry] with a certain style. -use iced_core::Color; - pub use crate::geometry::Style; -use crate::Gradient; + +use crate::core::Color; +use crate::gradient::{self, Gradient}; /// The style used to fill geometry. #[derive(Debug, Clone)] @@ -50,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. /// |