summaryrefslogtreecommitdiffstats
path: root/graphics/src/widget/canvas/stroke.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/widget/canvas/stroke.rs')
-rw-r--r--graphics/src/widget/canvas/stroke.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/graphics/src/widget/canvas/stroke.rs b/graphics/src/widget/canvas/stroke.rs
index c319b398..ed82f189 100644
--- a/graphics/src/widget/canvas/stroke.rs
+++ b/graphics/src/widget/canvas/stroke.rs
@@ -1,6 +1,6 @@
use iced_native::Color;
-
-use crate::widget::canvas::Gradient;
+use crate::gradient::Gradient;
+use crate::shader::Shader;
/// The style of a stroke.
#[derive(Debug, Clone)]
@@ -66,6 +66,15 @@ pub enum StrokeStyle<'a> {
Gradient(&'a Gradient),
}
+impl <'a> Into<Shader> for StrokeStyle<'a> {
+ fn into(self) -> Shader {
+ match self {
+ StrokeStyle::Solid(color) => Shader::Solid(color),
+ StrokeStyle::Gradient(gradient) => gradient.clone().into()
+ }
+ }
+}
+
/// The shape used at the end of open subpaths when they are stroked.
#[derive(Debug, Clone, Copy)]
pub enum LineCap {