summaryrefslogtreecommitdiffstats
path: root/graphics/src/geometry/stroke.rs
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
committerLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
commit633f405f3f78bc7f82d2b2061491b0e011137451 (patch)
tree5ebfc1f45d216a5c14a90492563599e6969eab4d /graphics/src/geometry/stroke.rs
parent41836dd80d0534608e7aedfbf2319c540a23de1a (diff)
parent21bd51426d900e271206f314e0c915dd41065521 (diff)
downloadiced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.gz
iced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.bz2
iced-633f405f3f78bc7f82d2b2061491b0e011137451.zip
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
# Conflicts: # Cargo.toml # core/src/window/icon.rs # core/src/window/id.rs # core/src/window/position.rs # core/src/window/settings.rs # examples/integration/src/main.rs # examples/integration_opengl/src/main.rs # glutin/src/application.rs # native/src/subscription.rs # native/src/window.rs # runtime/src/window/action.rs # src/lib.rs # src/window.rs # winit/Cargo.toml # winit/src/application.rs # winit/src/icon.rs # winit/src/settings.rs # winit/src/window.rs
Diffstat (limited to '')
-rw-r--r--graphics/src/geometry/stroke.rs (renamed from graphics/src/widget/canvas/stroke.rs)42
1 files changed, 6 insertions, 36 deletions
diff --git a/graphics/src/widget/canvas/stroke.rs b/graphics/src/geometry/stroke.rs
index 4c19251d..69a76e1c 100644
--- a/graphics/src/widget/canvas/stroke.rs
+++ b/graphics/src/geometry/stroke.rs
@@ -1,7 +1,7 @@
//! Create lines from a [crate::widget::canvas::Path] and assigns them various attributes/styles.
-pub use crate::widget::canvas::Style;
+pub use crate::geometry::Style;
-use iced_native::Color;
+use iced_core::Color;
/// The style of a stroke.
#[derive(Debug, Clone)]
@@ -59,9 +59,10 @@ impl<'a> Default for Stroke<'a> {
}
/// The shape used at the end of open subpaths when they are stroked.
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, Default)]
pub enum LineCap {
/// The stroke for each sub-path does not extend beyond its two endpoints.
+ #[default]
Butt,
/// At the end of each sub-path, the shape representing the stroke will be
/// extended by a square.
@@ -71,27 +72,12 @@ pub enum LineCap {
Round,
}
-impl Default for LineCap {
- fn default() -> LineCap {
- LineCap::Butt
- }
-}
-
-impl From<LineCap> for lyon::tessellation::LineCap {
- fn from(line_cap: LineCap) -> lyon::tessellation::LineCap {
- match line_cap {
- LineCap::Butt => lyon::tessellation::LineCap::Butt,
- LineCap::Square => lyon::tessellation::LineCap::Square,
- LineCap::Round => lyon::tessellation::LineCap::Round,
- }
- }
-}
-
/// The shape used at the corners of paths or basic shapes when they are
/// stroked.
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, Default)]
pub enum LineJoin {
/// A sharp corner.
+ #[default]
Miter,
/// A round corner.
Round,
@@ -99,22 +85,6 @@ pub enum LineJoin {
Bevel,
}
-impl Default for LineJoin {
- fn default() -> LineJoin {
- LineJoin::Miter
- }
-}
-
-impl From<LineJoin> for lyon::tessellation::LineJoin {
- fn from(line_join: LineJoin) -> lyon::tessellation::LineJoin {
- match line_join {
- LineJoin::Miter => lyon::tessellation::LineJoin::Miter,
- LineJoin::Round => lyon::tessellation::LineJoin::Round,
- LineJoin::Bevel => lyon::tessellation::LineJoin::Bevel,
- }
- }
-}
-
/// The dash pattern used when stroking the line.
#[derive(Debug, Clone, Copy, Default)]
pub struct LineDash<'a> {