kludgine_core/shape/
stroke.rs1use easygpu_lyon::lyon_tessellation::StrokeOptions;
2use figures::Figure;
3
4use crate::color::Color;
5use crate::math::Scaled;
6
7#[derive(Default, Clone, Debug)]
9pub struct Stroke {
10 pub color: Color,
12 pub options: StrokeOptions,
14}
15
16impl Stroke {
17 #[must_use]
19 pub fn new(color: Color) -> Self {
20 Self {
21 color,
22 options: StrokeOptions::default(),
23 }
24 }
25
26 #[must_use]
28 pub const fn with_options(mut self, options: StrokeOptions) -> Self {
29 self.options = options;
30 self
31 }
32
33 #[must_use]
35 pub fn line_width<F: Into<Figure<f32, Scaled>>>(mut self, width: F) -> Self {
36 self.options.line_width = width.into().get();
37 self
38 }
39}