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.rs27
1 files changed, 2 insertions, 25 deletions
diff --git a/graphics/src/widget/canvas/stroke.rs b/graphics/src/widget/canvas/stroke.rs
index 2f02a2f3..f9b8e447 100644
--- a/graphics/src/widget/canvas/stroke.rs
+++ b/graphics/src/widget/canvas/stroke.rs
@@ -1,8 +1,6 @@
//! Create lines from a [crate::widget::canvas::Path] and assigns them various attributes/styles.
+pub use crate::triangle::Style;
-use crate::gradient::Gradient;
-use crate::layer::mesh;
-use crate::widget::canvas::frame::Transform;
use iced_native::Color;
/// The style of a stroke.
@@ -11,7 +9,7 @@ pub struct Stroke<'a> {
/// The color or gradient of the stroke.
///
/// By default, it is set to [`StrokeStyle::Solid`] `BLACK`.
- pub style: Style<'a>,
+ pub style: Style,
/// The distance between the two edges of the stroke.
pub width: f32,
/// The shape to be used at the end of open subpaths when they are stroked.
@@ -60,27 +58,6 @@ impl<'a> Default for Stroke<'a> {
}
}
-/// The style of a [`Stroke`].
-#[derive(Debug, Clone, Copy)]
-pub enum Style<'a> {
- /// A solid color
- Solid(Color),
- /// A color gradient
- Gradient(&'a Gradient),
-}
-
-impl<'a> Style<'a> {
- /// Converts a fill's [Style] to a [mesh::Style] for use in the renderer's shader.
- pub(crate) fn as_mesh_style(&self, transform: &Transform) -> mesh::Style {
- match self {
- Style::Solid(color) => mesh::Style::Solid(*color),
- Style::Gradient(gradient) => mesh::Style::Gradient(
- transform.transform_gradient((*gradient).clone()),
- ),
- }
- }
-}
-
/// The shape used at the end of open subpaths when they are stroked.
#[derive(Debug, Clone, Copy)]
pub enum LineCap {